Belle II Software  release-05-02-19
SharedMemory.h
1 #ifndef _Belle2_SharedMemory_h
2 #define _Belle2_SharedMemory_h
3 
4 #include <string>
5 
6 namespace Belle2 {
12  class SharedMemory {
13 
14  public:
15  static bool unlink(const std::string& path);
16 
17  // constructors and destructor
18  public:
19  SharedMemory();
20  SharedMemory(const std::string& path, size_t size);
21  SharedMemory(const SharedMemory&);
22  ~SharedMemory();
23 
24  // member functions;
25  public:
26  bool open(const std::string& path, size_t size);
27  bool open();
28  void close();
29  bool unlink();
30  bool seekTo(size_t);
31  bool seekBy(size_t);
32  void* map(size_t, size_t);
33  void* map();
34  bool isOpened();
35  const std::string& getPath() const { return m_path; }
36  size_t size() const { return m_size; }
37  int getfd() const { return m_fd; }
38  bool truncate(size_t size);
39 
40  // operators
41  public:
42  const SharedMemory& operator=(const SharedMemory&);
43 
44  // data members;
45  private:
46  int m_fd;
47  std::string m_path;
48  size_t m_size;
49  void* m_addr;
50 
51  };
52 
54 };
55 
56 #endif
Belle2::SharedMemory
Definition: SharedMemory.h:12
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19