UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ipcmsg_man.hpp
1 /* ipcmsg_man.hpp */
2 /* $Id$ */
3 #ifndef __ipcmsg_man_hpp
4 #define __ipcmsg_man_hpp
5 
6 #include <vector>
7 #include <unistd.h>
8 
9 #ifdef GE_BUILD
10 #include <types.hpp>
11 #else
12 #include <dcf/types.hpp>
13 #endif
14 
15 namespace dcf
16 {
18  class IPCMsgMan
19  {
20  public:
21 
23  struct Message
24  {
26  pid_t pid;
27  int unit_id;
30  bool operator==(const Message &msg) const;
31  };
32 
34  typedef std::vector<dcf::IPCMsgMan::Message> Messages;
35 
37  IPCMsgMan();
38 
40  virtual ~IPCMsgMan();
41 
44  dcf::error_t getMessagesNum(size_t &recs_num) const;
45 
48 
51  dcf::error_t addMessage(const IPCMsgMan::Message &rec_data) const;
52 
56  dcf::error_t rmMessage(const IPCMsgMan::Message &rec_data, size_t &del_recs_num, bool rm_all=true) const;
57 
60  dcf::error_t rmQueue() const;
61 
64  dcf::error_t lock() const;
65 
67  dcf::error_t unlock() const;
68 
69  protected:
70 
72  struct IPCMessage
73  {
74  long mtype;
76  };
77 
79  int get_queue() const;
80 
82  int get_or_create_queue() const;
83 
84  int rm_queue() const;
85 
86  int get_sem() const;
87 
88  int get_or_create_sem() const;
89 
90  int rm_sem() const;
91 
92  private:
93 
95  static int m_mask;
96 
98  static key_t m_key;
99 
100  static key_t m_sem_key;
101  };
102 }
103 
104 #endif /* ipcmsg_man.hpp */
error_t
Definition: types.hpp:11
dcf::error_t lock() const
mantype_t
Definition: types.hpp:24
int get_or_create_queue() const
std::vector< dcf::IPCMsgMan::Message > Messages
Definition: ipcmsg_man.hpp:34
bool operator==(const Message &msg) const
long mtype
Definition: ipcmsg_man.hpp:74
int get_queue() const
dcf::error_t addMessage(const IPCMsgMan::Message &rec_data) const
dcf::error_t rmMessage(const IPCMsgMan::Message &rec_data, size_t &del_recs_num, bool rm_all=true) const
dcf::error_t rmQueue() const
Definition: ipcmsg_man.hpp:23
int unit_id
Definition: ipcmsg_man.hpp:27
IPCMsgMan::Message data
Definition: ipcmsg_man.hpp:75
dcf::error_t getMessagesNum(size_t &recs_num) const
Definition: ipcmsg_man.hpp:18
Definition: ipcmsg_man.hpp:72
dcf::mantype_t type
Definition: ipcmsg_man.hpp:25
pid_t pid
Definition: ipcmsg_man.hpp:26
dcf::error_t getMessages(IPCMsgMan::Messages &recs) const
dcf::error_t unlock() const
virtual ~IPCMsgMan()