OSVR-Core
IPCRingBufferResults.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_IPCRingBufferResults_h_GUID_324D713B_59B5_478A_4FA4_81851E72E83E
26 #define INCLUDED_IPCRingBufferResults_h_GUID_324D713B_59B5_478A_4FA4_81851E72E83E
27 
28 // Internal Includes
30 #include "SharedMemory.h"
32 
33 // Library/third-party includes
34 // - none
35 
36 // Standard includes
37 // - none
38 
39 namespace osvr {
40 namespace common {
41 
42  namespace detail {
43  struct IPCPutResult {
44  ~IPCPutResult() {
45 #ifdef OSVR_SHM_LOCK_DEBUGGING
46  OSVR_DEV_VERBOSE("Releasing exclusive lock on sequence "
47  << seq);
48 #endif
49  elementLock.unlock();
50  boundsLock.unlock();
51  }
52  IPCRingBuffer::value_type *buffer;
54  ipc::exclusive_lock_type elementLock;
55  ipc::exclusive_lock_type boundsLock;
56  IPCRingBufferPtr shm;
57  };
58 
59  struct IPCGetResult {
60 
61  ~IPCGetResult() {
62 #ifdef OSVR_SHM_LOCK_DEBUGGING
63  OSVR_DEV_VERBOSE("Releasing shared lock on sequence " << seq);
64 #endif
65  elementLock.unlock();
66  }
67  IPCRingBuffer::value_type *buffer;
68  ipc::sharable_lock_type elementLock;
70  IPCRingBufferPtr shm;
71  };
72  } // namespace detail
73 
74 } // namespace common
75 } // namespace osvr
76 #endif // INCLUDED_IPCRingBufferResults_h_GUID_324D713B_59B5_478A_4FA4_81851E72E83E
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: IPCRingBufferResults.h:59
shared_ptr< IPCRingBuffer > IPCRingBufferPtr
Pointer type for holding a shared memory ring buffer.
Definition: IPCRingBuffer.h:49
Definition: IPCRingBufferResults.h:43
uint32_t sequence_type
The sequence number is automatically incremented with each "put" into the buffer. ...
Definition: IPCRingBuffer.h:149
Definition: newuoa.h:1888