PaCO++  0.05
InterfaceManager_impl Class Reference

#include <PaCO++_src.h>

Collaboration diagram for InterfaceManager_impl:

List of all members.

Public Member Functions

virtual void finish ()=0
virtual CORBA::Short getClientId ()=0
virtual PaCO::ConnectionInfosgetConnectionInfos ()
virtual char * getReturn ()
 InterfaceManager_impl (CORBA::ORB_ptr current_orb)
virtual void return_ok (const CORBA::Short client_id)
virtual void setConnectionInfos ()
virtual void setNewNode (const char *node, const CORBA::Short rank)
virtual void setReturn (const char *ref)
void setReturn (int rtn)
virtual void setTopo (const PaCO::PacoTopology_t &topo)
virtual void setTotalNode (CORBA::Short totalNode)
virtual void setWorkNode (CORBA::Short totalNode)
virtual void updateContexts ()=0
virtual ~InterfaceManager_impl ()

Protected Attributes

CORBA::Short _current_uid
PaCO::ConnectionInfos _informations
PaCO::ConnectionInfos _informations_temp
PaCO::ConnectionInfos::_nodes_seq _nodes
CORBA::ORB_ptr _orb
int _rtn
CORBA::Short _totalNode
CORBA::Short _totalNodeReceived
CORBA::Short _workNode
string return_str
PaCO::PacoTopology_t serveur_topo

Detailed Description

Definition at line 17 of file PaCO++_src.h.


Constructor & Destructor Documentation

InterfaceManager_impl::InterfaceManager_impl ( CORBA::ORB_ptr  current_orb)

Definition at line 41 of file PaCO++_src.cc.

References _current_uid, _orb, _rtn, _totalNode, _totalNodeReceived, and _workNode.

{
  _orb = current_orb;
  _current_uid = 0;
  _totalNode = -1;
  _workNode = -1;
  _totalNodeReceived = 0;
  _rtn = 0; // normal
}

Definition at line 51 of file PaCO++_src.cc.

{}

Member Function Documentation

virtual void InterfaceManager_impl::finish ( ) [pure virtual]

Referenced by setConnectionInfos(), and setNewNode().

virtual CORBA::Short InterfaceManager_impl::getClientId ( ) [pure virtual]

Definition at line 251 of file PaCO++_src.cc.

References _current_uid, _informations, and PaCO::ConnectionInfos::request_uid.

{
//  cerr << "In "<<__FUNCTION__ << ":"<<(void*)this<<endl;
  _current_uid++;
  _informations.request_uid = _current_uid;
  PaCO::ConnectionInfos* retour = new PaCO::ConnectionInfos(_informations);
 // cerr << "Out "<<__FUNCTION__ << ":"<<(void*)this<<endl;
  return retour;
}
char * InterfaceManager_impl::getReturn ( ) [virtual]

Definition at line 151 of file PaCO++_src.cc.

References return_str.

{
  //  cerr << " Return string : " << return_str << endl;
  char * p = new char[return_str.length()+1];
  return_str.copy(p,string::npos);
  p[return_str.length()]=0;
  //  return (char *) return_str.c_str();
  return p;
}
void InterfaceManager_impl::return_ok ( const CORBA::Short  client_id) [virtual]

Definition at line 168 of file PaCO++_src.cc.

References _nodes, _orb, and _workNode.

{
  CORBA::ULong i;
  CORBA::Object_var object;
  PaCO::InterfaceParallel_var interface;
  CORBA::ULong lgth;
  if (_workNode == -1) { lgth = _nodes.length();}
  else { lgth = _workNode;}
  cerr << "Adding a new client !!!!" << endl;
  //  cerr << "WARNING : in this version PaCO++ only plays with the last client !" << endl;
  for (i = 0; i<lgth; i++)
    {
      //cerr << "Init work node : " << i << endl;
      object = _orb->string_to_object(_nodes[i]);
      interface = PaCO::InterfaceParallel::_narrow(object);
      interface->connect_return_object(client_id);
    }
}

Definition at line 188 of file PaCO++_src.cc.

References _informations, _nodes, _orb, _rtn, _workNode, finish(), and PaCO::ConnectionInfos::serveur_topo.

Referenced by setNewNode().

{
  if (_rtn == 1)
    cerr << "Return Proxy : Deploy the parallel CORBA object" << endl;
  else 
    cerr << "Deploy the parallel CORBA object" << endl;

  // Initialize the nodes
  CORBA::Object_var object;
  PaCO::InterfaceParallel_var interface;
  if (_workNode == -1)
    {
      if (_rtn == 1)
   cerr << "Return Proxy : Deploying all the nodes" << endl;
      else
   cerr << "Deploying all the nodes" << endl;

      for (  CORBA::ULong i = 0; i<_nodes.length(); i++)
   {
     if (_rtn == 1)
       cerr << "Return Proxy : Deploying node : " << i << endl;
     else
       cerr << "Deploying node : " << i << endl;

     object = _orb->string_to_object(_nodes[i]);
     interface = PaCO::InterfaceParallel::_narrow(object);
     interface->init_InterfaceParallel(i,_nodes.length(), _informations.serveur_topo);

     if (_rtn == 0)
       {
         cerr << "Exception handling part..." << endl;
         PaCO::InterfaceParallel::ref ref_nodes;
         ref_nodes.length(_nodes.length());
         for (CORBA::ULong j = 0; j<_nodes.length(); j++)
      {
        ref_nodes[j] = _nodes[j];
      }
         interface->setRef(ref_nodes);
         cerr << "Exception handling part...done" << endl;
       }
   }
    }
  else
    {
      cerr << "Deploying " << _workNode << " nodes" << endl;
      for (  CORBA::Long i = 0; i<_workNode; i++)
   {
     cerr << "Deploying node : " << i << endl;
     object = _orb->string_to_object(_nodes[i]);
     interface = PaCO::InterfaceParallel::_narrow(object);
     interface->init_InterfaceParallel(i,_nodes.length(), _informations.serveur_topo);
   }
    }
  if (_rtn == 0)
    {
      // connecting the client to the interface manager
      cerr << "Finishing...\n";
      this->finish();
      cerr << "Finishing...done\n";
    }
}

