cluster::ClusterDepChecker Class Reference

Dependency checker for Remote Input Manager. More...

#include <cluster/ClusterDepChecker.h>

List of all members.

Public Member Functions

 ClusterDepChecker ()
virtual std::string getCheckerName ()
 Returns a string name of the checker.
virtual bool canHandle (jccl::ConfigElementPtr element)
 We can handle only remote device configuration information.
virtual bool depSatisfied (jccl::ConfigElementPtr element)
 Are the dependencies satisfied? Check whether the display system element is in the active config.
virtual void debugOutDependencies (jccl::ConfigElementPtr element, int dbg_lvl=vprDBG_WARNING_LVL)
 Write out the dependencies to the vprDEBUG macro.


Detailed Description

Dependency checker for Remote Input Manager.

Implement the basic stuff plus a check for whether the system knows about Remote Input Manager yet.

Definition at line 51 of file ClusterDepChecker.h.


Constructor & Destructor Documentation

cluster::ClusterDepChecker::ClusterDepChecker (  )  [inline]

Definition at line 54 of file ClusterDepChecker.h.

00055    {;}


Member Function Documentation

virtual std::string cluster::ClusterDepChecker::getCheckerName (  )  [inline, virtual]

Returns a string name of the checker.

Used to output messages in checker listings.

Definition at line 61 of file ClusterDepChecker.h.

00062    {
00063       return std::string( "Cluster Dependency Checker" );
00064    }

bool cluster::ClusterDepChecker::canHandle ( jccl::ConfigElementPtr  element  )  [virtual]

We can handle only remote device configuration information.

Definition at line 109 of file ClusterDepChecker.cpp.

References gadget::AbstractNetworkManager::getClusterNodeElementType().

00110 {
00111    return (element->getID() == ClusterNetwork::getClusterNodeElementType() ||
00112            cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig( element ));
00113 }

bool cluster::ClusterDepChecker::depSatisfied ( jccl::ConfigElementPtr  element  )  [virtual]

Are the dependencies satisfied? Check whether the display system element is in the active config.

Returns:
true if default dependencies are satisfied and the Input Manager has Remote Input Manager element.

Definition at line 48 of file ClusterDepChecker.cpp.

References debugOutDependencies(), gadget::Node::DISCONNECTED, gadgetDBG_RIM(), gadget::AbstractNetworkManager::getClusterNodeElementType(), gadget::Node::NEWCONNECTION, and gadget::Node::PENDING.

00049 {
00050    if (element->getID() == ClusterNetwork::getClusterNodeElementType())
00051    {
00052       // Machine Specific elements should have no dependencies since we are
00053       // simply inserting the child elements into the pending list. This is
00054       // to fix errors like the embedded keyboard window in a DisplayWindow
00055       // would always create a dependancy loop.
00056       debugOutDependencies( element, vprDBG_WARNING_LVL );
00057       return true;
00058    }
00059    else if (cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element))
00060    {
00061       // Remote devices should have no dependencies since we are not actually
00062       // configuring anything, we are only creating a data structure that we
00063       // can determine without any other elements.
00064       // Virtual devices should not have any dependencies.
00065 
00066       // RemoteDeviceConfig has only two dependencies
00067       //   - deivceHost exists in Active List
00068       //   - Node exists and is connected
00069       //   - Remote Device needs to be configured
00070 
00071       bool pass = true;
00072 
00073       jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
00074 
00075       // device_host exists in active configuration
00076       std::string device_host = element->getProperty<std::string>( "device_host" );
00077       gadget::Node* node = cluster::ClusterManager::instance()->getNetwork()->getNodeByName( device_host );
00078 
00079       if (!cfg_mgr->isElementInActiveList(device_host) || NULL == node)
00080       {
00081          pass = false;
00082       }
00083       else if (gadget::Node::DISCONNECTED == node->getStatus())
00084       {
00085          pass = false;
00086          
00087          node->setStatus( gadget::Node::PENDING );
00088       }
00089       else if (gadget::Node::PENDING == node->getStatus() ||
00090                gadget::Node::NEWCONNECTION == node->getStatus())
00091       {
00092          // Wait until we are fully connected.
00093          pass = false;
00094       }
00095 
00096       return pass;
00097    }
00098    else
00099    {
00100       vprDEBUG( gadgetDBG_RIM, vprDBG_CONFIG_LVL ) << "ERROR, Something is seriously wrong, we should never get here\n"
00101          << vprDEBUG_FLUSH;
00102       return true;
00103    }
00104 }

