Rev 1310 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1310 | Rev 1403 | ||
|---|---|---|---|
| Line 6... | Line 6... | ||
| 6 | */ |
6 | */ |
| 7 | 7 | ||
| 8 | #include "Broker.h" |
8 | #include "Broker.h" |
| 9 | 9 | ||
| 10 | namespace atom { |
10 | namespace atom { |
| 11 | namespace broker { |
- | |
| 12 | 11 | ||
| 13 | Broker:: |
12 | Broker::Pointer Broker::instance_(new Broker()); |
| 14 | - | ||
| 15 | void Broker::connect(const OnMessageSignal::slot_type & slot) |
- | |
| 16 | { |
- | |
| 17 | LOG.info("New subscriber connected."); |
- | |
| 18 | this->onNewMessage.connect(slot); |
- | |
| 19 | } |
- | |
| 20 | - | ||
| 21 | void Broker::put(Message::pointer message) |
- | |
| 22 | { |
- | |
| 23 | LOG.info("New message received."); |
- | |
| 24 | this->onNewMessage(message); |
- | |
| 25 | } |
- | |
| 26 | - | ||
| 27 | Broker::pointer Broker::getInstance() |
- | |
| 28 | { |
- | |
| 29 | return Broker::Instance; |
- | |
| 30 | } |
- | |
| 31 | 13 | ||
| 32 | Broker::Broker() |
14 | Broker::Broker() |
| 33 | { |
15 | { |
| 34 | LOG.setName("Broker"); |
16 | LOG.setName("Broker"); |
| 35 | } |
17 | } |
| 36 | 18 | ||
| 37 | Broker::~Broker() |
19 | Broker::~Broker() |
| 38 | { |
20 | { |
| 39 | } |
21 | } |
| 40 | 22 | ||
| - | 23 | void Broker::Connect(const Signal_OnMessage::slot_type &slot) |
|
| - | 24 | { |
|
| - | 25 | LOG.info("New subscriber connected."); |
|
| - | 26 | this->OnMessage.connect(slot); |
|
| - | 27 | } |
|
| - | 28 | ||
| - | 29 | void Broker::Put(Message::Pointer message) |
|
| - | 30 | { |
|
| - | 31 | LOG.info("New message received."); |
|
| - | 32 | this->OnMessage(message); |
|
| 41 | } |
33 | } |
| - | 34 | ||
| - | 35 | Broker::Pointer Broker::GetInstance() |
|
| - | 36 | { |
|
| - | 37 | return Broker::instance_; |
|
| 42 | } |
38 | } |
| - | 39 | ||
| - | 40 | } // namespace atom |
|