source: pacpussensors/trunk/CanGateway/CanSubscription.h@ 2

Last change on this file since 2 was 2, checked in by DHERBOMEZ Gérald, 11 years ago

correction of minor bugs (include and link). Build on Windows OK.

File size: 1.1 KB
Line 
1
2#ifndef __CANSUBSCRIPTION_H__
3#define __CANSUBSCRIPTION_H__
4
5#include <QMultiHash>
6
7#include "CanGatewayConfig.h"
8#include "CanDecoderBase.h"
9
10
11template <class T> class QList;
12//template <class T, class R> class QMultiHash;
13
14namespace pacpus {
15
16class CANGATEWAY_API CanSubscription
17{
18public:
19 CanSubscription() { subscribers_.clear();}
20 virtual ~CanSubscription() {}
21
22 // return true if the subscription of the component to the specified can ID list succeeds, false else
23 // warning: it is possible that some <Component*,id> pairs have been registered and other not.
24 bool subscribe(const CanDecoderBase* who, const QList<int>& canId);
25
26 // TODO
27 bool unsubscribe(const CanDecoderBase* who, const QList<int>& canId);
28
29 // TODO
30 //QList<int> getSubscription(const ComponentBase* who) {};
31
32 bool dispatchCanFrame(const TimestampedCanFrame & message);
33
34private:
35 // list of subscribers, we provide them can data
36 // structure of the hash: key is the can ID and value is the pointer to the subscribed component
37 QMultiHash<int, CanDecoderBase *> subscribers_;
38
39};
40
41}
42
43#endif
Note: See TracBrowser for help on using the repository browser.