Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

cluster::ClusterDepChecker Class Reference

Dependency checker for Remote Input Manager. More...

#include <ClusterDepChecker.h>

List of all members.

Public Methods

 ClusterDepChecker ()
virtual std::string getCheckerName ()
 Returns a string name of the checker. More...

virtual bool canHandle (jccl::ConfigElementPtr element)
 We can handle only remote device configuration information. More...

virtual bool depSatisfied (jccl::ConfigElementPtr element)
 Are the dependencies satisfied? Check whether the display system element is in the active config. More...

virtual void debugOutDependencies (jccl::ConfigElementPtr element, int dbg_lvl=vprDBG_WARNING_LVL)
 Write out the dependencies to the vprDEBUG macro. More...


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 50 of file ClusterDepChecker.h.


Constructor & Destructor Documentation

cluster::ClusterDepChecker::ClusterDepChecker   [inline]
 

Definition at line 53 of file ClusterDepChecker.h.

00054    {;}


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 60 of file ClusterDepChecker.h.

00061    { return std::string("Cluster Dependency Checker"); }

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

We can handle only remote device configuration information.

Definition at line 161 of file ClusterDepChecker.cpp.

00162 {
00163    return (element->getID() == ClusterNetwork::getMachineSpecificElementType() ||
00164            cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element) /*||
00165            cluster::ClusterManager::instance()->recognizeClusterManagerConfig(element)*/ );
00166 }

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, gadgetDBG_RIM, and cluster::ClusterNetwork::getClusterNodeByName.

00049 {
00050    if (element->getID() == ClusterNetwork::getMachineSpecificElementType())
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       //   - ClusterNode 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       cluster::ClusterNetwork* cluster_net = cluster::ClusterNetwork::instance();
00075 
00076       // deviceHost exists in active configuration
00077       std::string device_host = element->getProperty<std::string>("device_host");
00078       ClusterNode* node = cluster_net->getClusterNodeByName(device_host);
00079 
00080       if(!cfg_mgr->isElementInActiveList(device_host))
00081       {
00082          pass = false;
00083          vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL)
00084             << "[ClusterDepChecker] Host node's ConfigElement("
00085             << device_host << ") is not in the Active List yet.\n"
00086             << vprDEBUG_FLUSH;
00087       }
00088       else if(node == NULL)
00089       {
00090          pass = false;
00091          vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL) << "[ClusterDepChecker] ClusterNode("
00092                << device_host << ") is NULL, so it is not in the Active List yet.\n" << vprDEBUG_FLUSH;
00093       }
00094       else if(ClusterNode::DISCONNECTED == node->getConnected())
00095       {
00096          pass = false;
00097          vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL) << "[ClusterDepChecker] Adding Pending Node??" << vprDEBUG_FLUSH;
00098          ClusterNetwork::instance()->addPendingNode(node);
00099 
00100          vprDEBUG(gadgetDBG_RIM,vprDBG_WARNING_LVL) << "[ClusterDepChecker] ClusterNode("
00101             << device_host << ") not connected yet.\n" << vprDEBUG_FLUSH;
00102       }
00103       //Not needed, we kind of just did it above
00104       // debugOutDependencies(element, vprDBG_WARNING_LVL);
00105 
00106       return pass;
00107    }
00108    /*else if (cluster::ClusterManager::instance()->recognizeClusterManagerConfig(element))
00109    {
00110       // We need the following for the Cluster to be setup correctly
00111       // - All Nodes connected(All listed machines connected)
00112       // - All Devices configured
00113 
00114       // HERE
00115       // - No MachineSpecific elements Pending
00116 
00117 
00118       int number_nodes = element->getNum("cluster_node");
00119       for (int i = 0 ; i < number_nodes ; i++)
00120       {
00121          std::string node_name = element->getProperty<std::string>("cluster_node",i);
00122          jccl::ConfigElementPtr node_element = ClusterManager::instance()->getConfigElementPointer(node_name);
00123          if (node_element.get() == NULL)
00124          {
00125             // Node not in current configuration
00126             jccl::ConfigManager::instance()->delayStalePendingList();
00127             std::cout << "L" << std::flush;
00128             return(false);
00129          }
00130          std::string host_name = node_element->getProperty<std::string>("host_name");
00131          if (!ClusterNetwork::isLocalHost(host_name))
00132          {
00133             ClusterNode* node = ClusterNetwork::instance()->getClusterNodeByName(node_name);
00134             if (node == NULL)
00135             {
00136                jccl::ConfigManager::instance()->delayStalePendingList();
00137                std::cout << "N" << std::flush;
00138                return(false);
00139             }
00140             else if (!node->isConnected())
00141             {
00142                jccl::ConfigManager::instance()->delayStalePendingList();
00143                std::cout << "D" << std::flush;
00144                return(false);
00145             }
00146          }
00147       }
00148       return(true);
00149    }*/
00150    else
00151    {
00152       vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << "ERROR, Something is seriously wrong, we should never get here\n"
00153       << vprDEBUG_FLUSH;
00154       return(true);
00155    }
00156 }

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 168 of file ClusterDepChecker.cpp.

