cisst-saw
Loading...
Searching...
No Matches
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
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21
26
27#ifndef _mtsCallableVoidMethod_h
28#define _mtsCallableVoidMethod_h
29
30
32#include <string>
33
34
44template <class _classType>
45class mtsCallableVoidMethod: public mtsCallableVoidBase {
46
47public:
49
51 typedef _classType ClassType;
52
54 typedef mtsCallableVoidMethod<ClassType> ThisType;
55
58 typedef void(_classType::*ActionType)(void);
59
60private:
62 inline mtsCallableVoidMethod(const ThisType & CMN_UNUSED(other)) {}
63
64protected:
68
71
72public:
75
81 mtsCallableVoidMethod(ActionType action, ClassType * classInstantiation):
82 BaseType(),
83 Action(action),
84 ClassInstantiation(classInstantiation)
85 {}
86
89
90 /* documented in base class */
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
mtsCallableVoidBase(void)
Definition mtsCallableVoidBase.h:44
ActionType Action
Definition mtsCallableVoidMethod.h:67
mtsCallableVoidMethod(void)
Definition mtsCallableVoidMethod.h:74
ClassType * ClassInstantiation
Definition mtsCallableVoidMethod.h:70
mtsCallableVoidBase BaseType
Definition mtsCallableVoidMethod.h:48
void(ClassType::*) ActionType(void)
Definition mtsCallableVoidMethod.h:58
_classType ClassType
Definition mtsCallableVoidMethod.h:51
void ToStream(std::ostream &outputStream) const
Definition mtsCallableVoidMethod.h:97
virtual ~mtsCallableVoidMethod()
Definition mtsCallableVoidMethod.h:88
mtsCallableVoidMethod< ClassType > ThisType
Definition mtsCallableVoidMethod.h:54
mtsCallableVoidMethod(ActionType action, ClassType *classInstantiation)
Definition mtsCallableVoidMethod.h:81
mtsExecutionResult Execute(void)
Definition mtsCallableVoidMethod.h:91
Definition mtsExecutionResult.h:34
@ COMMAND_SUCCEEDED
Definition mtsExecutionResult.h:44
#define CMN_UNUSED(argument)
Definition cmnPortability.h:497
Defines a base class for a callable object with no argument.
std::string mtsObjectName(const mtsComponent *object)
Definition mtsComponent.h:588