#include <data.hh>
Public Member Functions | |
template<class T> | |
Self & | operator= (const Data_< T > &other) |
Affectation. | |
Self & | operator= (const Data_< Self > &other) |
bool | empty () const |
inline::size_t | size () const |
Get the available size at raw(). | |
void | fit (unsigned len) |
Resize the buffer. | |
template<class T> | |
inline::size_t | operator- (const Data_< T > &rhs) const |
Return size() - rhs.size(). | |
const u_int8_t * | raw () const |
Access the raw data. | |
Data_ () | |
Constructors and destructor. | |
Data_ (const ::size_t size) | |
Data_ (const Data_ &other) | |
template<class T> | |
Data_ (const Data_< T > &other) | |
~Data_ () | |
Self | shrink_by (unsigned len) const |
Create new smaller instances. | |
Self | shrink_to (unsigned len) const |
Self | operator+ (unsigned offset) const |
Create new instances with greater offset (and smaller instance size). | |
Self & | operator+= (unsigned offset) |
void | dump (u_int8_t *p) const |
Copy the data to a specific location. | |
void | dump (Data_< Data > &d) const |
Self & | exact () |
Retrieve the exact type of Data_<Self> (i.e. cast to self). | |
const Self & | exact () const |
Protected Member Functions | |
void | use () |
Increment the buffer's usecount. | |
void | unuse () |
Decrement the buffer's usecount. | |
Protected Attributes | |
internal::shared_data * | data_ |
::size_t | instance_size_ |
unsigned | offset_ |
Friends | |
class | Data_< typename internal::other< Self >::return_type > |
olsr::utl::Data_< Self >::Data_ | ( | ) | [inline] |
Constructors and destructor.
olsr::utl::Data_< Self >::Data_ | ( | const ::size_t | size | ) | [inline, explicit] |
olsr::utl::Data_< Self >::Data_ | ( | const Data_< Self > & | other | ) | [inline] |
olsr::utl::Data_< Self >::Data_ | ( | const Data_< T > & | other | ) | [inline] |
olsr::utl::Data_< Self >::~Data_ | ( | ) | [inline] |
References olsr::utl::Data_< Self >::unuse().
Self & olsr::utl::Data_< Self >::operator= | ( | const Data_< T > & | other | ) | [inline] |
Affectation.
References olsr::utl::internal::shared_data::buffer, olsr::utl::Data_< Self >::data_, olsr::utl::Data_< Self >::exact(), i_static_assert, olsr::utl::Data_< Self >::instance_size_, olsr::utl::Data_< Self >::offset_, olsr::utl::Data_< Self >::unuse(), olsr::utl::Data_< Self >::use(), and olsr::utl::internal::shared_data::usecount.
Self & olsr::utl::Data_< Self >::operator= | ( | const Data_< Self > & | other | ) | [inline] |
bool olsr::utl::Data_< Self >::empty | ( | ) | const [inline] |
Tell whether this object has an attached buffer or not.
References olsr::utl::Data_< Self >::data_.
Referenced by olsr::msg::TCMessage::dump(), olsr::msg::MIDMessage::dump(), and olsr::msg::HNAMessage::dump().
size_t olsr::utl::Data_< Self >::size | ( | ) | const [inline] |
Get the available size at raw().
References olsr::utl::Data_< Self >::instance_size_.
Referenced by olsr::msg::TCMessage::dump(), olsr::msg::MIDMessage::dump(), olsr::msg::UnknownMessage::dump(), olsr::msg::HNAMessage::dump(), olsr::msg::HELLOMessage::dump(), olsr::utl::Data_< Self >::fit(), olsr::utl::Data_< Self >::operator+=(), olsr::msg::TCMessage::parse(), olsr::pkt::Packet::parse(), olsr::msg::MIDMessage::parse(), olsr::msg::Message::parse(), olsr::msg::HNAMessage::parse(), olsr::msg::HELLOMessage::parse(), olsr::sys::UnixSocket::receive(), olsr::sys::Socket::receive(), olsr::sys::UnixSocket::send(), olsr::sys::Socket::send(), olsr::sys::Socket::sendto(), and olsr::sys::Socket::sendto_bcast().
void olsr::utl::Data_< Self >::fit | ( | unsigned | len | ) | [inline] |
Resize the buffer.
References olsr::utl::Data_< Self >::instance_size_, olsr::utl::Data_< Self >::offset_, and olsr::utl::Data_< Self >::size().
Referenced by olsr::pkt::Packet::close().
Self olsr::utl::Data_< Self >::shrink_by | ( | unsigned | len | ) | const [inline] |
Create new smaller instances.
References olsr::utl::Data_< Self >::exact(), and olsr::utl::Data_< Self >::instance_size_.
Self olsr::utl::Data_< Self >::shrink_to | ( | unsigned | len | ) | const [inline] |
References olsr::utl::Data_< Self >::exact().
Referenced by olsr::pkt::Packet::parse(), olsr::sys::UnixSocket::receive(), and olsr::sys::Socket::receive().
Self olsr::utl::Data_< Self >::operator+ | ( | unsigned | offset | ) | const [inline] |
Create new instances with greater offset (and smaller instance size).
References olsr::utl::Data_< Self >::exact().
Self & olsr::utl::Data_< Self >::operator+= | ( | unsigned | offset | ) | [inline] |
size_t olsr::utl::Data_< Self >::operator- | ( | const Data_< T > & | rhs | ) | const [inline] |
const u_int8_t * olsr::utl::Data_< Self >::raw | ( | ) | const [inline] |
Access the raw data.
References olsr::utl::internal::shared_data::buffer, olsr::utl::Data_< Self >::data_, and olsr::utl::Data_< Self >::offset_.
Referenced by olsr::msg::TCMessage::parse(), olsr::msg::MIDMessage::parse(), olsr::msg::HNAMessage::parse(), olsr::msg::HELLOMessage::parse(), olsr::sys::UnixSocket::send(), olsr::sys::Socket::send(), olsr::sys::Socket::sendto(), and olsr::sys::Socket::sendto_bcast().
void olsr::utl::Data_< Self >::dump | ( | u_int8_t * | p | ) | const [inline] |
Copy the data to a specific location.
References olsr::utl::internal::shared_data::buffer, olsr::utl::Data_< Self >::data_, olsr::utl::Data_< Self >::instance_size_, and olsr::utl::Data_< Self >::offset_.
Referenced by olsr::msg::TCMessage::dump(), olsr::msg::MIDMessage::dump(), olsr::msg::UnknownMessage::dump(), and olsr::msg::HNAMessage::dump().
void olsr::utl::Data_< Self >::dump | ( | Data_< Data > & | d | ) | const [inline] |
Self & olsr::utl::Data_< Self >::exact | ( | ) | [inline] |
Retrieve the exact type of Data_<Self> (i.e. cast to self).
Referenced by olsr::utl::Data_< Self >::operator+(), olsr::utl::Data_< Self >::operator+=(), olsr::utl::Data_< Self >::operator=(), olsr::utl::Data_< Self >::shrink_by(), and olsr::utl::Data_< Self >::shrink_to().
const Self & olsr::utl::Data_< Self >::exact | ( | ) | const [inline] |
void olsr::utl::Data_< Self >::use | ( | ) | [inline, protected] |
Increment the buffer's usecount.
References olsr::utl::Data_< Self >::data_, and olsr::utl::internal::shared_data::usecount.
Referenced by olsr::utl::Data_< Self >::Data_(), and olsr::utl::Data_< Self >::operator=().
void olsr::utl::Data_< Self >::unuse | ( | ) | [inline, protected] |
Decrement the buffer's usecount.
References olsr::utl::internal::shared_data::buffer, olsr::utl::Data_< Self >::data_, and olsr::utl::internal::shared_data::usecount.
Referenced by olsr::utl::Data_< Self >::operator=(), and olsr::utl::Data_< Self >::~Data_().
friend class Data_< typename internal::other< Self >::return_type > [friend] |
internal::shared_data* olsr::utl::Data_< Self >::data_ [protected] |
::size_t olsr::utl::Data_< Self >::instance_size_ [protected] |
unsigned olsr::utl::Data_< Self >::offset_ [protected] |