DTN::DropCause Class Reference

Base class for encapsulating the reason why a Bundle was dropped. More...

#include <dtn/DropCause.h>

Inheritance diagram for DTN::DropCause:

Inheritance graph
[legend]
Collaboration diagram for DTN::DropCause:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual const DropCausen () const
 Get the next DropCause in the chain.
virtual bool isType (const DropCause &c)
 Compare the type of a DropCause for inheritance from this type.
virtual ~DropCause ()
 virtual destructor

Static Public Attributes

static DropCause inst
 unique instance for an unspecified drop cause

Protected Member Functions

 DropCause (DropCause *p=0)
 Protected constructor.

Protected Attributes

DropCausem_next
 A pointer to the static instance of the base class for this DropCause.


Detailed Description

Base class for encapsulating the reason why a Bundle was dropped.

This forms the base of a hierarchy (mostly with only one level of inheritance) to record the reason for dropping a Bundle. These classes are very simple, being of limited purpose. Ideally, we'd exploit some reflective characteristic of inheritance, but C++ doesn't provide us with a mechanism to do this. Consequently, this hierarchy is essentially a set of pointer chains, where the addresses of static instances capture the inheritance relations.

We could, in fact, represent this much more compactly with global void*'s, but this scheme provides us with some meaningful semantics and type safety. That is, we can't just provide a random pointer and have it interpreted as a DropCause.

Definition at line 55 of file DropCause.h.


Constructor & Destructor Documentation

DTN::DropCause::DropCause ( DropCause p = 0  )  [inline, protected]

Protected constructor.

This prevents the creation of instances other than the static one.

Parameters:
p The next DropCause in the chain; the base class for the current instance

Definition at line 83 of file DropCause.h.


Member Function Documentation

virtual const DropCause* DTN::DropCause::n (  )  const [inline, virtual]

Get the next DropCause in the chain.

An instance holds a chain of its ancestors, so that walking the chain is equivalent to walking up the inheritance tree.

Returns:
the base class instance, or NULL if this is the base

Definition at line 65 of file DropCause.h.

References m_next.

Referenced by isType().

bool DropCause::isType ( const DropCause c  )  [virtual]

Compare the type of a DropCause for inheritance from this type.

This walks the chain of next pointers, returning if a match is found or the chain is exhausted.

Parameters:
c The cause of a Bundle drop
Returns:
whether c inherits from this instance's type

Definition at line 44 of file DropCause.cc.

References n().


Member Data Documentation

DropCause* DTN::DropCause::m_next [protected]

A pointer to the static instance of the base class for this DropCause.

Definition at line 87 of file DropCause.h.

Referenced by n().


The documentation for this class was generated from the following files:
Generated on Mon Mar 24 11:15:48 2008 for Pydtn Simulator by  doxygen 1.5.4