fix8  version 1.4.0
Open Source C++ FIX Framework
messagebus.hpp
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------
2 /*
3 
4 Fix8 is released under the GNU LESSER GENERAL PUBLIC LICENSE Version 3.
5 
6 Fix8 Open Source FIX Engine.
7 Copyright (C) 2010-16 David L. Dight <fix@fix8.org>
8 
9 Fix8 is free software: you can redistribute it and / or modify it under the terms of the
10 GNU Lesser General Public License as published by the Free Software Foundation, either
11 version 3 of the License, or (at your option) any later version.
12 
13 Fix8 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
14 even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16 You should have received a copy of the GNU Lesser General Public License along with Fix8.
17 If not, see <http://www.gnu.org/licenses/>.
18 
19 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO
20 THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
21 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY
22 KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
24 THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
25 YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
26 
27 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT
28 HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED
29 ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
30 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
31 NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
32 THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
33 HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
34 
35 */
36 //-------------------------------------------------------------------------------------------------
37 #ifndef FIX8_MESSAGEBUS_HPP_
38 #define FIX8_MESSAGEBUS_HPP_
39 
40 //-------------------------------------------------------------------------------------------------
41 namespace FIX8
42 {
43 
44 //-------------------------------------------------------------------------------------------------
45 namespace MBUS
46 {
47 
48 //-------------------------------------------------------------------------------------------------
51 {
52 public:
55 
57  virtual ~GenericMessage() {}
58 };
59 
60 //-------------------------------------------------------------------------------------------------
63 {
64 public:
67 
69  virtual ~MessageBusSubscriber() {}
70 
72  virtual bool receive_message(const GenericMessage *msg) { return false; }
73 };
74 
75 //-------------------------------------------------------------------------------------------------
78 {
79 public:
82 
84  virtual ~MessageBus() {}
85 
87  virtual bool start() { return true; }
88 
90  virtual bool stop() { return true; }
91 
93  virtual bool publish(const f8String& topic, const GenericMessage *msg) { return false; }
94 
96  virtual bool subscribe(MessageBusSubscriber *subscriber, const f8String& topic) { return false; }
97 
99  virtual MessageBusSubscriber *subscribe(const f8String& topic) { return nullptr; }
100 
102  virtual bool unsubscribe(MessageBusSubscriber *subscriber, const f8String& topic) { return false; }
103 };
104 
105 //-------------------------------------------------------------------------------------------------
106 
107 } // MBUS
108 } // FIX8
109 
110 #endif // FIX8_MESSAGEBUS_HPP_
virtual bool subscribe(MessageBusSubscriber *subscriber, const f8String &topic)
Definition: messagebus.hpp:96
virtual bool start()
Definition: messagebus.hpp:87
virtual bool publish(const f8String &topic, const GenericMessage *msg)
Definition: messagebus.hpp:93
virtual ~MessageBusSubscriber()
Dtor.
Definition: messagebus.hpp:69
virtual bool receive_message(const GenericMessage *msg)
Definition: messagebus.hpp:72
virtual bool unsubscribe(MessageBusSubscriber *subscriber, const f8String &topic)
Definition: messagebus.hpp:102
virtual ~MessageBus()
Dtor.
Definition: messagebus.hpp:84
virtual bool stop()
Definition: messagebus.hpp:90
Encapsulates a message bus context.
Definition: messagebus.hpp:77
Base class for our message.
Definition: messagebus.hpp:50
virtual ~GenericMessage()
Dtor.
Definition: messagebus.hpp:57
std::string f8String
Definition: f8types.hpp:47
Base class for our subscriber.
Definition: messagebus.hpp:62
virtual MessageBusSubscriber * subscribe(const f8String &topic)
Definition: messagebus.hpp:99