cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsManagerComponentServer.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): Min Yang Jung
7  Created on: 2010-08-29
8 
9  (C) Copyright 2010-2013 Johns Hopkins University (JHU), All Rights Reserved.
10 
11 --- begin cisst license - do not edit ---
12 
13 This software is provided "as is" under an open source license, with
14 no warranty. The complete license can be found in license.txt and
15 http://www.cisst.org/cisst/license.txt.
16 
17 --- end cisst license ---
18 */
19 
38 #ifndef _mtsManagerComponentServer_h
39 #define _mtsManagerComponentServer_h
40 
42 
43 class mtsManagerGlobal;
44 
46 {
47  CMN_DECLARE_SERVICES(CMN_NO_DYNAMIC_CREATION, CMN_LOG_ALLOW_DEFAULT);
48 
49  friend class mtsManagerLocal;
50 
51 protected:
55 
57  bool AddInterfaceGCM(void);
58 
60  void GetNamesOfProcesses(std::vector<std::string> & processList) const;
61 
66  typedef struct {
83 
86 
89 
91  void InterfaceGCMCommands_ComponentCreate(const mtsDescriptionComponent & componentDescription, bool & result);
93  void InterfaceGCMCommands_ComponentConnect(const mtsDescriptionConnection & connectionDescription /*, bool & result*/);
99  void InterfaceGCMCommands_GetNamesOfProcesses(std::vector<std::string> & names) const;
100  void InterfaceGCMCommands_GetNamesOfComponents(const std::string & processName,
101  std::vector<std::string> & names) const;
103  void InterfaceGCMCommands_GetListOfConnections(std::vector <mtsDescriptionConnection> & listOfConnections) const;
106  void InterfaceGCMCommands_LoadLibrary(const mtsDescriptionLoadLibrary & lib, bool & result) const;
108  void InterfaceGCMCommands_SetLogForwarding(const std::vector<std::string> & processNames, bool state); // internal
109  void InterfaceGCMCommands_EnableLogForwarding(const std::vector<std::string> & processNames);
110  void InterfaceGCMCommands_DisableLogForwarding(const std::vector<std::string> & processNames);
111  void InterfaceGCMCommands_GetLogForwardingStates(const stdStringVec & processNames, stdCharVec & states) const;
112  void InterfaceGCMCommands_GetAbsoluteTimeDiffs(const std::vector<std::string> & processNames,
113  std::vector<double> & processTimes) const;
114  void InterfaceGCMCommands_GetListOfComponentClasses(const std::string & processName,
115  std::vector<mtsDescriptionComponentClass> & listOfComponentClasses) const;
116 
123 
124  // Event handler of InterfaceGCM's required interface
125  void HandleChangeStateEvent(const mtsComponentStateChange &stateChange);
126 
130 
131 public:
132  void Startup(void);
133  void Run(void);
134  void Cleanup(void);
135 
139  bool AddNewClientProcess(const std::string & clientProcessName);
140 
142  void AddComponentEvent(const mtsDescriptionComponent &component);
143  void AddConnectionEvent(const mtsDescriptionConnection &connection);
144  void RemoveConnectionEvent(const mtsDescriptionConnection &connection);
145  // If connection between InterfaceGCM.required - InterfaceLCM.provided is
146  // disconnected, required interface instance of InterfaceGCM that corresponds
147  // to the connection should be removed.
148  bool DisconnectCleanup(const std::string & processName);
149 
150  // Calls LCM::DisconnectLocally()
151  void ComponentDisconnect(const std::string & processName, const mtsDescriptionConnection & arg);
152 };
153 
155 
156 #endif // _mtsManagerComponentServer_h
mtsFunctionWrite InterfaceGCMEvents_ChangeState
Definition: mtsManagerComponentServer.h:121
mtsFunctionWrite ComponentResume
Definition: mtsManagerComponentServer.h:73
void InterfaceGCMCommands_ComponentStop(const mtsComponentStatusControl &arg)
void InterfaceGCMCommands_ComponentConnect(const mtsDescriptionConnection &connectionDescription)
mtsManagerGlobal * GCM
Definition: mtsManagerComponentServer.h:54
mtsFunctionRead GetLogForwardingState
Definition: mtsManagerComponentServer.h:79
void InterfaceGCMCommands_ComponentCreate(const mtsDescriptionComponent &componentDescription, bool &result)
Definition: mtsFunctionRead.h:37
mtsFunctionQualifiedRead GetInterfaceRequiredDescription
Definition: mtsManagerComponentServer.h:76
Definition: mtsParameterTypes.h:100
mtsFunctionQualifiedRead GetInterfaceProvidedDescription
Definition: mtsManagerComponentServer.h:75
Definition: mtsParameterTypes.h:652
Definition: mtsFunctionQualifiedRead.h:37
void InterfaceGCMCommands_DisableLogForwarding(const std::vector< std::string > &processNames)
void InterfaceGCMCommands_GetListOfComponentClasses(const std::string &processName, std::vector< mtsDescriptionComponentClass > &listOfComponentClasses) const
void InterfaceGCMCommands_GetNamesOfComponents(const std::string &processName, std::vector< std::string > &names) const
std::vector< std::string > stdStringVec
Definition: mtsGenericObjectProxy.h:39
Definition: mtsInterfaceCommon.h:1046
mtsFunctionQualifiedRead LoadLibrary
Definition: mtsManagerComponentServer.h:77
Definition: mtsFunctionVoid.h:36
void HandleChangeStateEvent(const mtsComponentStateChange &stateChange)
cmnNamedMap< InterfaceGCMFunctionType > InterfaceGCMFunctionMapType
Definition: mtsManagerComponentServer.h:84
mtsFunctionWrite ComponentDisconnect
Definition: mtsManagerComponentServer.h:70
Definition: mtsParameterTypes.h:873
void InterfaceGCMCommands_GetInterfaceRequiredDescription(const mtsDescriptionInterface &intfc, mtsInterfaceRequiredDescription &description) const
Declaration of Base Class for Manager ComponentsIn the networked configuration, the communication bet...
void AddConnectionEvent(const mtsDescriptionConnection &connection)
Definition: mtsManagerLocal.h:89
void InterfaceGCMCommands_GetInterfaceProvidedDescription(const mtsDescriptionInterface &intfc, mtsInterfaceProvidedDescription &description) const
void InterfaceGCMCommands_ComponentResume(const mtsComponentStatusControl &arg)
void ComponentDisconnect(const std::string &processName, const mtsDescriptionConnection &arg)
mtsFunctionQualifiedRead ComponentGetState
Definition: mtsManagerComponentServer.h:74
mtsFunctionWrite InterfaceGCMEvents_AddComponent
Definition: mtsManagerComponentServer.h:118
Definition: mtsInterfaceCommon.h:928
Definition: mtsParameterTypes.h:533
Definition: mtsManagerComponentBase.h:99
void InterfaceGCMCommands_LoadLibrary(const mtsDescriptionLoadLibrary &lib, bool &result) const
void InterfaceGCMCommands_GetNamesOfInterfaces(const mtsDescriptionComponent &component, mtsDescriptionInterface &interfaces) const
void InterfaceGCMCommands_GetLogForwardingStates(const stdStringVec &processNames, stdCharVec &states) const
mtsFunctionWrite ComponentConfigure
Definition: mtsManagerComponentServer.h:68
mtsFunctionWrite ComponentStop
Definition: mtsManagerComponentServer.h:72
bool AddNewClientProcess(const std::string &clientProcessName)
Definition: mtsParameterTypes.h:322
void AddComponentEvent(const mtsDescriptionComponent &component)
mtsFunctionWrite InterfaceGCMEvents_RemoveConnection
Definition: mtsManagerComponentServer.h:120
mtsFunctionWrite EventPrintLog
Definition: mtsManagerComponentServer.h:88
mtsManagerComponentServer(mtsManagerGlobal *gcm)
void InterfaceGCMCommands_EnableLogForwarding(const std::vector< std::string > &processNames)
mtsFunctionRead GetAbsoluteTimeInSeconds
Definition: mtsManagerComponentServer.h:80
Definition: mtsComponentState.h:34
CMN_DECLARE_SERVICES_INSTANTIATION(mtsManagerComponentServer)
void GetNamesOfProcesses(std::vector< std::string > &processList) const
void InterfaceGCMCommands_ComponentStart(const mtsComponentStatusControl &arg)
mtsFunctionRead GetListOfComponentClasses
Definition: mtsManagerComponentServer.h:81
void InterfaceGCMCommands_GetListOfConnections(std::vector< mtsDescriptionConnection > &listOfConnections) const
void InterfaceGCMCommands_ComponentDisconnect(const mtsDescriptionConnection &arg)
mtsFunctionWrite ComponentStart
Definition: mtsManagerComponentServer.h:71
void InterfaceGCMCommands_GetAbsoluteTimeDiffs(const std::vector< std::string > &processNames, std::vector< double > &processTimes) const
Definition: mtsManagerComponentServer.h:45
bool DisconnectCleanup(const std::string &processName)
void InterfaceGCMCommands_ComponentConfigure(const mtsDescriptionComponent &arg)
void InterfaceGCMCommands_SetLogForwarding(const std::vector< std::string > &processNames, bool state)
std::vector< char > stdCharVec
Definition: mtsGenericObjectProxy.h:41
mtsFunctionWrite InterfaceGCMEvents_AddConnection
Definition: mtsManagerComponentServer.h:119
mtsFunctionVoid InterfaceGCMEvents_MCSReady
Definition: mtsManagerComponentServer.h:122
void InterfaceGCMCommands_PrintLog(const mtsLogMessage &log)
Definition: mtsParameterTypesOld.h:84
Definition: mtsFunctionWrite.h:37
InterfaceGCMFunctionMapType InterfaceGCMFunctionMap
Definition: mtsManagerComponentServer.h:85
Definition: mtsManagerGlobal.h:51
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
mtsFunctionWrite ComponentConnect
Definition: mtsManagerComponentServer.h:69
mtsFunctionWrite SetLogForwarding
Definition: mtsManagerComponentServer.h:78
mtsFunctionWriteReturn ComponentCreate
Definition: mtsManagerComponentServer.h:67
Definition: mtsParameterTypes.h:769
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
void RemoveConnectionEvent(const mtsDescriptionConnection &connection)
Definition: mtsFunctionWriteReturn.h:38
void InterfaceGCMCommands_ComponentGetState(const mtsDescriptionComponent &component, mtsComponentState &state) const
Definition: mtsManagerComponentServer.h:66
void InterfaceGCMCommands_GetNamesOfProcesses(std::vector< std::string > &names) const