20#ifndef _mtsComponent_h
21#define _mtsComponent_h
83 void ToStream(std::ostream & outputStream)
const override {
84 outputStream <<
"Name: " <<
Name
85 <<
", Arg: " <<
Arg << std::endl;
89 virtual void ToStreamRaw(std::ostream & outputStream,
const char delimiter =
' ',
90 bool headerOnly =
false,
const std::string & headerPrefix =
"")
const override {
93 outputStream << headerPrefix <<
"-name" << delimiter
94 << headerPrefix <<
"-arg";
96 outputStream << this->Name << delimiter
103 virtual bool FromStreamRaw(std::istream & inputStream,
const char delimiter =
' ')
override {
105 if (inputStream.fail())
108 if (inputStream.fail())
247 virtual void ConfigureJSON(
const Json::Value & configuration);
252 void GetName(std::string & placeHolder)
const;
258 const std::set<std::string> &
GetTags(
void)
const;
262 void SetName(
const std::string & componentName);
266 virtual void Configure(
const std::string & filename =
"");
571 void ToStream(std::ostream & outputStream)
const override;
576 bool SetReplayData(
const std::string & stateTableName,
const std::string & fileName);
589 return "mtsComponent: " +
object->GetName();
Base class for high level objects.
Definition cmnGenericObject.h:53
cmnLODMultiplexerStreambuf< char > StreamBufType
Definition cmnLogger.h:246
Definition cmnNamedMap.h:54
Definition mtsComponent.h:60
void SerializeRaw(std::ostream &outputStream) const override
Definition mtsComponent.h:71
void ToStream(std::ostream &outputStream) const override
Definition mtsComponent.h:83
virtual bool FromStreamRaw(std::istream &inputStream, const char delimiter=' ') override
Definition mtsComponent.h:103
mtsComponentConstructorNameAndArg(const std::string &name, const T &arg)
Definition mtsComponent.h:67
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const override
Definition mtsComponent.h:89
void DeSerializeRaw(std::istream &inputStream) override
Definition mtsComponent.h:77
mtsComponentConstructorNameAndArg()
Definition mtsComponent.h:66
int Arg
Definition mtsComponent.h:64
~mtsComponentConstructorNameAndArg()
Definition mtsComponent.h:69
std::string Name
Definition mtsComponent.h:63
Definition mtsComponent.h:150
virtual mtsInterfaceInput * AddInterfaceInput(const std::string &interfaceInputName)
CISST_DEPRECATED mtsInterfaceRequired * AddRequiredInterface(const std::string &requiredInterfaceName)
Definition mtsComponent.h:374
void UseSeparateLogFile(const std::string &filename, bool forwardToLogger=true)
size_t ProcessMailBoxes(InterfacesProvidedMapType &interfaces)
InterfacesOutputMapType InterfacesOutput
Definition mtsComponent.h:502
bool RemoveInterfaceProvided(const std::string &interfaceProvidedName)
bool UseSeparateLogFileFlag
Definition mtsComponent.h:482
mtsInterfaceRequired * AddInterfaceRequiredExisting(const std::string &interfaceRequiredName, mtsInterfaceRequired *interfaceRequired)
bool ReplayMode
Definition mtsComponent.h:582
bool CreateAndWait(double timeoutInSeconds)
mtsInterfaceOutput * GetInterfaceOutput(const std::string &interfaceOutputName) const
mtsInterfaceRequired * EnableDynamicComponentManagement(void)
Enable support for dynamic component management services.
cmnNamedMap< mtsInterfaceProvided > InterfacesProvidedMapType
Definition mtsComponent.h:499
size_t GetNumberOfInterfacesOutput(void) const
bool StartAndWait(double timeoutInSeconds)
mtsInterfaceOutput * AddInterfaceOutputExisting(const std::string &interfaceOutputName, mtsInterfaceOutput *interfaceOutput)
void ToStream(std::ostream &outputStream) const override
friend class mtsManagerLocal
Definition mtsComponent.h:154
std::vector< std::string > GetNamesOfInterfacesInput(void) const
bool KillAndWait(double timeoutInSeconds)
void GetName(std::string &placeHolder) const
const std::set< std::string > & GetTags(void) const
friend class mtsManagerComponent
Definition mtsComponent.h:153
InterfacesRequiredMapType InterfacesRequired
Definition mtsComponent.h:510
CISST_DEPRECATED mtsInterfaceProvided * AddProvidedInterface(const std::string &interfaceProvidedName)
Definition mtsComponent.h:319
void InterfaceInternalCommands_GetEndUserInterface(const mtsEndUserInterfaceArg &argin, mtsEndUserInterfaceArg &argout)
const mtsInterfaceProvided * GetInterfaceProvidedFor(const std::string &interfaceRequiredName)
std::set< std::string > mTags
Definition mtsComponent.h:165
mtsInterfaceProvided * AddInterfaceProvidedUsingMailbox(const std::string &interfaceProvidedName, mtsMailBox *mailBox)
const std::string & GetName(void) const
std::string Name
Definition mtsComponent.h:159
std::ofstream * LogFile
Definition mtsComponent.h:492
mtsInterfaceInput * GetInterfaceInput(const std::string &interfaceInputName) const
bool InterfaceProvidedOrOutputExists(const std::string &interfaceName, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_VERBOSE) const
std::vector< std::string > GetNamesOfInterfacesRequired(void) const
bool AddStateTable(mtsStateTable *existingStateTable, bool addInterfaceProvided=true)
mtsStateTable * GetStateTable(const std::string &stateTableName)
size_t ProcessQueuedCommands(void)
Definition mtsComponent.h:525
InterfacesInputMapType InterfacesInput
Definition mtsComponent.h:512
mtsInterfaceInput * AddInterfaceInputExisting(const std::string &interfaceInputName, mtsInterfaceInput *interfaceInput)
bool IsStarted(void) const
mtsComponent(const mtsComponent &other)
std::vector< std::string > GetNamesOfInterfacesProvided(void) const
mtsInterfaceProvided * InterfaceProvidedToManager
Definition mtsComponent.h:168
virtual void Suspend(void)
void InterfaceInternalCommands_RemoveObserverList(const mtsEventHandlerList &argin, mtsEventHandlerList &argout)
size_t GetNumberOfInterfacesProvided(void) const
virtual void Create(void)
bool IsTerminated(void) const
void AddTag(const std::string &tag)
cmnLogger::StreamBufType * LoDMultiplexerStreambuf
Definition mtsComponent.h:489
mtsInterfaceRequired * GetInterfaceRequired(const std::string &interfaceRequiredName)
void KillSeparateLogFile(void)
std::vector< std::string > GetNamesOfInterfacesOutput(void) const
virtual void Cleanup(void)
Definition mtsComponent.h:301
virtual mtsInterfaceRequired * AddInterfaceRequiredWithoutSystemEventHandlers(const std::string &interfaceRequiredName, mtsRequiredType isRequired=MTS_REQUIRED)
virtual bool WaitForState(mtsComponentState desiredState, double timeout)
mtsComponent ThisType
Definition mtsComponent.h:216
bool SetReplayData(const std::string &stateTableName, const std::string &fileName)
size_t GetNumberOfInterfacesInput(void) const
size_t ProcessQueuedEvents(void)
mtsInterfaceRequired * AddInterfaceRequiredUsingMailbox(const std::string &interfaceRequiredName, mtsMailBox *mailBox, mtsRequiredType required)
void GetState(mtsComponentState &state) const
cmnNamedMap< mtsInterfaceRequired > InterfacesRequiredMapType
Definition mtsComponent.h:509
bool InterfaceExists(const std::string &interfaceName, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_VERBOSE) const
virtual void Startup(void)
Definition mtsComponent.h:296
cmnLogger::StreamBufType * GetLogMultiplexer(void) const override
virtual const mtsManagerComponentServices * GetManagerComponentServices(void) const
void UseSeparateLogFileDefault(bool forwardToLogger=true)
mtsFunctionWrite EventGeneratorChangeState
Definition mtsComponent.h:546
void InterfaceInternalCommands_RemoveEndUserInterface(const mtsEndUserInterfaceArg &argin, mtsEndUserInterfaceArg &argout)
StateTableMapType StateTables
Definition mtsComponent.h:518
virtual mtsInterfaceProvided * AddInterfaceProvidedWithoutSystemEvents(const std::string &interfaceProvidedName, mtsInterfaceQueueingPolicy queueingPolicy=MTS_COMPONENT_POLICY)
mtsInterfaceProvided * AddInterfaceProvided(const std::string &interfaceProvidedName, mtsInterfaceQueueingPolicy queueingPolicy=MTS_COMPONENT_POLICY)
bool IsEndTask(void) const
mtsComponent(const std::string &deviceName)
mtsComponentState State
Definition mtsComponent.h:162
bool RemoveInterfaceRequired(const std::string &interfaceRequiredName)
std::vector< std::string > GetNamesOfInterfacesProvidedOrOutput(void) const
bool CISST_DEPRECATED Running(void) const
Definition mtsComponent.h:459
std::vector< std::string > GetNamesOfInterfacesRequiredOrInput(void) const
virtual void Configure(const std::string &filename="")
virtual mtsInterfaceOutput * AddInterfaceOutput(const std::string &interfaceOutputName)
void InterfaceInternalCommands_AddObserverList(const mtsEventHandlerList &argin, mtsEventHandlerList &argout)
void SetName(const std::string &componentName)
cmnNamedMap< mtsInterfaceInput > InterfacesInputMapType
Definition mtsComponent.h:511
void UseSeparateLogFileDefaultWithDate(bool forwardToLogger=true)
mtsManagerComponentServices * ManagerComponentServices
Definition mtsComponent.h:535
InterfacesProvidedMapType InterfacesProvided
Definition mtsComponent.h:500
const mtsComponentState & GetState(void) const
bool SetReplayTime(const double time)
mtsInterfaceProvided * GetInterfaceProvided(const std::string &interfaceProvidedName) const
bool AddInterfaceInternal(const bool useMangerComponentServices=false)
Add internal interfaces.
mtsInterfaceRequired * AddInterfaceRequired(const std::string &interfaceRequiredName, mtsRequiredType isRequired=MTS_REQUIRED)
bool InterfaceRequiredOrInputExists(const std::string &interfaceName, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_VERBOSE) const
cmnNamedMap< mtsInterfaceOutput > InterfacesOutputMapType
Definition mtsComponent.h:501
size_t GetNumberOfInterfacesRequired(void) const
bool AreAllInterfacesRequiredConnected(const bool log=false)
cmnNamedMap< mtsStateTable > StateTableMapType
Definition mtsComponent.h:517
bool IsRunning(void) const
Definition mtsComponentState.h:34
Definition mtsComponent.h:598
virtual ~mtsComponentWithManagement()
Definition mtsComponent.h:607
mtsComponentWithManagement(const std::string &deviceName)
Definition mtsComponent.h:603
Definition mtsParameterTypes.h:1076
Definition mtsParameterTypesOld.h:41
Definition mtsFunctionWrite.h:37
virtual void SerializeRaw(std::ostream &outputStream) const
mtsGenericObject(void)
Definition mtsGenericObject.h:77
virtual bool FromStreamRaw(std::istream &inputStream, const char delimiter=' ')
virtual void ToStreamRaw(std::ostream &outputStream, const char delimiter=' ', bool headerOnly=false, const std::string &headerPrefix="") const
virtual void DeSerializeRaw(std::istream &inputStream)
Definition mtsInterfaceOutput.h:40
Definition mtsInterfaceProvided.h:98
Definition mtsInterfaceRequired.h:83
Definition mtsMailBox.h:36
Definition mtsManagerComponentServices.h:52
Definition mtsStateTable.h:67
Class registration macros.
const int CMN_DYNAMIC_CREATION_ONEARG
Definition cmnClassRegisterMacros.h:330
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:328
void cmnDeSerializeRaw(std::istream &inputStream, _elementType &data) CISST_THROW(std
Definition cmnDeSerializer.h:82
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Defines cmnGenericObject.
short cmnLogLevel
Definition cmnLogLoD.h:55
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
#define CMN_LOG_LEVEL_INIT_VERBOSE
Definition cmnLogLoD.h:60
Declaration of cmnNamedMap.
Portability across compilers and operating systems tools.
#define CISST_DEPRECATED
Definition cmnPortability.h:314
void cmnSerializeRaw(std::ostream &outputStream, const _elementType &data) CISST_THROW(std
Definition cmnSerializer.h:76
mtsComponentConstructorNameAndArg< int > mtsComponentConstructorNameAndInt
Definition mtsComponent.h:114
mtsComponentConstructorNameAndArg< unsigned long > mtsComponentConstructorNameAndULong
Definition mtsComponent.h:123
mtsComponentConstructorNameAndArg< long > mtsComponentConstructorNameAndLong
Definition mtsComponent.h:120
std::string mtsObjectName(const mtsComponent *object)
Definition mtsComponent.h:588
mtsComponentConstructorNameAndArg< std::string > mtsComponentConstructorNameAndString
Definition mtsComponent.h:129
mtsComponentConstructorNameAndArg< unsigned int > mtsComponentConstructorNameAndUInt
Definition mtsComponent.h:117
mtsComponentConstructorNameAndArg< double > mtsComponentConstructorNameAndDouble
Definition mtsComponent.h:126
Forward declarations and #define for cisstMultiTask.
mtsRequiredType
Definition mtsForwardDeclarations.h:51
@ MTS_REQUIRED
Definition mtsForwardDeclarations.h:51
mtsInterfaceQueueingPolicy
Definition mtsForwardDeclarations.h:38
@ MTS_COMPONENT_POLICY
Definition mtsForwardDeclarations.h:38
Defines the command interfaces.
Defines the command interfaces.
Defines a function object to use a void command (mtsCommandVoid).
Defines a function object to use a void command (mtsCommandVoidReturn).
Defines the command interfaces.
Defines a function object to use a void command (mtsCommandWriteReturn).
Declaration of mtsInterfaceRequired.
Defines a command with one argument sent to multiple interfaces.
Defines a command with one argument sent to multiple interfaces.