VR-Forces 4.2 Class Documentation
List of all members | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions
DtEchelonHierarchy Class Reference

class DtEchelonHierarchy: More...

Inheritance diagram for DtEchelonHierarchy:
Inheritance graph
[legend]

Public Slots

virtual void addModelData (const DtModelKey &key)
 Checks to see if this model data should be added, and adds if so.
virtual void removeModelData (const DtModelKey &key)
 Removes this model data from the hierarchy if it exists.
virtual void updateModelData (const DtModelKey &key, int changed)
 If key is a current entry in the hierarchy, this function calls updateModelNode().
virtual void reconnectAllNodes ()
 Dissconnects the entire hierarchy, and then calls connectNode() for each node in the hierarchy.

Signals

void nodeAdded (const DtModelKey &)
 Emitted when a new echelon node is added to the hierarchy.
void nodeAboutToBeRemoved (const DtModelKey &)
 Emitted immediadly before an echelon node is removed from the hierarchy.
void nodeReparented (const DtModelKey &)
 Emitted whenever a node's parent changes.

Public Member Functions

 DtEchelonHierarchy (QObject *parent=NULL)
 default constructor
virtual ~DtEchelonHierarchy ()
 destructor
virtual void init (const DtModelDataDict *dict)
 Connects to the model data dictionary.
virtual DtEchelonHierarchyNodenode (const QString &strKey) const
 Returns the node which corresponds to the key.
virtual void allDecendentsOf (const DtModelKey &key, QVector< DtModelKey > &resultList) const
 Returns the list of ModelKeys which are the decendents of node key in the resultList argument.
virtual void allImmediateDecendentsOf (const DtModelKey &key, QVector< DtModelKey > &resultList) const
 Returns a list of top level decendents of specified item.
virtual bool isSuperiorOf (const DtModelKey &superior, const DtModelKey &subordinate) const
 Returns true only if the superior is either a direct or indirect superior of the subordinant.
virtual const DtPtrQList
< DtEchelonHierarchyNode * > & 
nodeList () const
virtual const DtModelDataDictmodelDataDict () const
virtual void setAlwaysReconnectAllNodes (bool value)
 If set, all nodes will be reconnected each time a node is added.
virtual bool alwaysReconnectAllNodes () const
virtual void tick ()
 Sends queued node reparented signals.

Static Public Member Functions

static DtEchelonHierarchycreate (QObject *parent)
 Returns a newly created instance of a DtEchelonHierarchy.

Protected Slots

virtual void queueNodeReparentedSignal (const DtModelKey &key)
 This queues the key value, for a nodeReparentedSignal.

Protected Member Functions

virtual bool shouldBeAdded (const DtModelKey &key)
 Returs true if the model data referenced by this key should be added to the hierarchy.
virtual DtEchelonHierarchyNodeaddModelNode (const DtModelKey &key)
 Adds a new node to the hierarchy with this key, calls connectNode() to connect the child/parent relationships appropriatly, emits nodeAdded() and returns a pointer to the new node.
virtual void removeModelNode (const DtModelKey &key)
 Removes the node with this key.
virtual void updateModelNode (const DtModelKey &key)
 Updates information about a node that already exists in the tree.
virtual void connectNode (DtEchelonHierarchyNode *node)
 Connects this node to the rest of the hierarchy.
virtual void reconnectNode (DtEchelonHierarchyNode *node)
 Removes all children and reconnects node.
virtual void connectChild (DtEchelonHierarchyNode *parentNode, DtEchelonHierarchyNode *childNode)
 Connects the childNode to the parentNode.
virtual void disconnectNode (DtEchelonHierarchyNode *node)
 Disconnects this node from the rest of the hierarchy.
virtual int calculateLevelsFromNode (DtEchelonHierarchyNode *node)
 Calculates the node level for all nodes below, and including node.
virtual void calculateAllLevels ()
 Calculates the node level for all nodes in the hierarchy.
virtual void sendQueuedNodeReparentedSignals ()
 Sends a nodeReparented() signal for each key in the queue.

Protected Attributes

QHash< DtModelKey,
DtEchelonHierarchyNode * > 
myNodeDict
DtPtrQList
< DtEchelonHierarchyNode * > 
myNodeList
 For looking up by key.
const DtModelDataDictmyModelDataDict
 For searching linerally.
bool myAlwaysReconnectAllNodes
QVector< DtModelKeymyNodeReparentedQueue

Private Member Functions

 DtEchelonHierarchy (const DtEchelonHierarchy &orig)
 copy constructor
DtEchelonHierarchyoperator= (const DtEchelonHierarchy &orig)
 assignment operator

Detailed Description

class DtEchelonHierarchy:

An instance DtEchelonHierarchy maintians a hierarchical tree of the echelon structure. It is derived from QObject so that it can use the Qt signal/slot callback mechanism.

Constructor & Destructor Documentation

DtEchelonHierarchy::DtEchelonHierarchy ( QObject parent = NULL)

default constructor

virtual DtEchelonHierarchy::~DtEchelonHierarchy ( )
virtual

destructor

DtEchelonHierarchy::DtEchelonHierarchy ( const DtEchelonHierarchy orig)
private

copy constructor

Member Function Documentation

virtual void DtEchelonHierarchy::init ( const DtModelDataDict dict)
virtual

Connects to the model data dictionary.

virtual DtEchelonHierarchyNode* DtEchelonHierarchy::node ( const QString &  strKey) const
virtual

Returns the node which corresponds to the key.

virtual void DtEchelonHierarchy::allDecendentsOf ( const DtModelKey key,
QVector< DtModelKey > &  resultList 
) const
virtual

Returns the list of ModelKeys which are the decendents of node key in the resultList argument.

