StatechartPerformanceTest.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarX::StatechartPerfomanceTest
19 * @author ( at kit dot edu)
20 * @date
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24 
25 #pragma once
26 
27 #include <IceUtil/Time.h>
28 
32 
33 //#define REMOTE
34 
35 namespace armarx
36 {
38 #ifdef REMOTE
39  virtual public RemoteStateOfferer
40 #else
41  virtual public StatechartContext
42 #endif
43 
44  {
45  public:
46  // inherited from Component
47  std::string
48  getDefaultName() const override
49  {
50  return "PerfTest";
51  }
52 #ifdef REMOTE
53  virtual void onInitRemoteStateOfferer();
54 #else
55  void onInitStatechart() override;
56  void onConnectStatechart() override;
57  void onExitStatechart() override;
58 
59 #endif
60  };
61 
62  // Define Events before the first state they are used in
64  EvInit) // this macro declares a new event-class derived vom Event, to have a compiletime check for typos in events
65  DEFINEEVENT(EvNext)
66  DEFINEEVENT(EvTimeout)
67 
68  // forward declare all substates
69  struct StateRun;
70 
71  struct Statechart_StatechartPerfomanceTest : StateTemplate<Statechart_StatechartPerfomanceTest>
72  {
73 
74  void
75  defineState() override
76  {
77  setUseRunFunction(false);
78  }
79 
80  void defineParameters() override;
81  void defineSubstates() override;
82  };
83 
84  struct StateRun : public StateTemplate<StateRun>
85  {
86  public:
88  int counter;
89 
90  ConditionIdentifier condId;
91 
92  void
93  defineState() override
94  {
95  setLocalMinimumLoggingLevel(MessageTypeT::WARN);
96  setUseRunFunction(false);
97  }
98 
99  void defineParameters() override;
100  void onEnter() override;
101  void onExit() override;
102  };
103 
104 
105 } // namespace armarx
armarx::StateRun
Definition: StatechartPerformanceTest.h:84
armarx::MessageTypeT::WARN
@ WARN
armarx::StateRun::onEnter
void onEnter() override
Definition: StatechartPerformanceTest.cpp:129
armarx::StateTemplate
Definition: State.h:38
armarx::StatechartPerformanceTest
Definition: StatechartPerformanceTest.h:37
armarx::StateRun::defineParameters
void defineParameters() override
Definition: StatechartPerformanceTest.cpp:119
armarx::StateRun::defineState
void defineState() override
Definition: StatechartPerformanceTest.h:93
armarx::Statechart_StatechartPerfomanceTest
Definition: StatechartPerformanceTest.h:71
Statechart.h
armarx::StatechartPerformanceTest::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: StatechartPerformanceTest.h:48
armarx::StateRun::lastCall
IceUtil::Time lastCall
Definition: StatechartPerformanceTest.h:87
armarx::RemoteStateOfferer
Class that holds states, which offer functionality for other states over Ice.
Definition: RemoteStateOfferer.h:203
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::StateRun::condId
ConditionIdentifier condId
Definition: StatechartPerformanceTest.h:90
armarx::StatechartContext
This class contains a statechart and provides the interfaces to distributed components.
Definition: StatechartContext.h:85
armarx::Statechart_StatechartPerfomanceTest::defineState
void defineState() override
Definition: StatechartPerformanceTest.h:75
armarx::Statechart_StatechartPerfomanceTest::defineParameters
void defineParameters() override
Definition: StatechartPerformanceTest.cpp:74
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
Component.h
armarx::StateRun::counter
int counter
Definition: StatechartPerformanceTest.h:88
armarx::StateRun::onExit
void onExit() override
Definition: StatechartPerformanceTest.cpp:172
armarx::Statechart_StatechartPerfomanceTest::defineSubstates
void defineSubstates() override
Definition: StatechartPerformanceTest.cpp:85
armarx::DEFINEEVENT
DEFINEEVENT(EvInit) struct StateRun
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
ImportExportComponent.h