void cluster::ClusterDepChecker::debugOutDependencies ( jccl::ConfigElementPtr  element,
int  dbg_lvl = vprDBG_WARNING_LVL 
) [virtual]

Write out the dependencies to the vprDEBUG macro.

Definition at line 115 of file ClusterDepChecker.cpp.

References gadget::Node::DISCONNECTED, gadget::AbstractNetworkManager::getClusterNodeElementType(), gadget::Node::NEWCONNECTION, and gadget::Node::PENDING.

Referenced by depSatisfied().

00117 {
00118    vprDEBUG_NEXT_BEGIN( vprDBG_ALL, dbg_lvl )
00119       << "---- Dependencies for " << element->getName()
00120       << " (type: " << element->getID() << ") ----\n" << vprDEBUG_FLUSH;
00121 
00122    jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
00123 
00124    if (element->getID() == ClusterNetwork::getClusterNodeElementType())
00125    {
00126       // Machine Specific element should have no dependencies since we are
00127       // simply inserting the child elements into the pending list.
00128       vprDEBUG_NEXT( vprDBG_ALL, dbg_lvl ) << "0: "
00129           << "Host node's ConfigElement"
00130           << " ==> " << vprDEBUG_FLUSH;
00131       
00132       vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "none.\n"
00133          << vprDEBUG_FLUSH;
00134    }
00135    else if (cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig( element ))
00136    {
00137       std::string device_host = element->getProperty<std::string>( "device_host");
00138       gadget::Node* node = cluster::ClusterManager::instance()->getNetwork()->getNodeByName( device_host );
00139 
00140       vprDEBUG_NEXT( vprDBG_ALL, dbg_lvl ) << "1: "
00141           << "Device node's ConfigElement"
00142           << " ==> " << vprDEBUG_FLUSH;
00143       
00144       if (!cfg_mgr->isElementInActiveList( device_host ) || NULL == node)
00145       {
00146          vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "not in active list.\n"
00147             << vprDEBUG_FLUSH;
00148       }
00149       else
00150       {
00151          vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "in active list.\n"
00152             << vprDEBUG_FLUSH;
00153       }
00154 
00155       vprDEBUG_NEXT( vprDBG_ALL, dbg_lvl ) << "2: "
00156           << "Device host connection status"
00157           << " ==> " << vprDEBUG_FLUSH;
00158       
00159       if (gadget::Node::DISCONNECTED == node->getStatus())
00160       {
00161          vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "disconnected.\n"
00162             << vprDEBUG_FLUSH;
00163       }
00164       else if (gadget::Node::PENDING == node->getStatus())
00165       {
00166          vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "pending.\n"
00167             << vprDEBUG_FLUSH;
00168       }
00169       else if (gadget::Node::NEWCONNECTION == node->getStatus())
00170       {
00171          vprDEBUG_CONT( vprDBG_ALL, dbg_lvl ) << "new connection.\n"
00172             << vprDEBUG_FLUSH;
00173       }
00174    }
00175    vprDEBUG_CONT_END( vprDBG_ALL, dbg_lvl ) << std::endl << vprDEBUG_FLUSH;
00176 }


The documentation for this class was generated from the following files:
Generated on Thu Jan 4 10:44:16 2007 for Gadgeteer by  doxygen 1.5.1