tasks_multiple_test.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Mon Jan 10 15:59:18 CET 2005 tasks_multiple_test.hpp
3 
4  tasks_multiple_test.hpp - description
5  -------------------
6  begin : Mon January 10 2005
7  copyright : (C) 2005 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.be
9 
10  ***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 
20 
21 #ifndef TASKS_MULTIPLE_TEST_HPP
22 #define TASKS_MULTIPLE_TEST_HPP
23 
25 #include <rtt-detail-fwd.hpp>
26 using namespace RTT::detail;
27 
28 using namespace RTT;
29 
30 
31 template<class T>
32 class DummyTask : public T
33 {
34  unsigned int inits;
35  unsigned int steps;
36  unsigned int fins;
37 
38  unsigned int starts;
39  unsigned int stops;
40  unsigned int okstarts;
41  unsigned int okstops;
42 public:
43  DummyTask(int prio, double period)
44  : T(prio, period),
45  inits(0), steps(0), fins(0),
46  starts(0), stops(0),
47  okstarts(0), okstops(0) {}
48 
49  bool start() {
50  ++starts;
51  if ( T::start() ) {
52  ++okstarts;
53  return true;
54  }
55  return false;
56  }
57  bool stop() {
58  ++stops;
59  if ( T::stop() ) {
60  ++okstops;
61  return true;
62  }
63  return false;
64  }
65  bool initialize() { ++inits; return true;}
66  void step() { ++steps; }
67  void finalize() { ++fins; }
68  unsigned int nrOfStarts() { return starts;}
69  unsigned int nrOfOKStarts() { return okstarts;}
70  unsigned int nrOfInits() { return inits;}
71  unsigned int nrOfSteps() { return steps;}
72  unsigned int nrOfFinals() { return fins;}
73  unsigned int nrOfStops() { return stops;}
74  unsigned int nrOfOKStops() { return okstops;}
75 };
76 
79 
84 
85 {
86 public:
88  ~ActivitiesMultipleTest(){tearDown();};
89 
90  void setUp();
91 
92  void testMultiple();
93 
94  void tearDown();
95 
96  std::vector<DummyNPTask*> np_tasks;
97 
98  typedef std::vector<DummyNPTask*>::iterator NPI;
99  typedef std::vector<DummyPTask*>::iterator PI;
100 
101  std::vector<DummyPTask*> p_tasks;
102 
103  unsigned int nr_of_p;
104  unsigned int nr_of_np;
105 
106  unsigned int runningP;
107  unsigned int runningNp;
108 
109  std::string errInitNP;
110  std::string errStepNP;
111  std::string errFinNP;
112  std::string errInitP;
113  std::string errStepP;
114  std::string errFinP;
115 };
116 
117 #endif
unsigned int nrOfSteps()
std::vector< DummyNPTask * >::iterator NPI
std::vector< DummyPTask * > p_tasks
std::vector< DummyPTask * >::iterator PI
unsigned int stops
unsigned int okstops
std::vector< DummyNPTask * > np_tasks
unsigned int nrOfOKStops()
DummyTask< PeriodicActivity > DummyNPTask
unsigned int nrOfInits()
unsigned int steps
DummyTask(int prio, double period)
unsigned int starts
unsigned int fins
unsigned int nrOfOKStarts()
unsigned int okstarts
unsigned int nrOfFinals()
DummyTask< PeriodicActivity > DummyPTask
unsigned int nrOfStarts()
unsigned int nrOfStops()
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
unsigned int inits


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:37