cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsCallableVoidMethod.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Anton Deguet
7  Created on: 2010-09-26
8 
9  (C) Copyright 2010 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 
27 #ifndef _mtsCallableVoidMethod_h
28 #define _mtsCallableVoidMethod_h
29 
30 
32 #include <string>
33 
34 
44 template <class _classType>
46 
47 public:
49 
51  typedef _classType ClassType;
52 
55 
58  typedef void(_classType::*ActionType)(void);
59 
60 private:
62  inline mtsCallableVoidMethod(const ThisType & CMN_UNUSED(other)) {}
63 
64 protected:
68 
71 
72 public:
75 
81  mtsCallableVoidMethod(ActionType action, ClassType * classInstantiation):
82  BaseType(),
83  Action(action),
84  ClassInstantiation(classInstantiation)
85  {}
86 
89 
90  /* documented in base class */
91  inline mtsExecutionResult Execute(void) {
94  }
95 
96  /* documented in base class */
97  inline void ToStream(std::ostream & outputStream) const {
98  if (this->ClassInstantiation) {
99  outputStream << "method based callable void object using class/object \""
100  << mtsObjectName(this->ClassInstantiation) << "\"";
101  } else {
102  outputStream << "invalid method based callable object";
103  }
104  }
105 };
106 
107 #endif // _mtsCallableVoidMethod_h
std::string mtsObjectName(const mtsComponent *object)
Definition: mtsComponent.h:552
#define CMN_UNUSED(argument)
Definition: cmnPortability.h:479
mtsCallableVoidMethod(ActionType action, ClassType *classInstantiation)
Definition: mtsCallableVoidMethod.h:81
Definition: mtsCallableVoidBase.h:39
Defines a base class for a callable object with no argument.
mtsCallableVoidBase BaseType
Definition: mtsCallableVoidMethod.h:48
virtual ~mtsCallableVoidMethod()
Definition: mtsCallableVoidMethod.h:88
void ToStream(std::ostream &outputStream) const
Definition: mtsCallableVoidMethod.h:97
mtsCallableVoidMethod(void)
Definition: mtsCallableVoidMethod.h:74
_classType ClassType
Definition: mtsCallableVoidMethod.h:51
ActionType Action
Definition: mtsCallableVoidMethod.h:67
mtsCallableVoidMethod< ClassType > ThisType
Definition: mtsCallableVoidMethod.h:54
Definition: mtsExecutionResult.h:34
Definition: mtsCallableVoidMethod.h:45
ClassType * ClassInstantiation
Definition: mtsCallableVoidMethod.h:70
void(_classType::* ActionType)(void)
Definition: mtsCallableVoidMethod.h:58
mtsExecutionResult Execute(void)
Definition: mtsCallableVoidMethod.h:91
Definition: mtsExecutionResult.h:44