Referenced by depSatisfied.

00170 {
00171    boost::ignore_unused_variable_warning(dbg_lvl);
00172 
00173    if (element->getID() == ClusterNetwork::getMachineSpecificElementType())
00174    {
00175       // Machine Specific element should have no dependencies since we are
00176       // simply inserting the child elements into the pending list.
00177       //vprDEBUG(vprDBG_ALL,dbg_lvl) << "MachineSpecific elements have NO Deps!!!\n" << vprDEBUG_FLUSH;
00178    }
00179    else if (cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element))
00180    {
00181       // Remote devices should have no dependencies since we are not actually
00182       // configuring anything, we are only creating a data structure that we
00183       // can determine without any other elements.
00184       //vprDEBUG(vprDBG_ALL,dbg_lvl) << "Virtual Device: " << element->getName()
00185       //   << " has NO Deps since it is Virtual!!!\n" << vprDEBUG_FLUSH;
00186    }
00187    /*else if (cluster::ClusterManager::instance()->recognizeClusterManagerConfig(element))
00188    {
00189       //int number_nodes = element->getNum("cluster_node");
00190       //for (int i = 0 ; i < number_nodes ; i++)
00191       //{
00192       //   std::string node_name = element->getProperty<std::string>("cluster_node",i);
00193       //   jccl::ConfigElementPtr node_element = RmoteInputManager::instance()->getConfigElementPointer(node_name);
00194       //   if (node_element.get() == NULL)
00195       //   {
00196       //      vprDEBUG(vprDBG_ALL, dbg_lvl) << node_name << " Node not in current configuration."
00197       //         << std::endl << vprDEBUG_FLUSH;
00198       //      return;
00199       //   }
00200       //   std::string host_name = node_element->getProperty<std::string>("host_name");
00201       //   if (!ClusterNetwork::isLocalHost(host_name))
00202       //   {
00203       //      ClusterNode* node = ClusterNetwork::instance()->getClusterNodeByName(node_name);
00204       //      if (node == NULL)
00205       //      {
00206       //         vprDEBUG(vprDBG_ALL, dbg_lvl) << node_name << " does not exist in ClusterNetwork."
00207       //            << std::endl << vprDEBUG_FLUSH;
00208       //         return;
00209       //      }
00210       //      else if (!node->isConnected())
00211       //      {
00212       //         node->debugDump(dbg_lvl);
00213       //         return;
00214       //      }
00215       //   }
00216       //}
00217    }*/
00218    else
00219    {
00220       //vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << "ERROR, Something is seriously wrong, we should never get here\n"
00221       //   << vprDEBUG_FLUSH;
00222    }
00223 
00224 }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:43 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002