View on GitHub
Vistle
Distributed Data-parallel Scientific Visualization in VR
Overview
Architecture
API
Publications
Gallery
core
shmdata.h
Go to the documentation of this file.
1
#ifndef VISTLE_SHMDATA_H
2
#define VISTLE_SHMDATA_H
3
4
#include <atomic>
5
#include <string>
6
#include <cassert>
7
8
#include "
shmname.h
"
9
10
namespace
vistle
{
11
12
struct
ShmData
{
13
enum
ShmType
{
14
INVALID
,
15
OBJECT
,
16
ARRAY
,
17
};
18
19
explicit
ShmData
(
ShmType
t,
const
std::string &
name
= std::string()):
name
(
name
),
m_refcount
(0),
shmtype
(t) {}
20
21
~ShmData
() { assert(
m_refcount
== 0); }
22
23
int
ref
()
const
24
{
25
assert(
m_refcount
>= 0);
26
return
++
m_refcount
;
27
}
28
29
int
unref
()
const
30
{
31
assert(
m_refcount
> 0);
32
return
--
m_refcount
;
33
}
34
35
int
refcount
()
const
36
{
37
assert(
m_refcount
>= 0);
38
return
m_refcount
;
39
}
40
41
const
shm_name_t
name
;
42
mutable
std::atomic<int>
m_refcount
;
43
const
ShmType
shmtype
=
INVALID
;
44
};
45
46
}
// namespace vistle
47
#endif
vistle
Definition:
allobjects.cpp:30
shmname.h
vistle::ShmData
Definition:
shmdata.h:12
vistle::ShmData::unref
int unref() const
Definition:
shmdata.h:29
vistle::ShmData::name
const shm_name_t name
Definition:
shmdata.h:41
vistle::ShmData::ref
int ref() const
Definition:
shmdata.h:23
vistle::ShmData::ShmType
ShmType
Definition:
shmdata.h:13
vistle::ShmData::INVALID
@ INVALID
Definition:
shmdata.h:14
vistle::ShmData::OBJECT
@ OBJECT
Definition:
shmdata.h:15
vistle::ShmData::ARRAY
@ ARRAY
Definition:
shmdata.h:16
vistle::ShmData::~ShmData
~ShmData()
Definition:
shmdata.h:21
vistle::ShmData::ShmData
ShmData(ShmType t, const std::string &name=std::string())
Definition:
shmdata.h:19
vistle::ShmData::shmtype
const ShmType shmtype
Definition:
shmdata.h:43
vistle::ShmData::refcount
int refcount() const
Definition:
shmdata.h:35
vistle::ShmData::m_refcount
std::atomic< int > m_refcount
Definition:
shmdata.h:42
vistle::shm_name_t
Definition:
shmname.h:11