19#include "DeviceContext.h"
24 std::string typeToString(OWLDataType type);
27 size_t sizeOf(OWLDataType type);
31 struct Object :
public std::enable_shared_from_this<Object> {
32 typedef std::shared_ptr<Object> SP;
37 typedef std::shared_ptr<DeviceData> SP;
47 template<
typename T>
inline T &
as();
61 virtual std::string
toString()
const;
64 virtual DeviceData::SP
createOn(
const std::shared_ptr<DeviceContext> &device);
68 void createDeviceData(
const std::vector<std::shared_ptr<DeviceContext>> &devices);
71 template<
typename T>
inline std::shared_ptr<T>
as();
92 typedef std::shared_ptr<ContextObject> SP;
99 std::string
toString()
const override;
111 {
return *
dynamic_cast<T *
>(
this); }
115 {
return std::dynamic_pointer_cast<T>(shared_from_this()); }
std::string toString() const override
Definition: Object.cpp:344
virtual ~DeviceData()
Definition: Object.h:44
DeviceData(DeviceContext::SP device)
Definition: Object.h:40
T & as()
Definition: Object.h:110
DeviceContext::SP device
Definition: Object.h:53
static std::atomic< uint64_t > nextAvailableID
Definition: Object.h:82
Object()
Definition: Object.cpp:329
virtual std::string toString() const
Definition: Object.cpp:333
std::shared_ptr< T > as()
Definition: Object.h:114
std::vector< DeviceData::SP > deviceData
Definition: Object.h:86
virtual DeviceData::SP createOn(const std::shared_ptr< DeviceContext > &device)
Definition: Object.cpp:307
const size_t uniqueID
Definition: Object.h:77
void createDeviceData(const std::vector< std::shared_ptr< DeviceContext > > &devices)
Definition: Object.cpp:314