#include <dtn/DropCause.h>


Public Member Functions | |
| virtual const DropCause * | n () 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 | |
| DropCause * | m_next |
| A pointer to the static instance of the base class for this DropCause. | |
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.
| DTN::DropCause::DropCause | ( | DropCause * | p = 0 |
) | [inline, protected] |
Protected constructor.
This prevents the creation of instances other than the static one.
| p | The next DropCause in the chain; the base class for the current instance |
Definition at line 83 of file DropCause.h.
| 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.
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.
| c | The cause of a Bundle drop |
c inherits from this instance's type Definition at line 44 of file DropCause.cc.
References n().
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().
1.5.4