7 #ifndef __FWDATA_ARRAY_HPP__ 8 #define __FWDATA_ARRAY_HPP__ 10 #include "fwData/config.hpp" 11 #include "fwData/Exception.hpp" 12 #include "fwData/factory/new.hpp" 13 #include "fwData/Object.hpp" 15 #include <fwMemory/BufferObject.hpp> 17 #include <fwTools/Type.hpp> 19 fwCampAutoDeclareDataMacro((
fwData)(Array), FWDATA_API);
43 typedef std::vector<size_t>
SizeType;
63 FWDATA_API
virtual ~
Array();
66 FWDATA_API
void cachedDeepCopy(
const Object::csptr& _source, DeepCopyCacheType& cache)
override;
92 FWDATA_API
virtual size_t resize(const ::fwTools::Type& type,
const SizeType& size,
size_t nbOfComponents,
93 bool reallocate =
false);
96 FWDATA_API
virtual size_t resize(
const std::string& type,
const SizeType& size,
size_t nbOfComponents,
97 bool reallocate =
false);
98 FWDATA_API
virtual size_t resize(
const SizeType& size,
size_t nbOfComponents,
bool reallocate =
100 FWDATA_API
virtual size_t resize(
const SizeType& size,
bool reallocate =
false);
106 FWDATA_API
virtual void clear();
114 FWDATA_API
virtual bool empty()
const;
122 FWDATA_API
virtual size_t getElementSizeInBytes()
const;
129 FWDATA_API
virtual size_t getNumberOfElements()
const;
136 FWDATA_API
virtual size_t getSizeInBytes()
const;
143 FWDATA_API
virtual const SizeType& getSize()
const;
150 FWDATA_API
virtual const OffsetType& getStrides()
const;
158 FWDATA_API
virtual void setNumberOfComponents(
size_t nb);
165 FWDATA_API
virtual size_t getNumberOfComponents()
const;
172 FWDATA_API
virtual size_t getNumberOfDimensions()
const;
179 FWDATA_API
virtual void setIsBufferOwner(
const bool own);
186 FWDATA_API
virtual bool getIsBufferOwner()
const;
193 FWDATA_API
virtual void setType(
const std::string& type);
194 FWDATA_API
virtual void setType(const ::fwTools::Type& type);
201 FWDATA_API virtual ::fwTools::Type getType()
const;
213 FWDATA_API
size_t getBufferOffset( const ::fwData::Array::IndexType&
id,
size_t component,
214 size_t sizeOfType )
const;
225 FWDATA_API
static OffsetType computeStrides( SizeType size,
size_t nbOfComponents,
size_t sizeOfType );
227 ::fwMemory::BufferObject::sptr getBufferObject ()
const;
229 void setBufferObject (const ::fwMemory::BufferObject::sptr& val);
232 FWDATA_API
void swap( Array::sptr _source );
241 OffsetType m_strides;
243 ::fwMemory::BufferObject::sptr m_bufferObject;
245 size_t m_nbOfComponents;
246 bool m_isBufferOwner;
252 inline ::fwMemory::BufferObject::sptr Array::getBufferObject ()
const 254 return m_bufferObject;
259 inline void Array::setBufferObject (const ::fwMemory::BufferObject::sptr& val)
261 m_bufferObject = val;
268 #endif // __FWDATA_ARRAY_HPP__ std::vector< size_t > SizeType
Array size type.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
std::vector< size_t > OffsetType
Offset type.
OffsetType IndexType
Index type.
Provides a way to manage a view on a multidimentionnal array.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Base class for each data object.
Contains the representation of the data objects used in the framework.