9#ifndef CReferencedMemBlock_H
10#define CReferencedMemBlock_H
42 if (!base_t::present())
43 throw std::runtime_error(
"Trying to access to an uninitialized memory block");
45 if( base_t::operator ->()->
empty() )
46 throw std::runtime_error(
"Trying to access to a memory block of size 0");
48 return reinterpret_cast<T
>( & base_t::operator ->()->operator [](0) );
51 template <
class T> T
getAs()
const
53 if (!base_t::present())
54 throw std::runtime_error(
"Trying to access to an uninitialized memory block");
56 if( base_t::operator ->()->
empty() )
57 throw std::runtime_error(
"Trying to access to a memory block of size 0");
59 return reinterpret_cast<const T
>( & base_t::operator ->()->operator [](0) );
Represents a memory block (via "void*") that can be shared between several objects through copy opera...
CReferencedMemBlock(size_t mem_block_size=0)
Constructor with an optional size of the memory block.
void resize(size_t mem_block_size)
Resize the shared memory block.
stlplus::smart_ptr< std::vector< char > > base_t
virtual ~CReferencedMemBlock()
Destructor, calls dereference_once.
EIGEN_STRONG_INLINE bool empty() const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.