cmil::InputNode Class Reference

#include <InputNode.h>

Inheritance diagram for cmil::InputNode:

Inheritance graph
[legend]
Collaboration diagram for cmil::InputNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< InputNode * > NodeIndex

Public Member Functions

InputNode *const createChild (bool indexing, int id)
 This creates raw child nodes without any validation; use with care.
InputNode *const createChild (bool forced_index, const Ev &event)
bool deleteChild (int id)
 This provides a safer way to delete nodes within a tree context.
NodeIndex getStandardIndex ()
virtual ~InputNode ()
std::string getName () const
unsigned long getTime () const
unsigned long getTimeMargin () const
void setTime (unsigned long int time)
void setTimeMargin (unsigned long int time)
NodeIndexgetIndex () const
InputNodegetChild (unsigned int id)
int getChildren () const
InputActiongetAction () const
void setAction (InputAction *action)
InputNodegetParent () const
int getID () const
InputNodegetActiveChild ()
void setActiveChild (InputNode *node)

Static Public Member Functions

static InputNodecreateRoot (System *sys, unsigned long int index_size)

Private Member Functions

 InputNode (InputAction *action, System *const sys, const NodeIndex &index, InputNode *parent, const int id)
 InputNode (InputAction *action, System *const sys, InputNode *parent, const int id)
void cleanup ()
InputNodeoperator= (const InputNode &)

Private Attributes

InputActionm_action
const Systemm_system
NodeIndexm_index
InputNode *const m_parent
const int m_id
unsigned long m_time_margin
unsigned long m_time
InputNodem_activechild

Detailed Description

This class represents a single event, and contains dependant nodes which are randomly accessed in an index based off a standard retrieved from the system.

Definition at line 28 of file InputNode.h.


Member Typedef Documentation

typedef std::vector<InputNode* > cmil::InputNode::NodeIndex

Definition at line 30 of file InputNode.h.


Constructor & Destructor Documentation

virtual cmil::InputNode::~InputNode (  )  [inline, virtual]

Definition at line 42 of file InputNode.h.

References cleanup(), Logger::log_debug(), and m_id.

00042                            { 
00043         std::ostringstream dtor_ss;
00044         dtor_ss << "calling InputNode dtor with m_id: " << m_id; 
00045         log_debug(dtor_ss.str());
00046         cleanup(); 
00047       }

Here is the call graph for this function:

cmil::InputNode::InputNode ( InputAction action,
System *const   sys,
const NodeIndex index,
InputNode parent,
const int  id 
) [private]

Definition at line 32 of file InputNode.cpp.

References Logger::log_debug(), and m_index.

Referenced by createChild(), and createRoot().

00032                                                                                                                       : 
00033     SystemClient(sys),
00034     m_action(action), 
00035     m_index(new NodeIndex(index)), 
00036     m_parent(parent),
00037     m_id(id), 
00038     m_time_margin(0), 
00039     m_time(0), 
00040     m_activechild(NULL) 
00041   {
00042       std::ostringstream debug_ss;
00043       debug_ss << "index initialized with size of: " << m_index->size() ; 
00044       log_debug(debug_ss.str());
00045   }

Here is the call graph for this function:

Here is the caller graph for this function:

cmil::InputNode::InputNode ( InputAction action,
System *const   sys,
InputNode parent,
const int  id 
) [private]

Definition at line 47 of file InputNode.cpp.

00047                                                                                               : 
00048     SystemClient(sys),
00049     m_action(action), 
00050     m_index(NULL), 
00051     m_parent(parent), 
00052     m_id(id), 
00053     m_activechild(NULL)
00054   {}


Member Function Documentation

void cmil::InputNode::cleanup (  )  [private]

Definition at line 56 of file InputNode.cpp.

References Logger::log_debug(), and m_index.

Referenced by ~InputNode().

00056                           {
00057     std::ostringstream debug_ss;
00058 
00059     if(m_index) {
00060       debug_ss << "cleanup() m_index found of size:" << m_index->size();
00061       log_debug(debug_ss.str());
00062 
00063       for(InputNode::NodeIndex::iterator i = m_index->begin(); i != m_index->end(); ++i) {
00064         if(*i) {
00065           log_debug("cleanup() found non-null node in m_index, deleting ");
00066           delete (*i);
00067         }
00068       }
00069 
00070       delete m_index;
00071     }
00072   }

Here is the call graph for this function:

Here is the caller graph for this function:

InputNode *const cmil::InputNode::createChild ( bool  forced_index,
const Ev event 
)

This will return a child node created from type information on the event passed, unless flagged with forced_index. If one already exists it will return that instead.

Locate the events cooresponding id.

Check if child is already present for this event.

Definition at line 100 of file InputNode.cpp.

References createChild(), getChild(), cmil::SystemClient::getData(), cmil::SystemClient::getID(), Logger::log_debug(), Logger::log_error(), m_id, and m_index.

