source: branches/FACT++_lidctrl_usb/src/ServiceDim.h

Last change on this file was 13832, checked in by tbretz, 12 years ago
New class representing a dim service as event in the main event loop.
File size: 1.4 KB
Line 
1// **************************************************************************
2/** @class EventDim
3
4@brief Implementation of an EventImp as a DimStampedInfo
5
6This is the implementation of an event which can be posted to a state
7machine via the DIM network.
8
9@todo
10- Add reference to DIM docu
11- improve docu
12
13*/
14// **************************************************************************
15#ifndef FACT_ServiceDim
16#define FACT_ServiceDim
17
18#include "EventImp.h"
19#include "dic.hxx"
20
21class ServiceDim : public EventImp, public DimStampedInfo
22{
23public:
24 ServiceDim(const std::string &name, DimInfoHandler *handler)
25 : EventImp(), DimStampedInfo(name.c_str(), (void*)NULL, 0, handler)
26 {
27 }
28 std::string GetName() const { return const_cast<ServiceDim*>(this)->getName(); }
29 std::string GetFormat() const { return const_cast<ServiceDim*>(this)->getFormat(); }
30
31 const void *GetData() const { return const_cast<ServiceDim*>(this)->getData(); }
32 size_t GetSize() const { return const_cast<ServiceDim*>(this)->getSize(); }
33
34 Time GetTime() const
35 {
36 // Must be in exactly this order!
37 const int tsec = const_cast<ServiceDim*>(this)->getTimestamp();
38 const int tms = const_cast<ServiceDim*>(this)->getTimestampMillisecs();
39
40 return Time(tsec, tms*1000);
41 }
42
43 int GetQoS() const { return const_cast<ServiceDim*>(this)->getQuality(); }
44};
45
46#endif
Note: See TracBrowser for help on using the repository browser.