FAST
3.2.0
Framework for Heterogeneous Medical Image Computing and Visualization
|
Go to the documentation of this file. 1 #ifndef SIMPLEDATAOBJECT_HPP
2 #define SIMPLEDATAOBJECT_HPP
10 #define FAST_SIMPLE_DATA_OBJECT(NAME, DATA_TYPE) \
11 class NAME : public SimpleDataObject<DATA_TYPE > { \
14 typedef DataAccess<DATA_TYPE >::pointer access; \
20 template <
class DataType>
23 template <
class DataType,
typename AccessObject = DataAccess<DataType> >
27 template <
class DataType>
36 typedef std::unique_ptr<DataAccess<DataType> >
pointer;
43 template <
class DataType>
46 mDataObject = dataObject;
49 template <
class DataType>
54 template <
class DataType>
59 template <
class DataType>
61 mDataObject->accessFinished();
64 template <
class DataType>
71 template <
class DataType,
typename AccessObject>
81 virtual void freeAll()
override;
92 template <
class DataType,
class AccessObject>
97 template <
class DataType,
class AccessObject>
102 template <
class DataType,
class AccessObject>
107 template <
class DataType,
class AccessObject>
110 blockIfBeingWrittenTo();
113 blockIfBeingAccessed();
115 std::lock_guard<std::mutex> lock(mDataIsBeingWrittenToMutex);
116 mDataIsBeingWrittenTo =
true;
118 updateModifiedTimestamp();
123 std::lock_guard<std::mutex> lock(mDataIsBeingAccessedMutex);
124 mDataIsBeingAccessed =
true;
127 typename AccessObject::pointer accessObject(
new AccessObject(&mData, std::static_pointer_cast<
SimpleDataObject<DataType>>(mPtr.lock())));
128 return std::move(accessObject);
131 template <
class DataType,
class AccessObject>
140 #endif //SIMPLEDATAOBJECT_HPP
std::shared_ptr< ExecutionDevice > pointer
Definition: ExecutionDevice.hpp:11
DataType
Definition: DataTypes.hpp:38
void release()
Definition: SimpleDataObject.hpp:60
Definition: SimpleDataObject.hpp:24
Definition: SimpleDataObject.hpp:21
Definition: AffineTransformation.hpp:7
@ ACCESS_READ_WRITE
Definition: Access.hpp:5
DataType * mData
Definition: SimpleDataObject.hpp:38
void setData(const DataType &data)
Definition: SimpleDataObject.hpp:55
std::unique_ptr< DataAccess< DataType > > pointer
Definition: SimpleDataObject.hpp:36
DataType getData()
Definition: SimpleDataObject.hpp:50
~DataAccess()
Definition: SimpleDataObject.hpp:65
AccessObject::pointer getAccess(accessType type)
Definition: SimpleDataObject.hpp:108
SimpleDataObject()
Definition: SimpleDataObject.hpp:132
virtual void free(ExecutionDevice::pointer device) override
Definition: SimpleDataObject.hpp:93
Definition: DataObject.hpp:13
accessType
Definition: Access.hpp:5
void create(DataType data)
Definition: SimpleDataObject.hpp:103
DataAccess(DataType *data, std::shared_ptr< SimpleDataObject< DataType > > dataObject)
Definition: SimpleDataObject.hpp:44
std::shared_ptr< SimpleDataObject< DataType > > mDataObject
Definition: SimpleDataObject.hpp:39
virtual void freeAll() override
Definition: SimpleDataObject.hpp:98
DataType mData
Definition: SimpleDataObject.hpp:83