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 
30 
31 #include <IceUtil/Time.h>
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 getDefaultName() const override
48  {
49  return "PerfTest";
50  }
51 #ifdef REMOTE
52  virtual void onInitRemoteStateOfferer();
53 #else
54  void onInitStatechart() override;
55  void onConnectStatechart() override;
56  void onExitStatechart() override;
57 
58 #endif
59  };
60 
61  // Define Events before the first state they are used in
62  DEFINEEVENT(EvInit) // this macro declares a new event-class derived vom Event, to have a compiletime check for typos in events
63  DEFINEEVENT(EvNext)
64  DEFINEEVENT(EvTimeout)
65 
66  // forward declare all substates
67  struct StateRun;
68  struct Statechart_StatechartPerfomanceTest : StateTemplate<Statechart_StatechartPerfomanceTest>
69  {
70 
71  void defineState() override
72  {
73  setUseRunFunction(false);
74  }
75  void defineParameters() override;
76  void defineSubstates() override;
77  };
78 
79 
80  struct StateRun : public StateTemplate<StateRun>
81  {
82  public:
84  int counter;
85 
86  ConditionIdentifier condId;
87  void defineState() override
88  {
89  setLocalMinimumLoggingLevel(MessageTypeT::WARN);
90  setUseRunFunction(false);
91  }
92  void defineParameters() override;
93  void onEnter() override;
94  void onExit() override;
95  };
96 
97 
98 }
99 
armarx::StateRun
Definition: StatechartPerformanceTest.h:80
armarx::MessageTypeT::WARN
@ WARN
armarx::StateRun::onEnter
void onEnter() override
Definition: StatechartPerformanceTest.cpp:122
armarx::StateTemplate
Definition: State.h:39
armarx::StatechartPerformanceTest
Definition: StatechartPerformanceTest.h:37
armarx::StateRun::defineParameters
void defineParameters() override
Definition: StatechartPerformanceTest.cpp:113
armarx::StateRun::defineState
void defineState() override
Definition: StatechartPerformanceTest.h:87
armarx::Statechart_StatechartPerfomanceTest
Definition: StatechartPerformanceTest.h:68
Statechart.h
armarx::StatechartPerformanceTest::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: StatechartPerformanceTest.h:47
armarx::StateRun::lastCall
IceUtil::Time lastCall
Definition: StatechartPerformanceTest.h:83
armarx::RemoteStateOfferer
Class that holds states, which offer functionality for other states over Ice.
Definition: RemoteStateOfferer.h:182
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::StateRun::condId
ConditionIdentifier condId
Definition: StatechartPerformanceTest.h:86
armarx::StatechartContext
This class contains a statechart and provides the interfaces to distributed components.
Definition: StatechartContext.h:89
armarx::Statechart_StatechartPerfomanceTest::defineState
void defineState() override
Definition: StatechartPerformanceTest.h:71
armarx::Statechart_StatechartPerfomanceTest::defineParameters
void defineParameters() override
Definition: StatechartPerformanceTest.cpp:69
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
Component.h
armarx::StateRun::counter
int counter
Definition: StatechartPerformanceTest.h:84
armarx::StateRun::onExit
void onExit() override
Definition: StatechartPerformanceTest.cpp:160
armarx::Statechart_StatechartPerfomanceTest::defineSubstates
void defineSubstates() override
Definition: StatechartPerformanceTest.cpp:79
armarx::DEFINEEVENT
DEFINEEVENT(EvInit) struct StateRun
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
ImportExportComponent.h