cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstMultiTask
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
26
27
#ifndef _mtsComponentDispatcher_h
28
#define _mtsComponentDispatcher_h
29
30
#error mtsComponentDispatcher is obsolete: use component ExecOut/ExecIn instead
31
32
#include <
cisstMultiTask/mtsTaskPeriodic.h
>
33
#include <
cisstMultiTask/mtsTaskContinuous.h
>
34
#include <
cisstMultiTask/mtsInterfaceProvided.h
>
35
36
// Always include last
37
#include <
cisstMultiTask/mtsExport.h
>
38
39
40
template
<
class
BaseClass,
class
ConstructorArgType>
41
class
CISST_EXPORT
mtsComponentDispatcherBase
:
public
BaseClass
42
{
43
CMN_DECLARE_SERVICES(
CMN_DYNAMIC_CREATION_ONEARG
,
CMN_LOG_ALLOW_DEFAULT
);
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
63
~mtsComponentDispatcherBase
() {}
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
86
typedef
mtsComponentDispatcherBase<mtsTaskPeriodic, mtsTaskPeriodicConstructorArg>
87
mtsComponentDispatcherPeriodic
;
88
89
CMN_DECLARE_SERVICES_INSTANTIATION
(
mtsComponentDispatcherPeriodic
);
90
91
typedef
mtsComponentDispatcherBase<mtsTaskContinuous, mtsTaskContinuousConstructorArg>
92
mtsComponentDispatcherContinuous
;
93
94
CMN_DECLARE_SERVICES_INSTANTIATION
(
mtsComponentDispatcherContinuous
);
95
96
typedef
mtsComponentDispatcherBase<mtsTaskMain, std::string>
97
mtsComponentDispatcherMain
;
98
99
CMN_DECLARE_SERVICES_INSTANTIATION
(
mtsComponentDispatcherMain
);
100
101
#endif
// _mtsComponentDispatcher_h
mtsComponentDispatcherBase
Definition
mtsComponentDispatcher.h:42
mtsComponentDispatcherBase::Run
void Run(void)
Definition
mtsComponentDispatcher.h:72
mtsComponentDispatcherBase::Configure
void Configure(const std::string &)
Definition
mtsComponentDispatcher.h:65
mtsComponentDispatcherBase::Startup
void Startup(void)
Definition
mtsComponentDispatcher.h:67
mtsComponentDispatcherBase::~mtsComponentDispatcherBase
~mtsComponentDispatcherBase()
Definition
mtsComponentDispatcher.h:63
mtsComponentDispatcherBase::mtsComponentDispatcherBase
mtsComponentDispatcherBase(const ConstructorArgType &arg)
Definition
mtsComponentDispatcher.h:51
mtsComponentDispatcherBase::Cleanup
void Cleanup(void)
Definition
mtsComponentDispatcher.h:79
mtsComponent::ProcessQueuedCommands
size_t ProcessQueuedCommands(void)
Definition
mtsComponent.h:525
mtsComponent::AddInterfaceProvided
mtsInterfaceProvided * AddInterfaceProvided(const std::string &interfaceProvidedName, mtsInterfaceQueueingPolicy queueingPolicy=MTS_COMPONENT_POLICY)
mtsFunctionVoid
Definition
mtsFunctionVoid.h:36
mtsInterfaceProvided
Definition
mtsInterfaceProvided.h:98
mtsInterfaceProvided::AddEventVoid
mtsCommandVoid * AddEventVoid(const std::string &eventName)
CMN_DYNAMIC_CREATION_ONEARG
const int CMN_DYNAMIC_CREATION_ONEARG
Definition
cmnClassRegisterMacros.h:330
CMN_DECLARE_SERVICES_INSTANTIATION
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition
cmnClassRegisterMacros.h:199
CISST_EXPORT
#define CISST_EXPORT
Definition
cmnExportMacros.h:50
CMN_LOG_ALLOW_DEFAULT
#define CMN_LOG_ALLOW_DEFAULT
Definition
cmnLogLoD.h:76
mtsComponentDispatcherPeriodic
mtsComponentDispatcherBase< mtsTaskPeriodic, mtsTaskPeriodicConstructorArg > mtsComponentDispatcherPeriodic
Definition
mtsComponentDispatcher.h:87
mtsComponentDispatcherContinuous
mtsComponentDispatcherBase< mtsTaskContinuous, mtsTaskContinuousConstructorArg > mtsComponentDispatcherContinuous
Definition
mtsComponentDispatcher.h:92
mtsComponentDispatcherMain
mtsComponentDispatcherBase< mtsTaskMain, std::string > mtsComponentDispatcherMain
Definition
mtsComponentDispatcher.h:97
mtsExport.h
Rules of exporting.
mtsInterfaceProvided.h
Declaration of mtsInterfaceProvided.
mtsTaskContinuous.h
Defines a continuously executing task.
mtsTaskPeriodic.h
Defines a periodic task.
Generated by
1.18.0