Go to the documentation of this file.
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) );
virtual ~CReferencedMemBlock()
Destructor, calls dereference_once.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void resize(size_t mem_block_size)
Resize the shared memory block.
CReferencedMemBlock(size_t mem_block_size=0)
Constructor with an optional size of the memory block.
stlplus::smart_ptr< std::vector< char > > base_t
Represents a memory block (via "void*") that can be shared between several objects through copy opera...
EIGEN_STRONG_INLINE bool empty() const
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |