cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstMultiTask
mtsFunctionRead.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): Peter Kazanzides, Anton Deguet
7
8
(C) Copyright 2007-2014 Johns Hopkins University (JHU), All Rights Reserved.
9
10
--- begin cisst license - do not edit ---
11
12
This software is provided "as is" under an open source license, with
13
no warranty. The complete license can be found in license.txt and
14
http://www.cisst.org/cisst/license.txt.
15
16
--- end cisst license ---
17
*/
18
19
24
25
#ifndef _mtsFunctionRead_h
26
#define _mtsFunctionRead_h
27
28
29
#include <
cisstMultiTask/mtsFunctionBase.h
>
30
#include <
cisstMultiTask/mtsCommandRead.h
>
31
#include <
cisstMultiTask/mtsForwardDeclarations.h
>
32
#include <
cisstMultiTask/mtsGenericObjectProxy.h
>
33
34
// Always include last
35
#include <
cisstMultiTask/mtsExport.h
>
36
37
class
CISST_EXPORT
mtsFunctionRead
:
public
mtsFunctionBase
{
38
public
:
39
typedef
mtsCommandRead
CommandType
;
40
protected
:
41
CommandType
*
Command
;
42
43
#ifndef SWIG
44
template
<
typename
_userType,
bool
>
45
class
ConditionalWrap
{
46
public
:
47
static
mtsExecutionResult
Call
(
const
mtsFunctionRead
* function, _userType & argument) {
48
mtsGenericObjectProxyRef<_userType>
argumentWrapped(argument);
49
return
function->
ExecuteGeneric
(argumentWrapped);
50
}
51
};
52
template
<
typename
_userType>
53
class
ConditionalWrap
<_userType, true> {
54
public
:
55
static
mtsExecutionResult
Call
(
const
mtsFunctionRead
* function, _userType & argument) {
56
return
function->
ExecuteGeneric
(argument);
57
}
58
};
59
#endif
60
61
public
:
64
mtsFunctionRead
(
void
);
65
67
virtual
~mtsFunctionRead
();
68
69
// documented in base class
70
bool
Detach
(
void
);
71
72
// documented in base class
73
bool
IsValid
(
void
)
const
;
74
80
bool
Bind
(
CommandType
* command);
81
84
mtsExecutionResult
operator()
(
mtsGenericObject
& argument)
const
85
{
return
ExecuteGeneric
(argument); }
86
87
mtsExecutionResult
ExecuteGeneric
(
mtsGenericObject
& argument)
const
;
88
89
#ifndef SWIG
91
template
<
class
_userType>
92
mtsExecutionResult
operator()
(_userType & argument)
const
{
93
mtsExecutionResult
result =
Command
?
94
ConditionalWrap<_userType, cmnIsDerivedFrom<_userType, mtsGenericObject>::IS_DERIVED
>::Call(
this
, argument)
95
:
mtsExecutionResult::FUNCTION_NOT_BOUND
;
96
return
result;
97
}
98
#endif
99
101
CommandType
*
GetCommand
(
void
)
const
;
102
104
const
mtsGenericObject
*
GetArgumentPrototype
(
void
)
const
;
105
107
void
ToStream
(std::ostream & outputStream)
const
;
108
109
};
110
111
#endif
// _mtsFunctionRead_h
mtsCommandRead
Definition
mtsCommandRead.h:42
mtsExecutionResult
Definition
mtsExecutionResult.h:34
mtsExecutionResult::FUNCTION_NOT_BOUND
@ FUNCTION_NOT_BOUND
Definition
mtsExecutionResult.h:44
mtsFunctionBase::mtsFunctionBase
mtsFunctionBase()
mtsFunctionRead::ConditionalWrap< _userType, true >::Call
static mtsExecutionResult Call(const mtsFunctionRead *function, _userType &argument)
Definition
mtsFunctionRead.h:55
mtsFunctionRead::ConditionalWrap
Definition
mtsFunctionRead.h:45
mtsFunctionRead::ConditionalWrap::Call
static mtsExecutionResult Call(const mtsFunctionRead *function, _userType &argument)
Definition
mtsFunctionRead.h:47
mtsFunctionRead::operator()
mtsExecutionResult operator()(mtsGenericObject &argument) const
Definition
mtsFunctionRead.h:84
mtsFunctionRead::Detach
bool Detach(void)
mtsFunctionRead::ExecuteGeneric
mtsExecutionResult ExecuteGeneric(mtsGenericObject &argument) const
mtsFunctionRead::ToStream
void ToStream(std::ostream &outputStream) const
mtsFunctionRead::Command
CommandType * Command
Definition
mtsFunctionRead.h:41
mtsFunctionRead::GetCommand
CommandType * GetCommand(void) const
mtsFunctionRead::Bind
bool Bind(CommandType *command)
mtsFunctionRead::CommandType
mtsCommandRead CommandType
Definition
mtsFunctionRead.h:39
mtsFunctionRead::GetArgumentPrototype
const mtsGenericObject * GetArgumentPrototype(void) const
mtsFunctionRead::~mtsFunctionRead
virtual ~mtsFunctionRead()
mtsFunctionRead::operator()
mtsExecutionResult operator()(_userType &argument) const
Definition
mtsFunctionRead.h:92
mtsFunctionRead::mtsFunctionRead
mtsFunctionRead(void)
mtsFunctionRead::IsValid
bool IsValid(void) const
mtsGenericObject
Base class for data object in cisstMultiTask.
Definition
mtsGenericObject.h:52
mtsGenericObjectProxyRef
Definition
mtsGenericObjectProxy.h:491
CISST_EXPORT
#define CISST_EXPORT
Definition
cmnExportMacros.h:50
mtsCommandRead.h
Defines a command with one argument.
mtsExport.h
Rules of exporting.
mtsForwardDeclarations.h
Forward declarations and #define for cisstMultiTask.
mtsFunctionBase.h
Defines a base function object to allow heterogeneous containers of functions.
mtsGenericObjectProxy.h
Generated by
1.18.0