packable Class Reference

A base class for objects that can pack into bytes. More...

#include <packable.h>

Inheritance diagram for packable:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~packable ()
virtual void pack (byte_array &packed_form) const=0
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (byte_array &packed_form)=0
 Restores the packable from the "packed_form".
virtual int packed_size () const
 Estimates the space needed for the packed structure.

Detailed Description

A base class for objects that can pack into bytes.

A packable is an abstract object that represents any object that can be transformed from a potentially deep form into an equivalent flat form. The flat form is a simple extent of memory stored as bytes.

Definition at line 27 of file packable.h.


Constructor & Destructor Documentation

packable::~packable (  )  [virtual]

Definition at line 23 of file packable.cpp.


Member Function Documentation

virtual void packable::pack ( byte_array packed_form  )  const [pure virtual]

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implemented in event_record, internet_address, serial_port_address, ipc_address, network_address, machine_uid, earth_time::clock_time, earth_time::day_in_year, earth_time::time_locus, string_set, string_array, version, string_table, geometric::angle< contents >, geometric::point< numeric_type >, geometric::rectangle< numeric_type >, attribute_bundle, nodes::packable_tree, octopus_entity, octopus_request_id, identity_infoton, infoton, unhandled_request, directory_tree, file_info, filename, filename_list, filename_tree, file_time, file_transfer_header, occurrence, runtime_history, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, column_headers, bubble, geometric::angle< double >, geometric::point< double >, geometric::point< int >, geometric::rectangle< double >, and geometric::rectangle< int >.

Referenced by network_address::pack().

virtual bool packable::unpack ( byte_array packed_form  )  [pure virtual]

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implemented in event_record, internet_address, serial_port_address, ipc_address, network_address, machine_uid, earth_time::clock_time, earth_time::day_in_year, earth_time::time_locus, string_set, string_array, version, string_table, geometric::angle< contents >, geometric::point< numeric_type >, geometric::rectangle< numeric_type >, attribute_bundle, nodes::packable_tree, octopus_entity, octopus_request_id, identity_infoton, infoton, unhandled_request, directory_tree, file_info, filename, filename_list, filename_tree, file_time, file_transfer_header, occurrence, runtime_history, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, column_headers, bubble, geometric::angle< double >, geometric::point< double >, geometric::point< int >, geometric::rectangle< double >, and geometric::rectangle< int >.

Referenced by network_address::unpack().

int packable::packed_size (  )  const [virtual]

Estimates the space needed for the packed structure.

Reimplemented in internet_address, serial_port_address, ipc_address, network_address, address_base, string_set, string_array, string_table, attribute_bundle, octopus_entity, octopus_request_id, identity_infoton, infoton, unhandled_request, file_transfer_header, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, and bubble.

Definition at line 25 of file packable.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Jul 23 04:35:24 2008 for HOOPLE Libraries by  doxygen 1.5.1