bit::FieldBase Class Reference
[Records]

#include <bit/fieldbase.h>

Inheritance diagram for bit::FieldBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

FieldBase serves as a top level parent providing the concepts of a starting offset within a buffer, a length value, and units associated with each.

Todo:
Put in some type of check to ensure validity of a set type, or defer until access???
Author:
Rick L. Vinyard, Jr.


Public Types

typedef boost::shared_ptr<
FieldBase
pointer
 A convenience typedef to a smart pointer to FieldBase.

Public Member Functions

 FieldBase ()
 Default constructor.
virtual ~FieldBase ()
 Destructor.
virtual size_t length () const =0
virtual size_t length (size_t units) const
virtual size_t length_units () const =0
 Returns the length units.
virtual int offset () const =0
virtual int offset (size_t units) const
virtual size_t offset_units () const =0
 Returns the offset units.
virtual int start (size_t units=BITS) const
virtual std::string name () const =0
 Returns the string name associated with this object.
virtual std::string name (int depth) const
virtual size_t depth () const
virtual std::string description () const =0
 Returns the string description of this object.
const FieldTypetype ()
 Returns a FieldType object that describes how the field data should be interpreted.
void set_type (const FieldType &)
 Sets the FieldType object describing how the field data should be interpreted.
virtual bool operator< (const FieldBase &other) const
 Compares the starting bit position of objects.
virtual bool operator> (const FieldBase &other) const
 Compares the ending bit position of objects.
virtual FieldBase::pointer clone ()=0
virtual iterator begin ()
virtual iterator end ()
virtual FieldBaseoperator[] (std::string s) throw (error::invalid_container_op, std::out_of_range)
virtual FieldBaseoperator[] (size_t i) throw (error::invalid_container_op, std::out_of_range)
virtual size_t fields ()
virtual FieldBase::pointer field (std::string s)
virtual FieldBase::pointer field (size_t i)
FieldBaseparent ()

Protected Member Functions

virtual FieldBase::pointer previous_field (FieldBase::pointer current_field) throw (error::invalid_container_op)
virtual FieldBase::pointer next_field (FieldBase::pointer current_field) throw (error::invalid_container_op)

Protected Attributes

FieldBasem_parent
FieldType m_type

Friends

class RecordStorage
class RecordVector

Classes

class  iterator
 This is a generalized interator that performs all operations using the generalized container methods in the FieldBase class. More...


Member Function Documentation

size_t bit::FieldBase::length size_t  units  )  const [virtual]
 

Returns:
the length of this object in the supplied units
Whether the object is specified in bits or octets, length(BITS) will always return the length in bits and length(OCTETS) will always return the length in octets.

When the length in bits is not evenly divisible by the requested unit size (say a 12 bit offset with requested units = 8) the return value will be the number of units required to store the object. For example, if the object has a 12 bit offset and the units parameter = OCTETS, the return value will be 2.

virtual size_t bit::FieldBase::length  )  const [pure virtual]
 

Returns:
the length of this object in it's length units

Implemented in bit::Field, bit::FieldVector::Element, bit::Record, and bit::RecordVector.

virtual std::string bit::FieldBase::name  )  const [pure virtual]
 

Returns the string name associated with this object.

This pure virtual method is reimplemented by children to provide the proper notation, such as the array notation of elements, by children.

Implemented in bit::Field, bit::FieldVector::Element, and bit::RecordBase.

int bit::FieldBase::offset size_t  units  )  const [virtual]
 

Returns:
the offset of this object in the specified offset units
This method can be used to get the offset as a specified unit size regardless of the currently set offset unit size of this object.

When the offset size in bits is not evenly divisible by the requested unit size (say a 12 bit offset with requested units = 8) the return value will be the number of units required to complete the offset. For example, if the object has a 12 bit offset and the units parameter = 8, the return value will be 2. If the units were the same, but the offset were -12 bits the return value would be -2.

virtual int bit::FieldBase::offset  )  const [pure virtual]
 

Returns:
the offset of this object in the offset units of this object

Implemented in bit::Field, bit::FieldVector::Element, and bit::RecordBase.

bool bit::FieldBase::operator< const FieldBase other  )  const [virtual]
 

Compares the starting bit position of objects.

This overload is provided to allow easy sorting of objects according to their starting bit position.

Returns:
true if this object's starting bit is less than the other object's starting bit

bool bit::FieldBase::operator> const FieldBase other  )  const [virtual]
 

Compares the ending bit position of objects.

This overload is provided to allow easy sorting of objects according to position of their last bit.

Returns:
true if this object's starting bit is less than the other object's starting bit

int bit::FieldBase::start size_t  units = BITS  )  const [virtual]
 

Returns:
the starting position of this object in the specified units
This method will return the starting position of this object in the specified units, which defaults to bits. The returned value will also account for the offset of the parent object (if this object has a parent).

When the offset size in bits is not evenly divisible by the requested unit size (say a 12 bit offset with requested units = 8) the return value will be the number of units required to complete the offset. For example, if the object has a 12 bit offset and the units parameter = 8, the return value will be 2. If the units were the same, but the offset were -12 bits the return value would be -2.


The documentation for this class was generated from the following files:
Generated on Thu Jul 6 14:38:09 2006 by  doxygen 1.4.6