CFEL - ASG Software Suite  2.5.0
CASS
test_input.h
Go to the documentation of this file.
1 // Copyright (C) 2012,2013 Lutz Foucar
2 
3 /**
4  * @file test_input.h file contains declaration of a input for testing purposes
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _TESTINPUT_H_
10 #define _TESTINPUT_H_
11 
12 #include <vector>
13 #include <tr1/memory>
14 
15 #include "input_base.h"
16 #include "cass.h"
17 #include "ringbuffer.h"
18 #include "cass_event.h"
19 
20 namespace cass
21 {
22 //forward declarations
23 class DataGenerator;
24 
25 /** Testing Input for cass
26  *
27  * It should be used when testing cass.
28  *
29  * It will fill the cassevents with data for several devices, such that
30  * PostProcessors can be tested. It uses the data generators to fill the cassevents.
31  *
32  * @cassttng TestInput/{key}\n
33  * See @ref DataGenerators for a list of all possible values.
34  *
35  * @author Lutz Foucar
36  */
37 class TestInput : public InputBase
38 {
39 public:
40  /** create instance of this
41  *
42  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
43  * @param ratemeter reference to the ratemeter to measure the rate of the input
44  * @param loadmeter reference to the ratemeter to measure the load of the input
45  * @param parent The parent QT Object of this class
46  */
47  static void instance(RingBuffer<CASSEvent>&,
48  Ratemeter &ratemeter,
49  Ratemeter &loadmeter,
50  QObject *parent=0);
51 
52  /** function with the main loop */
53  void run();
54 
55  /** load the parameters used for the input */
56  void load();
57 
58 private:
59  /** constructor
60  *
61  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
62  * @param ratemeter reference to the ratemeter to measure the rate of the input
63  * @param loadmeter reference to the ratemeter to measure the load of the input
64  * @param parent The parent QT Object of this class
65  */
67  Ratemeter &ratemeter,
68  Ratemeter &loadmeter,
69  QObject *parent=0);
70 
71  /** define a container for all data generators */
72  typedef std::vector<std::tr1::shared_ptr<DataGenerator> > generators_t;
73 
74  /** container for all used fillers */
75  generators_t _generators;
76 
77  /** a counter to create a fake event id */
78  size_t _counter;
79 };
80 
81 }//end namespace cass
82 
83 #endif
class calculating a rate in Hz.
Definition: ratemeter.h:28
file contains declaration of the CASSEvent
Input base class.
Definition: input_base.h:31
std::vector< std::tr1::shared_ptr< DataGenerator > > generators_t
define a container for all data generators
Definition: test_input.h:72
A Ringbuffer, handles communication between Input and Worker Threads.
Definition: ringbuffer.hpp:52
size_t _counter
a counter to create a fake event id
Definition: test_input.h:78
Testing Input for cass.
Definition: test_input.h:37
generators_t _generators
container for all used fillers
Definition: test_input.h:75
void load()
load the parameters used for the input
Definition: test_input.cpp:49
file contains global definitions for project cass
void run()
function with the main loop
Definition: test_input.cpp:67
TestInput(RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0)
constructor
Definition: test_input.cpp:40
static shared_pointer instance()
get the signelton instance
Definition: input_base.cpp:20
contains the base class for all input modules