virtual void DtEchelonHierarchy::allImmediateDecendentsOf ( const DtModelKey key,
QVector< DtModelKey > &  resultList 
) const
virtual

Returns a list of top level decendents of specified item.

virtual bool DtEchelonHierarchy::isSuperiorOf ( const DtModelKey superior,
const DtModelKey subordinate 
) const
virtual

Returns true only if the superior is either a direct or indirect superior of the subordinant.

virtual const DtPtrQList<DtEchelonHierarchyNode*>& DtEchelonHierarchy::nodeList ( ) const
virtual
virtual const DtModelDataDict* DtEchelonHierarchy::modelDataDict ( ) const
virtual
virtual void DtEchelonHierarchy::setAlwaysReconnectAllNodes ( bool  value)
virtual

If set, all nodes will be reconnected each time a node is added.

This may be necessary, depending on the implementation of connectNode() by the derived class.

virtual bool DtEchelonHierarchy::alwaysReconnectAllNodes ( ) const
virtual
virtual void DtEchelonHierarchy::tick ( )
virtual

Sends queued node reparented signals.

static DtEchelonHierarchy* DtEchelonHierarchy::create ( QObject parent)
static

Returns a newly created instance of a DtEchelonHierarchy.

virtual void DtEchelonHierarchy::addModelData ( const DtModelKey key)
virtualslot

Checks to see if this model data should be added, and adds if so.

virtual void DtEchelonHierarchy::removeModelData ( const DtModelKey key)
virtualslot

Removes this model data from the hierarchy if it exists.

virtual void DtEchelonHierarchy::updateModelData ( const DtModelKey key,
int  changed 
)
virtualslot

If key is a current entry in the hierarchy, this function calls updateModelNode().

virtual void DtEchelonHierarchy::reconnectAllNodes ( )
virtualslot

Dissconnects the entire hierarchy, and then calls connectNode() for each node in the hierarchy.

void DtEchelonHierarchy::nodeAdded ( const DtModelKey )
signal

Emitted when a new echelon node is added to the hierarchy.

void DtEchelonHierarchy::nodeAboutToBeRemoved ( const DtModelKey )
signal

Emitted immediadly before an echelon node is removed from the hierarchy.

void DtEchelonHierarchy::nodeReparented ( const DtModelKey )
signal

Emitted whenever a node's parent changes.

virtual bool DtEchelonHierarchy::shouldBeAdded ( const DtModelKey key)
protectedvirtual

Returs true if the model data referenced by this key should be added to the hierarchy.

Override this function to allow your models to be added.

virtual DtEchelonHierarchyNode* DtEchelonHierarchy::addModelNode ( const DtModelKey key)
protectedvirtual

Adds a new node to the hierarchy with this key, calls connectNode() to connect the child/parent relationships appropriatly, emits nodeAdded() and returns a pointer to the new node.

virtual void DtEchelonHierarchy::removeModelNode ( const DtModelKey key)
protectedvirtual

Removes the node with this key.

The default implementation emits nodeAboutToBeRemoved(), and calls disconnectNode() before deleting the node.

virtual void DtEchelonHierarchy::updateModelNode ( const DtModelKey key)
protectedvirtual

Updates information about a node that already exists in the tree.

Default implementation calls connectNode() for this node or reconnectAllNodes() depending on the state of alwaysReconnectAllNodes().

virtual void DtEchelonHierarchy::connectNode ( DtEchelonHierarchyNode node)
protectedvirtual

Connects this node to the rest of the hierarchy.

Default implementation only calls calculateLevelsFromNode().

virtual void DtEchelonHierarchy::reconnectNode ( DtEchelonHierarchyNode node)
protectedvirtual

Removes all children and reconnects node.

virtual void DtEchelonHierarchy::connectChild ( DtEchelonHierarchyNode parentNode,
DtEchelonHierarchyNode childNode 
)
protectedvirtual

Connects the childNode to the parentNode.

Disconnects the childNode from its current parent if it is not a root node.

virtual void DtEchelonHierarchy::disconnectNode ( DtEchelonHierarchyNode node)
protectedvirtual

Disconnects this node from the rest of the hierarchy.

The default implementation sets the parent pointer of any child nodes to NULL (i.e. they become roots) and removes this node from the child lists of its parent. Override this function if you require different actions.

virtual int DtEchelonHierarchy::calculateLevelsFromNode ( DtEchelonHierarchyNode node)
protectedvirtual

Calculates the node level for all nodes below, and including node.

Returns the level of node.

virtual void DtEchelonHierarchy::calculateAllLevels ( )
protectedvirtual

Calculates the node level for all nodes in the hierarchy.

virtual void DtEchelonHierarchy::queueNodeReparentedSignal ( const DtModelKey key)
protectedvirtualslot

This queues the key value, for a nodeReparentedSignal.

This is needed so that the nodeReparented() signals are send AFTER the nodeAdded() signal if a node addition caused some of the other nodes to get reparented under it.

virtual void DtEchelonHierarchy::sendQueuedNodeReparentedSignals ( )
protectedvirtual

Sends a nodeReparented() signal for each key in the queue.

DtEchelonHierarchy& DtEchelonHierarchy::operator= ( const DtEchelonHierarchy orig)
private

assignment operator

Member Data Documentation

QHash<DtModelKey, DtEchelonHierarchyNode*> DtEchelonHierarchy::myNodeDict
protected
DtPtrQList<DtEchelonHierarchyNode*> DtEchelonHierarchy::myNodeList
protected

For looking up by key.

const DtModelDataDict* DtEchelonHierarchy::myModelDataDict
protected

For searching linerally.

bool DtEchelonHierarchy::myAlwaysReconnectAllNodes
protected
QVector<DtModelKey> DtEchelonHierarchy::myNodeReparentedQueue
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)