cisst-saw
Loading...
Searching...
No Matches
mtsCollectorEvent.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 Author(s): Anton Deguet
6 Created on: 2010-02-12
7
8 (C) Copyright 2010-2025 Johns Hopkins University (JHU), All Rights Reserved.
9
10--- begin cisst license - do not edit ---
11
12This software is provided "as is" under an open source license, with
13no warranty. The complete license can be found in license.txt and
14http://www.cisst.org/cisst/license.txt.
15
16--- end cisst license ---
17*/
18
19#ifndef _mtsCollectorEvent_h
20#define _mtsCollectorEvent_h
21
26
27#include <string>
28
29// Always include last
31
41{
43
44 protected:
45
48 mtsComponent * CheckComponent(const std::string & componentName) const;
50 const std::string & interfaceName) const;
52
62
67 const mtsInterfaceProvided * interfacePointer);
68
72 public:
73 std::string ComponentName;
74 std::string InterfaceName;
75 std::string EventName;
76 size_t EventId;
78 CollectorEventVoid(const std::string & componentName, const std::string & interfaceName, const std::string & eventName,
79 size_t eventId, mtsCollectorEvent * collector);
80 void EventHandler(void);
81 void PrintHeader(std::ostream & outputStream, const CollectorFileFormat fileFormat);
82 };
83
85 void SaveEventVoid(const CollectorEventVoid * event);
86
90 public:
91 std::string ComponentName;
92 std::string InterfaceName;
93 std::string EventName;
96 size_t EventId;
98 CollectorEventWrite(const std::string & componentName, const std::string & interfaceName, const std::string & eventName,
99 size_t eventId, mtsCollectorEvent * collector);
100 void EventHandler(const mtsGenericObject & payload);
101 void PrintHeader(std::ostream & outputStream, const CollectorFileFormat fileFormat);
102 };
103
105 void SaveEventWrite(const CollectorEventWrite * event, const mtsGenericObject & payload);
106
109
112 std::vector<CollectorEventVoid *> EventsVoid;
113 std::vector<CollectorEventWrite *> EventsWrite;
115
118
122
126
130
133
134 public:
136 void Run(void) override;
137
138 void Startup(void) override;
139
141 void Initialize(void);
142
143 // documented in base class
144 virtual std::string GetDefaultOutputName(void) override;
145
147 mtsCollectorEvent(const std::string & collectorName,
149
151
154 bool AddObservedComponent(const std::string & componentName);
155
159 bool AddObservedComponent(const mtsComponent * componentPointer);
160
163 bool AddObservedInterface(const std::string & componentName,
164 const std::string & interfaceName);
165
166 protected:
170 bool AddObservedInterface(const mtsComponent * componentPointer,
171 const mtsInterfaceProvided * interfacePointer);
172
173 public:
177 bool AddObservedEventVoid(const std::string & componentName,
178 const std::string & interfaceName,
179 const std::string & eventName);
180 bool AddObservedEventWrite(const std::string & componentName,
181 const std::string & interfaceName,
182 const std::string & eventName);
184
185 protected:
189 bool AddObservedEventVoid(const mtsComponent * componentPointer,
190 const mtsInterfaceProvided * interfacePointer,
191 const std::string & eventName);
192 bool AddObservedEventWrite(const mtsComponent * componentPointer,
193 const mtsInterfaceProvided * interfacePointer,
194 const std::string & eventName);
196
198 void PrintHeader(const CollectorFileFormat & fileFormat);
199
200 public:
202 bool Connect(void) override;
203
208 void StartCollection(const double & delayInSeconds) override;
209 void StopCollection(const double & delayInSeconds) override;
211
212 protected:
213 void SetCollecting(bool collecting, double currentTime);
214};
215
217
218#endif // _mtsCollectorEvent_h
Definition cmnNamedMap.h:54
mtsCollectorBase(const std::string &collectorName, const CollectorFileFormat fileFormat)
CollectorFileFormat
Definition mtsCollectorBase.h:51
@ COLLECTOR_FILE_FORMAT_CSV
Definition mtsCollectorBase.h:54
Definition mtsCollectorEvent.h:71
mtsCollectorEvent * Collector
Definition mtsCollectorEvent.h:77
void PrintHeader(std::ostream &outputStream, const CollectorFileFormat fileFormat)
CollectorEventVoid(const std::string &componentName, const std::string &interfaceName, const std::string &eventName, size_t eventId, mtsCollectorEvent *collector)
std::string InterfaceName
Definition mtsCollectorEvent.h:74
size_t EventId
Definition mtsCollectorEvent.h:76
std::string EventName
Definition mtsCollectorEvent.h:75
std::string ComponentName
Definition mtsCollectorEvent.h:73
Definition mtsCollectorEvent.h:89
const mtsGenericObject * ArgumentPrototype
Definition mtsCollectorEvent.h:95
mtsInterfaceRequired * InterfaceRequired
Definition mtsCollectorEvent.h:94
std::string InterfaceName
Definition mtsCollectorEvent.h:92
size_t EventId
Definition mtsCollectorEvent.h:96
std::string EventName
Definition mtsCollectorEvent.h:93
CollectorEventWrite(const std::string &componentName, const std::string &interfaceName, const std::string &eventName, size_t eventId, mtsCollectorEvent *collector)
void PrintHeader(std::ostream &outputStream, const CollectorFileFormat fileFormat)
void EventHandler(const mtsGenericObject &payload)
std::string ComponentName
Definition mtsCollectorEvent.h:91
mtsCollectorEvent * Collector
Definition mtsCollectorEvent.h:97
Definition mtsCollectorEvent.h:41
cmnNamedMap< InterfacesRequiredMap > ComponentsMap
Definition mtsCollectorEvent.h:59
const osaTimeServer * TimeServer
Definition mtsCollectorEvent.h:132
ComponentsMap ObservedComponents
Definition mtsCollectorEvent.h:60
size_t EventCounter
Definition mtsCollectorEvent.h:108
double ScheduledStartTime
Definition mtsCollectorEvent.h:121
bool AddObservedComponent(const std::string &componentName)
void StartCollection(const double &delayInSeconds) override
bool AddObservedInterface(const mtsComponent *componentPointer, const mtsInterfaceProvided *interfacePointer)
void StopCollection(const double &delayInSeconds) override
std::vector< CollectorEventVoid * > EventsVoid
Definition mtsCollectorEvent.h:112
bool AddObservedEventVoid(const std::string &componentName, const std::string &interfaceName, const std::string &eventName)
std::vector< CollectorEventWrite * > EventsWrite
Definition mtsCollectorEvent.h:113
bool AddObservedEventWrite(const mtsComponent *componentPointer, const mtsInterfaceProvided *interfacePointer, const std::string &eventName)
void PrintHeader(const CollectorFileFormat &fileFormat)
bool AddObservedEventWrite(const std::string &componentName, const std::string &interfaceName, const std::string &eventName)
void Startup(void) override
void Initialize(void)
bool AddObservedInterface(const std::string &componentName, const std::string &interfaceName)
mtsCollectorEvent(const std::string &collectorName, const CollectorFileFormat fileFormat=mtsCollectorBase::COLLECTOR_FILE_FORMAT_CSV)
bool AddObservedComponent(const mtsComponent *componentPointer)
bool AddObservedEventVoid(const mtsComponent *componentPointer, const mtsInterfaceProvided *interfacePointer, const std::string &eventName)
bool Connect(void) override
void Run(void) override
cmnNamedMap< mtsInterfaceRequired > InterfacesRequiredMap
Definition mtsCollectorEvent.h:58
mtsInterfaceRequired * GetInterfaceRequiredFor(const mtsComponent *componentPointer, const mtsInterfaceProvided *interfacePointer)
mtsInterfaceProvided * CheckInterface(const mtsComponent *componentPointer, const std::string &interfaceName) const
void SaveEventVoid(const CollectorEventVoid *event)
void SetCollecting(bool collecting, double currentTime)
double ScheduledStopTime
Definition mtsCollectorEvent.h:125
void SaveEventWrite(const CollectorEventWrite *event, const mtsGenericObject &payload)
bool Collecting
Definition mtsCollectorEvent.h:117
virtual std::string GetDefaultOutputName(void) override
bool CheckCollectingStatus(void)
mtsComponent * CheckComponent(const std::string &componentName) const
Definition mtsComponent.h:150
Base class for data object in cisstMultiTask.
Definition mtsGenericObject.h:52
Definition mtsInterfaceProvided.h:98
Definition mtsInterfaceRequired.h:83
Class for relative time.
Definition osaTimeServer.h:74
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
const int CMN_NO_DYNAMIC_CREATION
Definition cmnClassRegisterMacros.h:325
#define CISST_EXPORT
Definition cmnExportMacros.h:50
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
A data collection tool.
Defines a command with no argument.
Rules of exporting.
Defines the state data table.
Defines a periodic task.