cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsComponentDispatcher.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): Peter Kazanzides
7  Created on: 2011-09-19
8 
9  (C) Copyright 2011 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 
20 
27 #ifndef _mtsComponentDispatcher_h
28 #define _mtsComponentDispatcher_h
29 
30 #error mtsComponentDispatcher is obsolete: use component ExecOut/ExecIn instead
31 
35 
36 // Always include last
38 
39 
40 template <class BaseClass, class ConstructorArgType>
41 class CISST_EXPORT mtsComponentDispatcherBase : public BaseClass
42 {
44 
45  mtsFunctionVoid StartupEvent;
46  mtsFunctionVoid RunPriorityEvent;
47  mtsFunctionVoid RunEvent;
48  mtsFunctionVoid CleanupEvent;
49 
50 public:
51  mtsComponentDispatcherBase(const ConstructorArgType &arg) : BaseClass(arg)
52  {
53  mtsInterfaceProvided *prov = this->AddInterfaceProvided("Dispatch");
54  if (prov) {
55  prov->AddEventVoid(StartupEvent, "StartupEvent");
56  prov->AddEventVoid(RunEvent, "RunEvent");
57  prov->AddEventVoid(RunPriorityEvent, "RunPriorityEvent");
58  prov->AddEventVoid(CleanupEvent, "CleanupEvent");
59  }
60 
61  }
62 
64 
65  void Configure(const std::string &) {}
66 
67  void Startup(void)
68  {
69  StartupEvent();
70  }
71 
72  void Run(void)
73  {
74  RunPriorityEvent();
75  this->ProcessQueuedCommands();
76  RunEvent();
77  }
78 
79  void Cleanup(void)
80  {
81  CleanupEvent();
82  }
83 
84 };
85 
88 
90 
93 
95 
98 
100 
101 #endif // _mtsComponentDispatcher_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
void Run(void)
Definition: mtsComponentDispatcher.h:72
Definition: mtsFunctionVoid.h:36
const int CMN_DYNAMIC_CREATION_ONEARG
Definition: cmnClassRegisterMacros.h:333
Defines a continuously executing task.
mtsComponentDispatcherBase(const ConstructorArgType &arg)
Definition: mtsComponentDispatcher.h:51
CMN_DECLARE_SERVICES_INSTANTIATION(mtsComponentDispatcherPeriodic)
~mtsComponentDispatcherBase()
Definition: mtsComponentDispatcher.h:63
mtsComponentDispatcherBase< mtsTaskMain, std::string > mtsComponentDispatcherMain
Definition: mtsComponentDispatcher.h:97
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
void Cleanup(void)
Definition: mtsComponentDispatcher.h:79
Defines a periodic task.
Definition: mtsInterfaceProvided.h:96
mtsCommandVoid * AddEventVoid(const std::string &eventName)
mtsComponentDispatcherBase< mtsTaskContinuous, mtsTaskContinuousConstructorArg > mtsComponentDispatcherContinuous
Definition: mtsComponentDispatcher.h:92
void Configure(const std::string &)
Definition: mtsComponentDispatcher.h:65
Declaration of mtsInterfaceProvided.
void Startup(void)
Definition: mtsComponentDispatcher.h:67
Rules of exporting.
mtsComponentDispatcherBase< mtsTaskPeriodic, mtsTaskPeriodicConstructorArg > mtsComponentDispatcherPeriodic
Definition: mtsComponentDispatcher.h:87
Definition: mtsComponentDispatcher.h:41
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76