9 #include "fwDataTools/config.hpp" 11 #include <fwData/Array.hpp> 13 #include <fwMemory/BufferObject.hpp> 24 class FWDATATOOLS_CLASS_API
Array 30 FWDATATOOLS_API
Array( ::fwData::Array::sptr array );
31 FWDATATOOLS_API
virtual ~Array();
40 FWDATATOOLS_API
virtual void setItem(const ::fwData::Array::IndexType&
id,
const void* value);
51 FWDATATOOLS_API
virtual void setItem(const ::fwData::Array::IndexType&
id,
const size_t component,
63 FWDATATOOLS_API
virtual void* getItem(const ::fwData::Array::IndexType&
id,
const size_t component = 0);
74 template<
typename T > T* getItem(const ::fwData::Array::IndexType&
id,
const size_t component = 0);
82 FWDATATOOLS_API
virtual void getItem(const ::fwData::Array::IndexType&
id,
void* value)
const;
83 FWDATATOOLS_API
virtual void getItem(const ::fwData::Array::IndexType&
id,
const size_t component,
92 FWDATATOOLS_API
virtual void* getBuffer();
93 FWDATATOOLS_API
virtual const void* getBuffer()
const;
108 FWDATATOOLS_API
void setBuffer(
111 const ::fwTools::Type& type,
112 const ::fwData::Array::SizeType& size,
113 size_t nbOfComponents,
114 ::fwMemory::BufferAllocationPolicy::sptr policy = ::fwMemory::BufferMallocPolicy::New()
118 FWDATATOOLS_API
virtual char* begin();
119 FWDATATOOLS_API
virtual char* end();
120 FWDATATOOLS_API
virtual const char* begin()
const;
121 FWDATATOOLS_API
virtual const char* end()
const;
124 template<
typename T > T* begin();
125 template<
typename T > T* end();
137 FWDATATOOLS_API
char* getBufferPtr( const ::fwData::Array::IndexType&
id,
size_t component,
size_t sizeOfType );
138 FWDATATOOLS_API
const char* getBufferPtr( const ::fwData::Array::IndexType&
id,
size_t component,
139 size_t sizeOfType )
const;
143 FWDATATOOLS_API ::fwMemory::BufferObject::Lock getLock()
const;
155 FWDATATOOLS_API
virtual void setBuffer(
157 bool takeOwnership =
false,
158 ::fwMemory::BufferAllocationPolicy::sptr policy = ::fwMemory::BufferMallocPolicy::New()
161 ::fwData::Array::sptr m_array;
168 template<
typename T >
171 return static_cast<T*
>(this->getBuffer());
176 template<
typename T >
179 return reinterpret_cast<T*
> (
static_cast<char*
>(this->getBuffer()) + m_array->getSizeInBytes());
184 template<
typename T >
187 return static_cast<T*
> (this->getItem(
id, component));
base class for BufferObject Lock
#define fwCoreClassFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate methods for classes with one factory.