IBR-DTNSuite
0.8
|
#include <Serializer.h>
Public Member Functions | |
DefaultSerializer (std::ostream &stream) | |
DefaultSerializer (std::ostream &stream, const Dictionary &d) | |
virtual | ~DefaultSerializer () |
virtual Serializer & | operator<< (const dtn::data::Bundle &obj) |
virtual Serializer & | operator<< (const dtn::data::PrimaryBlock &obj) |
virtual Serializer & | operator<< (const dtn::data::Block &obj) |
virtual Serializer & | operator<< (const dtn::data::BundleFragment &obj) |
virtual size_t | getLength (const dtn::data::Bundle &obj) |
virtual size_t | getLength (const dtn::data::PrimaryBlock &obj) const |
virtual size_t | getLength (const dtn::data::Block &obj) const |
Protected Member Functions | |
Serializer & | serialize (const dtn::data::PayloadBlock &obj, size_t clip_offset, size_t clip_length) |
void | rebuildDictionary (const dtn::data::Bundle &obj) |
bool | isCompressable (const dtn::data::Bundle &obj) const |
Protected Attributes | |
std::ostream & | _stream |
Dictionary | _dictionary |
bool | _compressable |
Definition at line 84 of file Serializer.h.
dtn::data::DefaultSerializer::DefaultSerializer | ( | std::ostream & | stream | ) |
Default serializer.
stream | Stream to write to |
Definition at line 23 of file Serializer.cpp.
dtn::data::DefaultSerializer::DefaultSerializer | ( | std::ostream & | stream, |
const Dictionary & | d | ||
) |
Initialize the Serializer with a default dictionary. This will be used to write the right values in the EID reference part of blocks.
stream | Stream to write to |
d | The default dictionary |
Definition at line 28 of file Serializer.cpp.
virtual dtn::data::DefaultSerializer::~DefaultSerializer | ( | ) | [inline, virtual] |
Destructor
Definition at line 104 of file Serializer.h.
size_t dtn::data::DefaultSerializer::getLength | ( | const dtn::data::Bundle & | obj | ) | [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::security::MutualSerializer.
Definition at line 384 of file Serializer.cpp.
References rebuildDictionary().
Referenced by getLength(), dtn::net::operator<<(), dtn::net::UDPConvergenceLayer::queue(), dtn::storage::MemoryBundleStorage::remove(), dtn::storage::MemoryBundleStorage::store(), and dtn::storage::SimpleBundleStorage::store().
size_t dtn::data::DefaultSerializer::getLength | ( | const dtn::data::PrimaryBlock & | obj | ) | const [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::security::MutualSerializer.
Definition at line 404 of file Serializer.cpp.
References dtn::data::PrimaryBlock::_appdatalength, _compressable, dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, _dictionary, dtn::data::PrimaryBlock::_fragmentoffset, dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_procflags, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_sequencenumber, dtn::data::PrimaryBlock::_source, dtn::data::PrimaryBlock::_timestamp, dtn::data::PrimaryBlock::FRAGMENT, dtn::data::PrimaryBlock::get(), dtn::data::EID::getCompressed(), dtn::data::SDNV::getLength(), dtn::data::Dictionary::getRef(), and dtn::data::Dictionary::getSize().
size_t dtn::data::DefaultSerializer::getLength | ( | const dtn::data::Block & | obj | ) | const [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::data::SeparateSerializer, and dtn::security::MutualSerializer.
Definition at line 506 of file Serializer.cpp.
References dtn::data::Block::_blocktype, _dictionary, dtn::data::Block::_eids, dtn::data::Block::BLOCK_CONTAINS_EIDS, dtn::data::Block::get(), dtn::data::SDNV::getLength(), dtn::data::Block::getLength(), getLength(), and dtn::data::Dictionary::getRef().
bool dtn::data::DefaultSerializer::isCompressable | ( | const dtn::data::Bundle & | obj | ) | const [protected] |
Definition at line 133 of file Serializer.cpp.
References dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_source, dtn::data::Block::getEIDList(), and dtn::data::EID::isCompressable().
Referenced by operator<<().
Serializer & dtn::data::DefaultSerializer::operator<< | ( | const dtn::data::Bundle & | obj | ) | [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::security::StrictSerializer.
Definition at line 54 of file Serializer.cpp.
References _compressable, isCompressable(), and rebuildDictionary().
Serializer & dtn::data::DefaultSerializer::operator<< | ( | const dtn::data::PrimaryBlock & | obj | ) | [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::security::MutualSerializer.
Definition at line 165 of file Serializer.cpp.
References dtn::data::PrimaryBlock::_appdatalength, _compressable, dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, _dictionary, dtn::data::PrimaryBlock::_fragmentoffset, dtn::data::PrimaryBlock::_lifetime, dtn::data::PrimaryBlock::_procflags, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_sequencenumber, dtn::data::PrimaryBlock::_source, _stream, dtn::data::PrimaryBlock::_timestamp, dtn::data::PrimaryBlock::FRAGMENT, dtn::data::PrimaryBlock::get(), dtn::data::EID::getCompressed(), dtn::data::SDNV::getLength(), dtn::data::Dictionary::getRef(), and dtn::data::Dictionary::getSize().
Serializer & dtn::data::DefaultSerializer::operator<< | ( | const dtn::data::Block & | obj | ) | [virtual] |
Implements dtn::data::Serializer.
Reimplemented in dtn::data::SeparateSerializer, dtn::security::MutualSerializer, and dtn::security::StrictSerializer.
Definition at line 278 of file Serializer.cpp.
References dtn::data::Block::_blocktype, _compressable, _dictionary, dtn::data::Block::_eids, _stream, dtn::data::Block::BLOCK_CONTAINS_EIDS, dtn::data::Block::get(), dtn::data::Block::getLength(), dtn::data::Dictionary::getRef(), and dtn::data::Block::serialize().
Serializer & dtn::data::DefaultSerializer::operator<< | ( | const dtn::data::BundleFragment & | obj | ) | [virtual] |
Reimplemented from dtn::data::Serializer.
Definition at line 77 of file Serializer.cpp.
References dtn::data::PrimaryBlock::_appdatalength, dtn::data::BundleFragment::_bundle, _compressable, dtn::data::PrimaryBlock::_fragmentoffset, dtn::data::BundleFragment::_length, dtn::data::BundleFragment::_offset, dtn::data::PrimaryBlock::FRAGMENT, dtn::data::Block::get(), dtn::data::Bundle::getBlock(), dtn::data::PayloadBlock::getLength(), isCompressable(), rebuildDictionary(), dtn::data::Block::REPLICATE_IN_EVERY_FRAGMENT, serialize(), and dtn::data::PrimaryBlock::set().
void dtn::data::DefaultSerializer::rebuildDictionary | ( | const dtn::data::Bundle & | obj | ) | [protected] |
Definition at line 33 of file Serializer.cpp.
References dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, _dictionary, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_source, dtn::data::Dictionary::add(), dtn::data::Dictionary::clear(), and dtn::data::Block::getEIDList().
Referenced by getLength(), dtn::security::StrictSerializer::operator<<(), and operator<<().
Serializer & dtn::data::DefaultSerializer::serialize | ( | const dtn::data::PayloadBlock & | obj, |
size_t | clip_offset, | ||
size_t | clip_length | ||
) | [protected] |
Definition at line 319 of file Serializer.cpp.
References dtn::data::Block::_blocktype, _compressable, _dictionary, dtn::data::Block::_eids, _stream, dtn::data::Block::BLOCK_CONTAINS_EIDS, dtn::data::Block::get(), dtn::data::PayloadBlock::getLength(), dtn::data::Dictionary::getRef(), and dtn::data::PayloadBlock::serialize().
Referenced by operator<<().
bool dtn::data::DefaultSerializer::_compressable [protected] |
Definition at line 122 of file Serializer.h.
Referenced by getLength(), dtn::security::StrictSerializer::operator<<(), operator<<(), and serialize().
Dictionary dtn::data::DefaultSerializer::_dictionary [protected] |
Definition at line 121 of file Serializer.h.
Referenced by getLength(), dtn::security::StrictSerializer::operator<<(), operator<<(), rebuildDictionary(), and serialize().
std::ostream& dtn::data::DefaultSerializer::_stream [protected] |
Definition at line 119 of file Serializer.h.
Referenced by dtn::security::StrictSerializer::operator<<(), dtn::security::MutualSerializer::operator<<(), operator<<(), dtn::data::SeparateSerializer::operator<<(), and serialize().