cluster::RIMPlugin Class Reference

#include <RIMPlugin.h>

Inheritance diagram for cluster::RIMPlugin:

Inheritance graph
[legend]
Collaboration diagram for cluster::RIMPlugin:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RIMPlugin ()
virtual ~RIMPlugin ()
vpr::GUID getHandlerGUID ()
 Get the GUID associated with this handler.
void recoverFromLostNode (gadget::Node *lost_node)
 This function is called when the network losses a connection to a Node.
void handlePacket (Packet *packet, gadget::Node *node)
 Handle a incoming packet.
virtual void preDraw ()
 Calls any action needed by this plugin before draw().
virtual void sendRequests ()
virtual void postPostFrame ()
 Calls any action needed by this plugin before postFrame().
virtual bool isPluginReady ()
 Returns the status of RIMPlugin.
virtual std::string getPluginName ()
 Returns the name of the this plugin.
virtual std::string getHandlerName ()
bool configAdd (jccl::ConfigElementPtr element)
 Add the pending element to the configuration.
bool configRemove (jccl::ConfigElementPtr element)
 Remove the pending element from the current configuration.
bool configCanHandle (jccl::ConfigElementPtr element)
 Checks if this handler can process element.
jccl::ConfigElementPtr getConfigElementPointer (std::string &name)

Detailed Description

Definition at line 63 of file RIMPlugin.h.


Constructor & Destructor Documentation

cluster::RIMPlugin::RIMPlugin (  ) 

Definition at line 84 of file RIMPlugin.cpp.

00085       : mHandlerGUID("9c3fb301-b142-4c6f-8ca3-1570898974d0")
00086       , mRIM(mHandlerGUID)
00087    {;}

cluster::RIMPlugin::~RIMPlugin (  )  [virtual]

Definition at line 89 of file RIMPlugin.cpp.

00090    {;}


Member Function Documentation

vpr::GUID cluster::RIMPlugin::getHandlerGUID (  )  [inline, virtual]

Get the GUID associated with this handler.

Implements gadget::PacketHandler.

Definition at line 69 of file RIMPlugin.h.

Referenced by configAdd().

00070    {
00071       return mHandlerGUID;
00072    }

void cluster::RIMPlugin::recoverFromLostNode ( gadget::Node lost_node  )  [virtual]

This function is called when the network losses a connection to a Node.

The RIMPlugin needs to handle this by removing all VirtualDevices on the lost node. And removing the node as a client from all DeviceServers.

Implements gadget::PacketHandler.

Definition at line 92 of file RIMPlugin.cpp.

00093    {
00094       boost::ignore_unused_variable_warning(lost_node);
00095       // Since we have lost a connection we need to set a flag so
00096       // that when we gain a new connection we will reconfigure.
00097       //setReconfigurationNeededOnConnection(true);
00098    }

void cluster::RIMPlugin::handlePacket ( Packet packet,
gadget::Node node 
) [virtual]

Handle a incoming packet.

Implements gadget::PacketHandler.

Definition at line 103 of file RIMPlugin.cpp.

References gadget::RemoteInputManager::handlePacket().

00104    {
00105       mRIM.handlePacket(packet, node);
00106       // We do not handle packets, we are here only to sync.
00107    }

void cluster::RIMPlugin::preDraw (  )  [virtual]

Calls any action needed by this plugin before draw().

This function was inherited from the ClusterPlugin abstract class.

Implements cluster::ClusterPlugin.

Definition at line 109 of file RIMPlugin.cpp.

00110    {
00111       // Do nothing we are only here to sync.
00112    }

void cluster::RIMPlugin::sendRequests (  )  [virtual]

Reimplemented from cluster::ClusterPlugin.

Definition at line 119 of file RIMPlugin.cpp.

References gadget::RemoteInputManager::sendDeviceRequests().

00120    {
00121       mRIM.sendDeviceRequests();
00122    }

void cluster::RIMPlugin::postPostFrame (  )  [virtual]

Calls any action needed by this plugin before postFrame().

This function was inherited from the ClusterPlugin abstract class.

Implements cluster::ClusterPlugin.

Definition at line 114 of file RIMPlugin.cpp.

References gadget::RemoteInputManager::sendDataAndSync().

00115    {
00116       mRIM.sendDataAndSync();
00117    }

bool cluster::RIMPlugin::isPluginReady (  )  [virtual]

Returns the status of RIMPlugin.

Returns:
true If plugin is completly configured and has no pending tasks.

Reimplemented from cluster::ClusterPlugin.

Definition at line 234 of file RIMPlugin.cpp.

00235    {
00236       //XXX: Fix this to check for any pending devices. We might want to keep a local
00237       //     copy of this also so that we don't stall when we are waiting for pending
00238       //     RIM requests that are not in the cluster configuration.
00239 
00240       //vpr::Guard<vpr::Mutex> guard(mPendingDeviceRequestsLock);
00241       //return(0 == mPendingDeviceRequests.size());
00242       return true;
00243    }

virtual std::string cluster::RIMPlugin::getPluginName (  )  [inline, virtual]

Returns the name of the this plugin.

Implements cluster::ClusterPlugin.

