cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstMultiTask
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
26
27
#ifndef _mtsCallableVoidMethod_h
28
#define _mtsCallableVoidMethod_h
29
30
31
#include <
cisstMultiTask/mtsCallableVoidBase.h
>
32
#include <string>
33
34
44
template
<
class
_
class
Type>
45
class
mtsCallableVoidMethod:
public
mtsCallableVoidBase
{
46
47
public
:
48
typedef
mtsCallableVoidBase
BaseType
;
49
51
typedef
_classType
ClassType
;
52
54
typedef
mtsCallableVoidMethod<ClassType>
ThisType
;
55
58
typedef
void(_classType::*
ActionType
)(void);
59
60
private
:
62
inline
mtsCallableVoidMethod
(
const
ThisType
&
CMN_UNUSED
(other)) {}
63
64
protected
:
67
ActionType
Action
;
68
70
ClassType
*
ClassInstantiation
;
71
72
public
:
74
mtsCallableVoidMethod
(
void
):
BaseType
(),
ClassInstantiation
(0) {}
75
81
mtsCallableVoidMethod
(
ActionType
action,
ClassType
* classInstantiation):
82
BaseType
(),
83
Action
(action),
84
ClassInstantiation
(classInstantiation)
85
{}
86
88
virtual
~mtsCallableVoidMethod
() {}
89
90
/* documented in base class */
91
inline
mtsExecutionResult
Execute
(
void
) {
92
(
ClassInstantiation
->*
Action
)();
93
return
mtsExecutionResult::COMMAND_SUCCEEDED
;
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
mtsCallableVoidBase::mtsCallableVoidBase
mtsCallableVoidBase(void)
Definition
mtsCallableVoidBase.h:44
mtsCallableVoidMethod< ClassType >::Action
ActionType Action
Definition
mtsCallableVoidMethod.h:67
mtsCallableVoidMethod::mtsCallableVoidMethod
mtsCallableVoidMethod(void)
Definition
mtsCallableVoidMethod.h:74
mtsCallableVoidMethod< ClassType >::ClassInstantiation
ClassType * ClassInstantiation
Definition
mtsCallableVoidMethod.h:70
mtsCallableVoidMethod::BaseType
mtsCallableVoidBase BaseType
Definition
mtsCallableVoidMethod.h:48
mtsCallableVoidMethod< ClassType >::ActionType
void(ClassType::*) ActionType(void)
Definition
mtsCallableVoidMethod.h:58
mtsCallableVoidMethod::ClassType
_classType ClassType
Definition
mtsCallableVoidMethod.h:51
mtsCallableVoidMethod::ToStream
void ToStream(std::ostream &outputStream) const
Definition
mtsCallableVoidMethod.h:97
mtsCallableVoidMethod::~mtsCallableVoidMethod
virtual ~mtsCallableVoidMethod()
Definition
mtsCallableVoidMethod.h:88
mtsCallableVoidMethod::ThisType
mtsCallableVoidMethod< ClassType > ThisType
Definition
mtsCallableVoidMethod.h:54
mtsCallableVoidMethod::mtsCallableVoidMethod
mtsCallableVoidMethod(ActionType action, ClassType *classInstantiation)
Definition
mtsCallableVoidMethod.h:81
mtsCallableVoidMethod::Execute
mtsExecutionResult Execute(void)
Definition
mtsCallableVoidMethod.h:91
mtsExecutionResult
Definition
mtsExecutionResult.h:34
mtsExecutionResult::COMMAND_SUCCEEDED
@ COMMAND_SUCCEEDED
Definition
mtsExecutionResult.h:44
CMN_UNUSED
#define CMN_UNUSED(argument)
Definition
cmnPortability.h:497
mtsCallableVoidBase.h
Defines a base class for a callable object with no argument.
mtsObjectName
std::string mtsObjectName(const mtsComponent *object)
Definition
mtsComponent.h:588
Generated by
1.18.0