cisst-saw
Loading...
Searching...
No Matches
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
13This software is provided "as is" under an open source license, with
14no warranty. The complete license can be found in license.txt and
15http://www.cisst.org/cisst/license.txt.
16
17--- end cisst license ---
18*/
19
20
26
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
40template <class BaseClass, class ConstructorArgType>
42{
44
45 mtsFunctionVoid StartupEvent;
46 mtsFunctionVoid RunPriorityEvent;
47 mtsFunctionVoid RunEvent;
48 mtsFunctionVoid CleanupEvent;
49
50public:
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();
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
Definition mtsComponentDispatcher.h:42
void Run(void)
Definition mtsComponentDispatcher.h:72
void Configure(const std::string &)
Definition mtsComponentDispatcher.h:65
void Startup(void)
Definition mtsComponentDispatcher.h:67
~mtsComponentDispatcherBase()
Definition mtsComponentDispatcher.h:63
mtsComponentDispatcherBase(const ConstructorArgType &arg)
Definition mtsComponentDispatcher.h:51
void Cleanup(void)
Definition mtsComponentDispatcher.h:79
size_t ProcessQueuedCommands(void)
Definition mtsComponent.h:525
mtsInterfaceProvided * AddInterfaceProvided(const std::string &interfaceProvidedName, mtsInterfaceQueueingPolicy queueingPolicy=MTS_COMPONENT_POLICY)
Definition mtsFunctionVoid.h:36
Definition mtsInterfaceProvided.h:98
mtsCommandVoid * AddEventVoid(const std::string &eventName)
const int CMN_DYNAMIC_CREATION_ONEARG
Definition cmnClassRegisterMacros.h:330
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition cmnClassRegisterMacros.h:199
#define CISST_EXPORT
Definition cmnExportMacros.h:50
#define CMN_LOG_ALLOW_DEFAULT
Definition cmnLogLoD.h:76
mtsComponentDispatcherBase< mtsTaskPeriodic, mtsTaskPeriodicConstructorArg > mtsComponentDispatcherPeriodic
Definition mtsComponentDispatcher.h:87
mtsComponentDispatcherBase< mtsTaskContinuous, mtsTaskContinuousConstructorArg > mtsComponentDispatcherContinuous
Definition mtsComponentDispatcher.h:92
mtsComponentDispatcherBase< mtsTaskMain, std::string > mtsComponentDispatcherMain
Definition mtsComponentDispatcher.h:97
Rules of exporting.
Declaration of mtsInterfaceProvided.
Defines a continuously executing task.
Defines a periodic task.