Definition at line 115 of file RIMPlugin.h.

00116    {
00117       return(std::string("RIMPlugin"));
00118    }

virtual std::string cluster::RIMPlugin::getHandlerName (  )  [inline, virtual]

Implements gadget::PacketHandler.

Definition at line 120 of file RIMPlugin.h.

00121    {
00122       return(std::string("RIMPlugin"));
00123    }

bool cluster::RIMPlugin::configAdd ( jccl::ConfigElementPtr  element  )  [virtual]

Add the pending element to the configuration.

Precondition:
configCanHandle (element) == true.
Returns:
true iff element was successfully added to configuration.

Implements cluster::ClusterPlugin.

Definition at line 132 of file RIMPlugin.cpp.

References gadget::RemoteInputManager::addPendingDeviceRequest(), gadgetDBG_RIM(), getHandlerGUID(), and cluster::ClusterPlugin::setActive().

00133    {
00134       // XXX: We may still use this to handle the configuration 
00135       //      of clustered RIM connections.
00136       if ( ClusterManager::instance()->recognizeRemoteDeviceConfig(element) )
00137       {
00138          std::string device_host = element->getProperty<std::string>("device_host");
00139          gadget::Node* node = ClusterManager::instance()->getNetwork()->getNodeByName(device_host);
00140          std::string device_name = element->getName();
00141 
00142          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00143             << clrOutBOLD(clrCYAN,"[RIMPlugin] ")
00144             << "Adding the Remote Device: " << device_name
00145             << " to the RIM Pending List"
00146             << std::endl << vprDEBUG_FLUSH;
00147 
00148          if ( node == NULL )
00149          {
00150             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
00151                << clrOutBOLD(clrCYAN,"[RIMPlugin] ")
00152                << clrOutBOLD(clrRED, "WARNING:") << " Cluster node: " << device_host
00153                << " does not exist, there must be an error in the ClusterDepChecker."
00154                << std::endl << vprDEBUG_FLUSH;
00155             return false;
00156          }
00157          else if ( !node->isConnected() )
00158          {
00159             vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00160                << clrOutBOLD(clrCYAN,"[RIMPlugin] ")
00161                << clrOutBOLD(clrRED, "WARNING:") << " Cluster node: " << device_host
00162                << " is not connected, there must be an error in the ClusterDepChecker."
00163                << std::endl << vprDEBUG_FLUSH;
00164             return false;
00165          }
00166 
00167          DeviceRequest* device_req = new DeviceRequest(getHandlerGUID(), device_name);
00168          mRIM.addPendingDeviceRequest(device_req, node);
00169          setActive(true);
00170          return(true);
00171       }
00172       else
00173       {
00174          vprDEBUG(gadgetDBG_RIM,vprDBG_CRITICAL_LVL)
00175             << clrOutBOLD(clrCYAN,"[RIMPlugin] ")
00176             << clrOutBOLD(clrRED, "ERROR: ")
00177             << "recognizeRemoteDeviceConfig is broken."
00178             << std::endl << vprDEBUG_FLUSH;
00179          return(false);
00180       }
00181    }

bool cluster::RIMPlugin::configRemove ( jccl::ConfigElementPtr  element  )  [virtual]

Remove the pending element from the current configuration.

Precondition:
configCanHandle (element) == true.
Returns:
true iff the element (and any objects it represented) were successfully removed.

Implements cluster::ClusterPlugin.

Definition at line 189 of file RIMPlugin.cpp.

00190    {
00191       boost::ignore_unused_variable_warning(element);
00192       return false;
00193 
00194       // XXX: We may still use this to handle the configuration 
00195       //      of clustered RIM connections.
00196       /*
00197       if ( ClusterManager::instance()->recognizeRemoteDeviceConfig(element) )
00198       {
00199          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL) << clrOutBOLD(clrCYAN,"[RIMPlugin] ")
00200          << "Removing the Remote Device: " << element->getName()
00201          << " from the active configuration \n" << vprDEBUG_FLUSH;
00202 
00203          removeVirtualDevice(element->getName());
00204          if ( this->mVirtualDevices.size()== 0 && mDeviceServers.size() == 0 )
00205          {
00206             setActive(false);
00207          }
00208          return(true);
00209       }
00210       else
00211       {
00212          vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00213             << "[RIMPlugin::configRemove] ERROR, Something is seriously wrong, we should never get here\n"
00214             << vprDEBUG_FLUSH;
00215          return(false);
00216       }
00217       */
00218    }

bool cluster::RIMPlugin::configCanHandle ( jccl::ConfigElementPtr  element  )  [virtual]

Checks if this handler can process element.

Typically, an implementation of handler will check the element's description name/token to decide if it knows how to deal with it.

Returns:
true iff this handler can process element.

Implements cluster::ClusterPlugin.

Definition at line 227 of file RIMPlugin.cpp.

00228    {
00229       // XXX: We may still use this to handle the configuration 
00230       //      of clustered RIM connections.
00231       return ClusterManager::instance()->recognizeRemoteDeviceConfig(element);
00232    }

jccl::ConfigElementPtr cluster::RIMPlugin::getConfigElementPointer ( std::string &  name  ) 


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