View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

shm_obj_ref.h
Go to the documentation of this file.
1#ifndef SHM_OBJ_REF_H
2#define SHM_OBJ_REF_H
3
4#include <string>
5#include "shmname.h"
6#include "archives_config.h"
7#ifndef NO_SHMEM
9#include <boost/interprocess/offset_ptr.hpp>
10#endif
11
12namespace vistle {
13
14template<class T>
16 typedef T ObjType;
17 typedef typename ObjType::Data ObjData;
18
19public:
21 shm_obj_ref(const std::string &name, ObjType *p);
22 shm_obj_ref(const shm_obj_ref &other);
25
26 template<typename... Args>
27 static shm_obj_ref create(const Args &...args);
28
29 bool find();
30
31 template<typename... Args>
32 void construct(const Args &...args);
33
34 const shm_obj_ref &operator=(const shm_obj_ref &rhs);
35 const shm_obj_ref &operator=(typename ObjType::const_ptr rhs);
36 const shm_obj_ref &operator=(typename ObjType::ptr rhs);
37 bool valid() const;
38 typename ObjType::const_ptr getObject() const;
39 const typename ObjType::Data *getData() const;
40 operator bool() const;
41 const shm_name_t &name() const;
42
43private:
44 shm_name_t m_name;
45#ifdef NO_SHMEM
46 const ObjData *m_d;
47#else
48 boost::interprocess::offset_ptr<const ObjData> m_d;
49#endif
50
51 void ref();
52 void unref();
53
55 template<class Archive>
56 void save(Archive &ar) const;
57 template<class Archive>
58 void load(Archive &ar);
59};
60} // namespace vistle
61#endif
62
63#include "shm_obj_ref_impl.h"
#define ARCHIVE_ACCESS_SPLIT
Definition: archives_config.h:502
Definition: shm_obj_ref.h:15
bool find()
Definition: shm_obj_ref_impl.h:50
const ObjType::Data * getData() const
Definition: shm_obj_ref_impl.h:120
const shm_obj_ref & operator=(typename ObjType::const_ptr rhs)
shm_obj_ref(const std::string &name, ObjType *p)
static shm_obj_ref create(const Args &...args)
const shm_obj_ref & operator=(const shm_obj_ref &rhs)
Definition: shm_obj_ref_impl.h:71
bool valid() const
Definition: shm_obj_ref_impl.h:104
ObjType::const_ptr getObject() const
Definition: shm_obj_ref_impl.h:110
~shm_obj_ref()
Definition: shm_obj_ref_impl.h:35
const shm_name_t & name() const
Definition: shm_obj_ref_impl.h:128
const shm_obj_ref & operator=(typename ObjType::ptr rhs)
void construct(const Args &...args)
Definition: shm_obj_ref_impl.h:61
shm_obj_ref()
Definition: shm_obj_ref_impl.h:11
Definition: allobjects.cpp:30
Definition: shmname.h:11