Belle II Software development
SharedMemory.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#ifndef _Belle2_SharedMemory_h
9#define _Belle2_SharedMemory_h
10
11#include <string>
12
13namespace Belle2 {
20
21 public:
22 static bool unlink(const std::string& path);
23
24 // constructors and destructor
25 public:
27 SharedMemory(const std::string& path, size_t size);
30
31 // member functions;
32 public:
33 bool open(const std::string& path, size_t size);
34 bool open();
35 void close();
36 bool unlink();
37 bool seekTo(size_t);
38 bool seekBy(size_t);
39 void* map(size_t, size_t);
40 void* map();
41 bool isOpened();
42 const std::string& getPath() const { return m_path; }
43 size_t size() const { return m_size; }
44 int getfd() const { return m_fd; }
45 bool truncate(size_t size);
46
47 // operators
48 public:
49 const SharedMemory& operator=(const SharedMemory&);
50
51 // data members;
52 private:
53 int m_fd;
54 std::string m_path;
55 size_t m_size;
56 void* m_addr;
57
58 };
59
61};
62
63#endif
Abstract base class for different kinds of events.