RaftLib  0.3a
C++ Stream Processing Template Library
shm.hpp
1 
6 #ifndef _SHM_HPP_
7 #define _SHM_HPP_ 1
8 
9 #include <cstdlib>
10 #include <exception>
11 #include <string>
12 
13 class bad_shm_alloc : public std::exception
14 {
15 public:
16  bad_shm_alloc( const std::string message );
17 
18  virtual const char* what() const noexcept;
19 
20 private:
21  const std::string message;
22 };
23 
24 
25 class SHM{
26 public:
34  static void GenKey(char *buffer, size_t length);
35 
46  static void* Init( const char *key,
47  size_t nbytes,
48  bool zero = true,
49  void *ptr = nullptr );
50 
58  static void* Open( const char *key );
59 
69  static bool Close( const char *key,
70  void *ptr,
71  size_t nbytes,
72  bool zero = false ,
73  bool unlink = false );
74 
75 private:
76  SHM();
77  ~SHM();
78 };
79 
80 #endif /* END _SHM_HPP_ */
static void * Open(const char *key)
Definition: shm.cpp:140
static bool Close(const char *key, void *ptr, size_t nbytes, bool zero=false, bool unlink=false)
Definition: shm.cpp:198
Definition: shm.hpp:25
bad_shm_alloc(const std::string message)
Definition: shm.cpp:26
static void GenKey(char *buffer, size_t length)
Definition: shm.cpp:39
static void * Init(const char *key, size_t nbytes, bool zero=true, void *ptr=nullptr)
Definition: shm.cpp:63
Definition: shm.hpp:13