cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstMultiTask
mtsCommandBase.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): Ankur Kapoor, Anton Deguet
7
Created on: 2006-05-02
8
9
(C) Copyright 2006-2009 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 _mtsCommandBase_h
28
#define _mtsCommandBase_h
29
30
// These two includes are not required to compile this class but are
31
// pretty much always needed in conjunction with commands. To ease
32
// the user's life, we include them now.
33
//include <cisstMultiTask/mtsGenericObjectProxy.h>
34
#include <
cisstMultiTask/mtsExecutionResult.h
>
35
#include <
cisstMultiTask/mtsForwardDeclarations.h
>
36
37
#include <iostream>
38
#include <sstream>
39
43
class
mtsCommandBase {
44
45
private
:
47
inline
mtsCommandBase
(
const
mtsCommandBase &
CMN_UNUSED
(other));
48
49
protected
:
52
std::string
Name
;
53
58
bool
EnableFlag
;
59
60
public
:
62
inline
mtsCommandBase
(
void
):
63
Name
(
"??"
),
64
EnableFlag
(true)
65
{}
66
68
inline
mtsCommandBase
(
const
std::string & name):
69
Name
(name),
70
EnableFlag
(true)
71
{}
72
74
virtual
~mtsCommandBase
() {}
75
79
virtual
std::string
ToString
(
void
)
const
{
80
std::stringstream outputStream;
81
ToStream
(outputStream);
82
return
outputStream.str();
83
};
84
virtual
void
ToStream
(std::ostream & outputStream)
const
= 0;
86
89
virtual
size_t
NumberOfArguments
(
void
)
const
= 0;
90
91
virtual
bool
Returns
(
void
)
const
= 0;
92
97
inline
void
Enable
(
void
) {
98
this->EnableFlag =
true
;
99
}
100
101
inline
void
Disable
(
void
) {
102
this->EnableFlag =
false
;
103
}
104
105
inline
bool
IsEnabled
(
void
)
const
{
106
return
this->EnableFlag;
107
}
108
109
inline
bool
IsDisabled
(
void
)
const
{
110
return
!(this->EnableFlag);
111
}
112
113
116
inline
const
std::string &
GetName
(
void
)
const
{
117
return
this->Name;
118
}
119
};
120
121
125
inline
std::ostream &
operator <<
(std::ostream & outputStream,
126
const
mtsCommandBase
& command) {
127
command.
ToStream
(outputStream);
128
return
outputStream;
129
}
130
131
132
#endif
// _mtsCommandBase_h
133
mtsCommandBase
Definition
mtsCommandBase.h:43
mtsCommandBase::Returns
virtual bool Returns(void) const =0
mtsCommandBase::ToStream
virtual void ToStream(std::ostream &outputStream) const =0
mtsCommandBase::IsDisabled
bool IsDisabled(void) const
Definition
mtsCommandBase.h:109
mtsCommandBase::EnableFlag
bool EnableFlag
Definition
mtsCommandBase.h:58
mtsCommandBase::Disable
void Disable(void)
Definition
mtsCommandBase.h:101
mtsCommandBase::~mtsCommandBase
virtual ~mtsCommandBase()
Definition
mtsCommandBase.h:74
mtsCommandBase::ToString
virtual std::string ToString(void) const
Definition
mtsCommandBase.h:79
mtsCommandBase::GetName
const std::string & GetName(void) const
Definition
mtsCommandBase.h:116
mtsCommandBase::NumberOfArguments
virtual size_t NumberOfArguments(void) const =0
mtsCommandBase::Name
std::string Name
Definition
mtsCommandBase.h:52
mtsCommandBase::Enable
void Enable(void)
Definition
mtsCommandBase.h:97
mtsCommandBase::mtsCommandBase
mtsCommandBase(const std::string &name)
Definition
mtsCommandBase.h:68
mtsCommandBase::IsEnabled
bool IsEnabled(void) const
Definition
mtsCommandBase.h:105
mtsCommandBase::mtsCommandBase
mtsCommandBase(void)
Definition
mtsCommandBase.h:62
CMN_UNUSED
#define CMN_UNUSED(argument)
Definition
cmnPortability.h:497
operator<<
std::ostream & operator<<(std::ostream &outputStream, const mtsCommandBase &command)
Definition
mtsCommandBase.h:125
mtsExecutionResult.h
mtsForwardDeclarations.h
Forward declarations and #define for cisstMultiTask.
Generated by
1.18.0