00100                                                                             {
00101     int id;
00102     std::ostringstream debug_ss;
00103     const bool with_index = true;
00104     const bool without_index = false;
00105 
00106     if(!m_index) {
00107       log_error("createChild(bool,event) returning NULL due to lack of an m_index to work with.");
00108       return NULL;
00109     }
00110 
00111     debug_ss << "createChild(Event), this m_id: " << m_id;
00112     log_debug(debug_ss.str());
00113 
00115     log_debug("createChild(Event) locating ID for given event");
00116 
00117     if( (id = SystemClient::getID(event) )) {
00119       if(getChild(id)) {
00120         log_debug("creatChild(Event) returning pre-exisiting node");
00121         return getChild(id);  
00122       }
00123 
00124       if(!forced_index) {
00125         log_debug( std::string("createChild(Event) determining kind of child to create for event:").append( event.getName() ));
00126         if(!(dynamic_cast<ModData*>(getData(id)))) 
00127           return createChild(without_index, id);  
00128         else  
00129           return createChild(with_index, id); 
00130       }
00131       else
00132         return createChild(with_index, id); 
00133     }
00134 
00135     log_error("createChild(Event) returning NULL");
00136     return NULL;
00137   }

Here is the call graph for this function:

InputNode *const cmil::InputNode::createChild ( bool  indexing,
int  id 
)

This creates raw child nodes without any validation; use with care.

Definition at line 81 of file InputNode.cpp.

References cmil::SystemClient::getSize(), cmil::SystemClient::getSystem(), InputNode(), Logger::log_error(), and m_index.

Referenced by createChild(), cmil::NormalHandler::Merge(), and cmil::ComboHandler::Merge().

00081                                                                {
00082     if(!m_index) {
00083       log_error("createChild(bool,int) returning NULL due to lack of an m_index to work with.");
00084       return NULL;
00085     }
00086 
00087     if(indexing) {
00088       (*m_index)[id] = new InputNode(NULL, getSystem(), NodeIndex(SystemClient::getSize()), this, id);
00089     }
00090     else
00091       (*m_index)[id] = new InputNode(NULL, getSystem(), this, id);
00092 
00093     return (*m_index)[id];
00094   }

Here is the call graph for this function:

Here is the caller graph for this function:

InputNode * cmil::InputNode::createRoot ( System sys,
unsigned long int  index_size 
) [static]

Definition at line 74 of file InputNode.cpp.

References InputNode().

Referenced by cmil::NormalHandler::Merge(), and cmil::ComboHandler::Merge().

00074                                                                             { 
00075     //InputNode* test_node = new InputNode(NULL, NULL, NodeIndex(55), NULL, 0);
00076 
00077     return new InputNode(NULL, sys, NodeIndex(index_size), NULL, 0);
00078   }

Here is the call graph for this function:

Here is the caller graph for this function:

bool cmil::InputNode::deleteChild ( int  id  ) 

This provides a safer way to delete nodes within a tree context.

Definition at line 140 of file InputNode.cpp.

References getChild().

Referenced by cmil::NormalHandler::unMerge().

00140                                     {
00141     InputNode* child;
00142     if( (child = getChild(id)) ) {  
00143       delete child;
00144      ((*m_index)[id]) = NULL;
00145 
00146       return true;
00147     }
00148 
00149     return false;
00150   }

Here is the call graph for this function:

Here is the caller graph for this function:

InputAction* cmil::InputNode::getAction (  )  const [inline]

Definition at line 91 of file InputNode.h.

References m_action.

Referenced by cmil::ComboHandler::handle(), cmil::NormalHandler::handle(), and cmil::NormalHandler::HandleActivity().

00091                                      {
00092         return m_action;
00093       }

Here is the caller graph for this function:

InputNode* cmil::InputNode::getActiveChild (  )  [inline]

Definition at line 107 of file InputNode.h.

References m_activechild.

Referenced by cmil::NormalHandler::recurChildController().

00107                                   {
00108         return m_activechild;
00109       }

Here is the caller graph for this function:

InputNode* cmil::InputNode::getChild ( unsigned int  id  )  [inline]

Definition at line 74 of file InputNode.h.

References Logger::log_error(), and m_index.

Referenced by createChild(), deleteChild(), and cmil::ComboHandler::handle().

00074                                            {
00075         if(id <= m_index->size())
00076           return ((*m_index)[id]);
00077 
00078         log_error("getChild() returning null due to bounds error");
00079         return NULL;
00080       }

Here is the call graph for this function:

Here is the caller graph for this function:

int cmil::InputNode::getChildren (  )  const [inline]

Definition at line 82 of file InputNode.h.

References m_index.

Referenced by cmil::NormalHandler::unMerge().