Here is the call graph for this function:

void InterfaceManager_impl::setNewNode ( const char *  node,
const CORBA::Short  rank 
) [virtual]

Definition at line 88 of file PaCO++_src.cc.

References _informations, _informations_temp, _nodes, _rtn, _totalNode, _totalNodeReceived, finish(), PaCO::ConnectionInfos::nodes, PaCO::ConnectionInfos::serveur_topo, and setConnectionInfos().

{

try  
  {
    //CORBA::Object_var object = _orb->string_to_object(node);
    //PaCO::InterfaceParallel_var interface = PaCO::InterfaceParallel::_narrow(object);
    //  CORBA::Short rank = interface->getDeployRank();

  if (_rtn == 1)
    cerr << "Return Proxy : Adding node : " << rank << endl;
  else
    cerr << "Adding node : " << rank << endl;
  //  _informations_temp.nodes[_totalNodeReceived] = node;
  _informations_temp.nodes[rank] = node;
  _totalNodeReceived++;
  if (_totalNodeReceived == _totalNode)
    {
       if (_rtn == 1)
    cerr << "Return Proxy : All the node are registered" << endl;
       else
    cerr << "All the node are registered" << endl;

      _nodes = _informations_temp.nodes;
      _informations.nodes = _nodes;
      _informations.serveur_topo = _informations_temp.serveur_topo;
      if (_rtn == 1)
   {
     // connection for the server side
     this->finish();
   }
      _totalNodeReceived = 0;
      setConnectionInfos();
    }
  }
 catch (const CORBA::Exception & e)
    {
      cerr << " Node : " << node << endl;
      cerr << " InterfaceManager_impl::setNewNode : Exception : " << e << endl;
    }

}

Here is the call graph for this function:

void InterfaceManager_impl::setReturn ( const char *  ref) [virtual]

Definition at line 132 of file PaCO++_src.cc.

References _nodes, _orb, _workNode, and return_str.

{
  return_str = (char *) ref;
  // Now we have to give this reference to all the nodes
  CORBA::ULong i;
  CORBA::Object_var object;
  PaCO::InterfaceParallel_var interface;
  CORBA::ULong lgth;
  if (_workNode == -1) { lgth = _nodes.length();}
  else { lgth = _workNode;}
  for (i = 0; i<lgth; i++)
    {
      object = _orb->string_to_object(_nodes[i]);
      interface = PaCO::InterfaceParallel::_narrow(object);
      interface->refReturnObject(return_str.c_str());
    }
}

Definition at line 54 of file PaCO++_src.cc.

References _rtn.

{
  _rtn = rtn;
}
void InterfaceManager_impl::setTopo ( const PaCO::PacoTopology_t topo) [virtual]

obsolete

Definition at line 75 of file PaCO++_src.cc.

References serveur_topo, setTotalNode(), and PaCO::PacoTopology_s::total.

{
  serveur_topo = topo;
  setTotalNode(topo.total);
}

Here is the call graph for this function:

void InterfaceManager_impl::setTotalNode ( CORBA::Short  totalNode) [virtual]

Definition at line 60 of file PaCO++_src.cc.

References _informations, _informations_temp, _totalNode, PaCO::ConnectionInfos::nodes, PaCO::ConnectionInfos::serveur_topo, PaCO::PacoTopology_s::total, and updateContexts().

Referenced by setTopo().

Here is the call graph for this function:

void InterfaceManager_impl::setWorkNode ( CORBA::Short  totalNode) [virtual]

Definition at line 82 of file PaCO++_src.cc.

References _workNode.

{
  _workNode = totalNode;
}
virtual void InterfaceManager_impl::updateContexts ( ) [pure virtual]

Referenced by setTotalNode().


Member Data Documentation

CORBA::Short InterfaceManager_impl::_current_uid [protected]

Definition at line 48 of file PaCO++_src.h.

Referenced by getConnectionInfos(), and InterfaceManager_impl().

PaCO::ConnectionInfos::_nodes_seq InterfaceManager_impl::_nodes [protected]

Definition at line 47 of file PaCO++_src.h.

Referenced by return_ok(), setConnectionInfos(), setNewNode(), and setReturn().

CORBA::ORB_ptr InterfaceManager_impl::_orb [protected]

Definition at line 46 of file PaCO++_src.h.

Referenced by InterfaceManager_impl(), return_ok(), setConnectionInfos(), and setReturn().

int InterfaceManager_impl::_rtn [protected]

Definition at line 56 of file PaCO++_src.h.

Referenced by InterfaceManager_impl(), setConnectionInfos(), setNewNode(), and setReturn().

CORBA::Short InterfaceManager_impl::_totalNode [protected]

Definition at line 49 of file PaCO++_src.h.

Referenced by InterfaceManager_impl(), setNewNode(), and setTotalNode().

Definition at line 50 of file PaCO++_src.h.

Referenced by InterfaceManager_impl(), and setNewNode().

CORBA::Short InterfaceManager_impl::_workNode [protected]

Definition at line 55 of file PaCO++_src.h.

Referenced by getReturn(), and setReturn().

Definition at line 54 of file PaCO++_src.h.

Referenced by setTopo().


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