1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __cpPluginsBase__RawData__h__
5 #define __cpPluginsBase__RawData__h__
7 #include <cpPluginsBase_Export.h>
8 #include <cpPlugins/DataObject.h>
10 namespace cpPluginsBase
14 class CPPLUGINSBASE_EXPORT RawData
15 : public cpPlugins::DataObject
17 cpPluginsTypeMacro( RawData, cpPlugins::DataObject );
22 typedef std::shared_ptr< TData > TDataPointer;
25 template< class _TType >
26 void TakeOwnership( _TType* buffer, const std::size_t& size );
28 template< class _TType = char >
31 template< class _TType = char >
32 const _TType* GetBuffer( ) const;
34 const std::size_t& GetSize( ) const;
36 virtual void Print( std::ostream& o ) const override;
49 // -------------------------------------------------------------------------
50 template< class _TType >
51 void cpPluginsBase::RawData::
52 TakeOwnership( _TType* buffer, const std::size_t& size )
54 this->m_Data = TDataPointer( reinterpret_cast< TData* >( buffer ) );
59 // -------------------------------------------------------------------------
60 template< class _TType >
61 _TType* cpPluginsBase::RawData::
64 return( reinterpret_cast< _TType* >( this->m_Data.get( ) ) );
67 // -------------------------------------------------------------------------
68 template< class _TType >
69 const _TType* cpPluginsBase::RawData::
72 return( reinterpret_cast< const _TType* >( this->m_Data.get( ) ) );
75 #endif // __cpPluginsBase__RawData__h__