1
/***********************************************
2
This file is part of the NRTB project (https://*launchpad.net/nrtb).
4
NRTB is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
NRTB is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with NRTB. If not, see <http://www.gnu.org/licenses/>.
17
**********************************************/
19
#ifndef ipc_channel_header
20
#define ipc_channel_header
23
#include <linear_queue.h>
25
#include <singleton.h>
33
typedef std::unique_ptr<abs_ipc_record> ipc_record_p;
35
typedef linear_queue<ipc_record_p> ipc_queue;
37
/** abs_ipc_record is the base for all ipc messages.
38
* This abstract includes a return_address (the
39
* ipc_queue the a return should be put to). but
40
* no other payload. It'll need to be overriden to
41
* provide whatever payload a given channel may
47
ipc_queue & return_to;
48
abs_ipc_record(ipc_queue & q);
51
/** ipc_channel_manager provides a place to stash ipc_queues
52
* so that their scope is not tied to the lifetime of any
53
* particular thread. Ideally, this should be used as s
56
class ipc_channel_manager
59
typedef std::map<std::string,ipc_queue> channel_List;
60
typedef channel_List::iterator iterator;
62
ipc_queue & get(std::string name);
67
channel_List channels;
70
/// And here is the singleton class to make ipc channels safe.
71
typedef singleton<ipc_channel_manager> global_ipc_channel_manager;
75
#endif // ipc_channel_header