cisst-saw
Loading...
Searching...
No Matches
mtsCollectorFactory.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: 2014-03-03
7
8 (C) Copyright 2014-2023 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
20#ifndef _mtsCollectorFactory_h
21#define _mtsCollectorFactory_h
22
24
25#include <string>
26#include <list>
27#include <map>
28
30class mtsCollectorBaseData;
31class mtsCollectorStateData;
32class mtsCollectorEventData;
33
34// Always include last
36
43{
45
47
48 public:
49 mtsCollectorFactory(const std::string & componentName);
51
52 void Configure(const std::string & configuration) override;
53 void Run(void) override;
54 void Cleanup(void) override;
55
64 void AddSignal(const std::string & component,
65 const std::string & table,
66 const std::string & signal);
67
69 void SetSampling(const std::string & component,
70 const std::string & table,
71 const int sampling);
72
77 void AddEventWrite(const std::string & component_name,
78 const std::string & interface_name,
79 const std::string & event_name);
80 void AddEventVoid(const std::string & component_name,
81 const std::string & interface_name,
82 const std::string & event_name);
84
88 void AddAllEvents(const std::string & component_name,
89 const std::string & interface_name);
90
94 void AddAllEvents(const std::string & component_name);
95
99 bool Connect(void) override;
100
102 void GetCollectorsNames(std::list<std::string> & collectors) const;
103
104 protected:
105 typedef std::pair<std::string, std::string> CollectorId; // component, state table
106 std::map<CollectorId, mtsCollectorStateData *> mStateCollectors;
107 void AddStateCollector(const std::string & component,
108 const std::string & table);
109
110 std::map<std::string, mtsCollectorEventData *> mEventCollectors;
111 mtsCollectorEvent * GetEventCollector(const std::string & component);
112
113 std::list<mtsCollectorBaseData *> mAllCollectors;
114
115 /* methods to mimic any collector */
116 void StartCollection(const double & delayInSeconds) override;
117 void StopCollection(const double & delayInSeconds) override;
118 void SetWorkingDirectory(const std::string & directory) override;
119 void SetOutputToDefault(void) override;
120 void CollectionStartedEventHandler(const bool & started);
121 void ProgressEventHandler(const size_t & counter);
122};
123
125
126#endif // _mtsCollectorFactory_h
mtsCollectorBase(const std::string &collectorName, const CollectorFileFormat fileFormat)
Definition mtsCollectorEvent.h:41
Definition mtsCollectorFactory.h:43
std::list< mtsCollectorBaseData * > mAllCollectors
Definition mtsCollectorFactory.h:113
std::map< std::string, mtsCollectorEventData * > mEventCollectors
Definition mtsCollectorFactory.h:110
void AddAllEvents(const std::string &component_name)
void AddEventWrite(const std::string &component_name, const std::string &interface_name, const std::string &event_name)
void AddEventVoid(const std::string &component_name, const std::string &interface_name, const std::string &event_name)
void SetWorkingDirectory(const std::string &directory) override
void Run(void) override
void Configure(const std::string &configuration) override
mtsCollectorFactory(const std::string &componentName)
void StopCollection(const double &delayInSeconds) override
void Cleanup(void) override
void AddStateCollector(const std::string &component, const std::string &table)
void SetSampling(const std::string &component, const std::string &table, const int sampling)
friend class mtsCollectorBaseData
Definition mtsCollectorFactory.h:46
void SetOutputToDefault(void) override
std::map< CollectorId, mtsCollectorStateData * > mStateCollectors
Definition mtsCollectorFactory.h:106
void CollectionStartedEventHandler(const bool &started)
void GetCollectorsNames(std::list< std::string > &collectors) const
mtsCollectorEvent * GetEventCollector(const std::string &component)
void ProgressEventHandler(const size_t &counter)
std::pair< std::string, std::string > CollectorId
Definition mtsCollectorFactory.h:105
bool Connect(void) override
void AddSignal(const std::string &component, const std::string &table, const std::string &signal)
~mtsCollectorFactory()
Definition mtsCollectorFactory.h:50
void AddAllEvents(const std::string &component_name, const std::string &interface_name)
void StartCollection(const double &delayInSeconds) override
#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.
Rules of exporting.