New 4DSSE Code 0.0.1a |

Loading...
Searching...
No Matches
LockableDObject.h
Go to the documentation of this file.
1#ifndef LOCKABLE_DOBJECT_H
2#define LOCKABLE_DOBJECT_H
3
4#include "DObject.h"
5#include <mutex>
6
14
19 class LockableDObject {
20 public:
24 LockableDObject() = default;
25
30 DObject& get();
31
35 void lock();
36
40 void unlock();
41
42 private:
43 DObject object_;
44 std::mutex mutex_;
45};
46
47#endif // LOCKABLE_DOBJECT_H
DObject.h
Defines the DObject class, a universal data container for the project.
DObject
A universal data container class.
Definition DObject.h:29
LockableDObject::unlock
void unlock()
Unlocks the mutex after thread-safe access.
Definition LockableDObject.cpp:20
LockableDObject::get
DObject & get()
Access the underlying DObject.
Definition LockableDObject.cpp:6
LockableDObject::lock
void lock()
Locks the mutex to ensure thread-safe access.
Definition LockableDObject.cpp:13
LockableDObject::LockableDObject
LockableDObject()=default
Default constructor.