Main Page | Modules | Class Hierarchy | Class List | Directories | Class Members | Related Pages | Examples

ByteCountAttribute Class Reference

specialized attribute; wraps a call to count the number of packets in an aggregate More...

#include <ByteCountAttribute.h>

Inheritance diagram for ByteCountAttribute:

ScalarAttribute< int > Attribute FilteredPacketListener PacketListener List of all members.

Public Member Functions

 ByteCountAttribute (void)
 ByteCountAttribute (bool incHdr)
 ByteCountAttribute (const PacketFilter &filter, bool incHdr=true)
 ByteCountAttribute (const ByteCountAttribute &toCopy)
virtual ByteCountAttributeclone (void) const
virtual ByteCountAttributeoperator= (const ByteCountAttribute &rhs)
virtual void handlePassedPacket (TraceIterator &packet) throw ( InvalidAggregateTypeException, ArithmeticOverflowException )
 Notify the attribute of a new packet to be included in the computation.
virtual void compute (void) throw ( InvalidAggregateTypeException, ArithmeticOverflowException )
virtual int getValue (void) const
virtual const AttributegetAttrib (const std::string &ident) const throw ( UnknownAttributeException )
 Get a subattribute of this attribute.
virtual uint32_t getInt32Value (void) const throw ( ArithmeticOverflowException )
 ScalarAttribute (void)
 ScalarAttribute (const ScalarAttribute< int > &toCopy)
 ScalarAttribute (const PacketFilter &filter)
virtual std::string toString (void) const
 get a string representation of the Attribute
int getType (void)
virtual void linkToAggregate (Aggregate &parent)
 Notify the Attribute that it is being linked to a particular aggregate.
virtual void reset (void) throw ( NotResettableException )
 Reset the value of the attribute.
virtual void handlePacket (TraceIterator &newPkt)

Static Public Attributes

static const int TYPE_UNKNOWN = 0
static const int TYPE_SCALAR = 1
static const int TYPE_DISTRIB = 17
static const int TYPE_HISTOGRAM = 25
static const int TYPE_ARRAY = 33
static const int TYPE_SET = 34

Protected Attributes

int attribType
bool dirty


std::ostream & operator<< (std::ostream &os, const Attribute &attrib)

Detailed Description

specialized attribute; wraps a call to count the number of packets in an aggregate

The attribute represents the number of bytes in the packet at the current layer; e.g. a ByteCountAttribute on a TCP trace will yield the number of bytes of TCP headers plus TCP payloads, and will not include the bytes of the Ethernet, IP, etc. headers.
Examples:, and

Constructor & Destructor Documentation

ByteCountAttribute::ByteCountAttribute void   ) 

Create a new ByteCountAttribute

incHdr include the bytes of the header in the total (default true)

Member Function Documentation

void ByteCountAttribute::compute void   )  throw ( InvalidAggregateTypeException, ArithmeticOverflowException ) [virtual]

set up ByteCountAttribute as a listener so that it can compute its value online

Reimplemented from Attribute.

int ByteCountAttribute::getValue void   )  const [virtual]

get the value of the attribute

ArithmeticOverflowException is thrown if the value is too large

Reimplemented from ScalarAttribute< int >.

void FilteredPacketListener::handlePacket TraceIterator newPkt  )  [virtual, inherited]

checks the packet against the filter and calls handlePassedPacket if it passes or if the filter is NULL

Implements PacketListener.

void ByteCountAttribute::handlePassedPacket TraceIterator packet  )  throw ( InvalidAggregateTypeException, ArithmeticOverflowException ) [virtual]

Notify the attribute of a new packet to be included in the computation.

For an online attribute, update the attribute. For an offline attribute, set the dirty bit. (default)

Reimplemented from Attribute.

void Attribute::linkToAggregate Aggregate parent  )  [virtual, inherited]

Notify the Attribute that it is being linked to a particular aggregate.

parent New parent aggregate - will supplant any previous parent
If an Attribute subclass is only intended for use with a particular subtype of aggregate, override this method and add type checking. e.g.: Trace *trace = dynamic_cast<Trace*>(parent); if( NULL != trace ) {...} else throw InvalidAggregateException(...);

Reimplemented in ArithmeticAttribute< lType, rType, resType >, and SumAttribute< T >.

void Attribute::reset void   )  throw ( NotResettableException ) [virtual, inherited]

Reset the value of the attribute.

NotResettableException if the Attribute cannot be properly reset, e.g. if it is a wrapper for a subattribute.

Reimplemented in SumAttribute< T >.

Member Data Documentation

const int Attribute::TYPE_ARRAY = 33 [static, inherited]


const int Attribute::TYPE_DISTRIB = 17 [static, inherited]

statistical distribution

const int Attribute::TYPE_HISTOGRAM = 25 [static, inherited]


const int Attribute::TYPE_SCALAR = 1 [static, inherited]

single-valued type

const int Attribute::TYPE_SET = 34 [static, inherited]


const int Attribute::TYPE_UNKNOWN = 0 [static, inherited]

unknown type

The documentation for this class was generated from the following files:
Generated on Thu Apr 5 01:02:37 2007 for ANTARES by  doxygen 1.4.2