rogue
Loading...
Searching...
No Matches
FrameLock.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_INTERFACES_MEMORY_FRAME_LOCK_H__
18#define __ROGUE_INTERFACES_MEMORY_FRAME_LOCK_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <memory>
24#include <thread>
25
26namespace rogue {
27namespace interfaces {
28namespace stream {
29
30class Frame;
31
40class FrameLock {
41 std::shared_ptr<rogue::interfaces::stream::Frame> frame_;
42 bool locked_;
43
44 public:
58 static std::shared_ptr<rogue::interfaces::stream::FrameLock> create(
59 std::shared_ptr<rogue::interfaces::stream::Frame> frame);
60
70 explicit FrameLock(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
71
73 static void setup_python();
74
76 ~FrameLock();
77
83 void lock();
84
90 void unlock();
91
98 void enter();
99
106 void exit(void*, void*, void*);
107};
108
110typedef std::shared_ptr<rogue::interfaces::stream::FrameLock> FrameLockPtr;
111
112} // namespace stream
113} // namespace interfaces
114} // namespace rogue
115
116#endif
Scoped lock wrapper for stream frames.
Definition FrameLock.h:40
static std::shared_ptr< rogue::interfaces::stream::FrameLock > create(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Creates a frame lock wrapper.
Definition FrameLock.cpp:34
static void setup_python()
Registers this type with Python bindings.
Definition FrameLock.cpp:48
~FrameLock()
Destroys the wrapper and releases any held lock.
Definition FrameLock.cpp:60
void exit(void *, void *, void *)
Python context-manager exit hook.
Definition FrameLock.cpp:85
void enter()
Python context-manager entry hook.
Definition FrameLock.cpp:82
void unlock()
Unlocks the associated frame when currently locked.
Definition FrameLock.cpp:74
void lock()
Locks the associated frame when not already locked.
Definition FrameLock.cpp:65
std::shared_ptr< rogue::interfaces::stream::FrameLock > FrameLockPtr
Shared pointer alias for FrameLock.
Definition FrameLock.h:110