cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
6  Author(s): Anton Deguet
7  Created on: 2014-03-03
8 
9  (C) Copyright 2014 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 
22 #ifndef _mtsCollectorFactory_h
23 #define _mtsCollectorFactory_h
24 
26 
27 #include <string>
28 #include <list>
29 #include <map>
30 
31 // Always include last
33 
40 {
42  public:
43  mtsCollectorFactory(const std::string & componentName);
44  inline ~mtsCollectorFactory() {};
45 
46  void Configure(const std::string & configuration);
47  void Run(void);
48  void Cleanup(void);
49 
58  void AddSignal(const std::string & component,
59  const std::string & table,
60  const std::string & signal);
61 
63  void SetSampling(const std::string & component,
64  const std::string & table,
65  const int sampling);
66 
70  void Connect(void) const;
71 
73  void GetCollectorsNames(std::list<std::string> & collectors) const;
74 
75  protected:
76  typedef std::pair<std::string, std::string> CollectorId; // component, state table
77  typedef std::list<std::string> Signals; // list of signals
78  typedef std::pair<std::string, Signals> CollectorData; // name of collector, signals
79  typedef std::pair<CollectorId, CollectorData > Collector; // element type for the map of collectors
80  typedef std::map<CollectorId, CollectorData > CollectorsType; // map of collectors
82 
83  void AddStateCollector(const std::string & component,
84  const std::string & table);
85 };
86 
88 
89 #endif // _mtsCollectorFactory_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Defines a task with a Run method trigger by signals (any queued command or event).
std::pair< CollectorId, CollectorData > Collector
Definition: mtsCollectorFactory.h:79
Definition: mtsCollectorFactory.h:39
~mtsCollectorFactory()
Definition: mtsCollectorFactory.h:44
CollectorsType mCollectors
Definition: mtsCollectorFactory.h:81
Definition: mtsTaskFromSignal.h:40
virtual void Configure(const std::string &CMN_UNUSED(filename)="")
Definition: mtsTask.h:218
std::pair< std::string, Signals > CollectorData
Definition: mtsCollectorFactory.h:78
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
std::map< CollectorId, CollectorData > CollectorsType
Definition: mtsCollectorFactory.h:80
virtual void Run(void)=0
std::pair< std::string, std::string > CollectorId
Definition: mtsCollectorFactory.h:76
Rules of exporting.
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
std::list< std::string > Signals
Definition: mtsCollectorFactory.h:77
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition: cmnClassRegisterMacros.h:202
virtual void Cleanup(void)
Definition: mtsComponent.h:267
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76