00082                               {
00083         int count = 0;
00084         if(m_index) 
00085           for(InputNode::NodeIndex::iterator i = m_index->begin(); i != m_index->end(); ++i) 
00086             if(*i) count++;
00087 
00088         return count;
00089       }

Here is the caller graph for this function:

int cmil::InputNode::getID (  )  const [inline]

Definition at line 103 of file InputNode.h.

References m_id.

Referenced by cmil::NormalHandler::recurParentController(), cmil::NormalHandler::RemoveControl(), and cmil::NormalHandler::unMerge().

00103                         {
00104         return m_id;
00105       }

Here is the caller graph for this function:

NodeIndex* cmil::InputNode::getIndex (  )  const [inline]

Definition at line 69 of file InputNode.h.

References m_index.

Referenced by cmil::NormalHandler::handle(), cmil::NormalHandler::HandleActivity(), and cmil::NormalHandler::recurChildController().

00069                                   {
00070         return m_index;
00071       }

Here is the caller graph for this function:

std::string cmil::InputNode::getName (  )  const [inline]

Reimplemented from cmil::SystemClient.

Definition at line 49 of file InputNode.h.

00049                                 {
00050         return "InputNode";
00051       }

InputNode* cmil::InputNode::getParent (  )  const [inline]

Definition at line 99 of file InputNode.h.

References m_parent.

Referenced by cmil::ComboHandler::check_time(), cmil::NormalHandler::recurChildController(), cmil::NormalHandler::recurParentController(), cmil::NormalHandler::RemoveControl(), and cmil::NormalHandler::unMerge().

00099                                    {
00100         return m_parent;
00101       }

Here is the caller graph for this function:

NodeIndex cmil::InputNode::getStandardIndex (  ) 

unsigned long cmil::InputNode::getTime (  )  const [inline]

Definition at line 53 of file InputNode.h.

References m_time.

Referenced by cmil::ComboHandler::check_time().

00053                                     {
00054         return m_time;
00055       }

Here is the caller graph for this function:

unsigned long cmil::InputNode::getTimeMargin (  )  const [inline]

Definition at line 57 of file InputNode.h.

References m_time_margin.

Referenced by cmil::ComboHandler::check_time().

00057                                           {
00058         return m_time_margin;
00059       }

Here is the caller graph for this function:

InputNode& cmil::InputNode::operator= ( const InputNode  )  [private]

void cmil::InputNode::setAction ( InputAction action  )  [inline]

Definition at line 95 of file InputNode.h.

References m_action.

Referenced by cmil::NormalHandler::Merge(), and cmil::ComboHandler::Merge().

00095                                           {
00096         m_action = action;
00097       }

Here is the caller graph for this function:

void cmil::InputNode::setActiveChild ( InputNode node  )  [inline]

Definition at line 111 of file InputNode.h.

References m_activechild.

00111                                            {
00112         m_activechild = node;
00113       }

void cmil::InputNode::setTime ( unsigned long int  time  )  [inline]

Definition at line 61 of file InputNode.h.

References m_time.

Referenced by cmil::ComboHandler::handle().

00061                                            {
00062         m_time = time;
00063       }

Here is the caller graph for this function:

void cmil::InputNode::setTimeMargin ( unsigned long int  time  )  [inline]

Definition at line 65 of file InputNode.h.

References m_time_margin.

Referenced by cmil::ComboHandler::Merge().

00065                                                  {
00066         m_time_margin = time;
00067       }

Here is the caller graph for this function:


Member Data Documentation

InputAction* cmil::InputNode::m_action [private]

Definition at line 127 of file InputNode.h.

Referenced by getAction(), and setAction().

InputNode* cmil::InputNode::m_activechild [private]

Definition at line 141 of file InputNode.h.

Referenced by getActiveChild(), and setActiveChild().

const int cmil::InputNode::m_id [private]

Definition at line 132 of file InputNode.h.

Referenced by createChild(), getID(), and ~InputNode().

NodeIndex* cmil::InputNode::m_index [private]

Definition at line 129 of file InputNode.h.

Referenced by cleanup(), createChild(), getChild(), getChildren(), getIndex(), and InputNode().

InputNode* const cmil::InputNode::m_parent [private]

Definition at line 131 of file InputNode.h.

Referenced by getParent().

const System* cmil::InputNode::m_system [private]

Reimplemented from cmil::SystemClient.

Definition at line 128 of file InputNode.h.

unsigned long cmil::InputNode::m_time [private]

Definition at line 135 of file InputNode.h.

Referenced by getTime(), and setTime().

unsigned long cmil::InputNode::m_time_margin [private]

Definition at line 134 of file InputNode.h.

Referenced by getTimeMargin(), and setTimeMargin().


The documentation for this class was generated from the following files:
(c) 2006-2007 John P. Feltz
Generated on Wed Jul 25 16:08:03 2007 for Common Media Input Layer by doxygen 1.4.7

SourceForge.net Logo