Version: 8.3.0
YACS::ENGINE::CORBANode Class Reference

Class for CORBA Service Node. More...

#include <CORBANode.hxx>

Inheritance diagram for YACS::ENGINE::CORBANode:
Collaboration diagram for YACS::ENGINE::CORBANode:

Public Member Functions

 CORBANode (const CORBANode &other, ComposedNode *father)
 
 CORBANode (const std::string &name)
 CORBANode constructor. More...
 
virtual void execute ()
 Execute the service on the component associated to the node. More...
 
virtual ServiceNodecreateNode (const std::string &name)
 Create a CORBANode with the same component object and no input or output port. More...
 
virtual std::string getKind () const
 Return the service node kind. More...
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::ServiceNode
virtual void load ()
 Load the component associated to the node. More...
 
virtual bool isDeployable () const
 By definition of ServiceNode class. More...
 
virtual void setComponent (ComponentInstance *compo) throw (Exception)
 Associate an existing component instance to this service node AND check the consistency regarding the deployment from root node point of view. More...
 
virtual ComponentInstancegetComponent ()
 Return the associated component instance. More...
 
virtual const ComponentInstancegetComponent () const
 
virtual ContainergetContainer ()
 Return the associated container. More...
 
virtual void setRef (const std::string &ref)
 Associate a new component instance to this service node. More...
 
virtual std::string getRef ()
 
virtual void setMethod (const std::string &method)
 
virtual std::string getMethod ()
 
virtual ~ServiceNode ()
 
virtual void accept (Visitor *visitor)
 
- Public Member Functions inherited from YACS::ENGINE::ElementaryNode
virtual ~ElementaryNode ()
 
void exUpdateState ()
 Update the node state. More...
 
void init (bool start=true)
 
YACS::StatesForNode getState () const
 
void getReadyTasks (std::vector< Task * > &tasks)
 
void edRemovePort (Port *port) throw (Exception)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const throw (Exception)
 
virtual void checkBasicConsistency () const throw (Exception)
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const throw (Exception)
 
std::string getOutPortName (const OutPort *) const throw (Exception)
 
InputPortgetInputPort (const std::string &name) const throw (Exception)
 
OutputPortgetOutputPort (const std::string &name) const throw (Exception)
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 
virtual std::vector< std::pair
< OutPort *, InPort * > > 
getSetOfLinksLeavingCurrentScope () const
 
virtual std::vector< std::pair
< InPort *, OutPort * > > 
getSetOfLinksComingInCurrentScope () const
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const throw (Exception)
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const throw (Exception)
 
virtual InputPortcreateInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual OutputPortcreateOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortcreateInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortcreateOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual InputPortedAddInputPort (const std::string &inputPortName, TypeCode *type) throw (Exception)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type) throw (Exception)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type) throw (Exception)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type) throw (Exception)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
int getMaxLevelOfParallelism () const
 
void begin ()
 
bool isReady ()
 
void finished ()
 
void aborted ()
 
void loaded ()
 Notify this node that it is loaded. More...
 
void connected ()
 Notify this node that it is connected. More...
 
virtual std::string getErrorDetails ()
 Give a description of error when node status is ERROR. More...
 
virtual void initService ()
 
virtual void connectService ()
 
virtual void disconnectService ()
 
virtual void getCoupledTasks (std::set< Task * > &coupledSet)
 Calls getCoupledNodes for Task interface. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledSet)
 Put all nodes that are coupled to this node in coupledSet. More...
 
virtual void addDatastreamPortToInitMultiService (const std::string &port_name, int number)
 
template<class PORT >
void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const throw (Exception)
 
InPropertyPortgetInPropertyPort () const throw (Exception)
 
virtual OutPortgetOutPort (const std::string &name) const throw (Exception)
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
virtual ComposedNodegetRootNode () const throw (Exception)
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 
std::map< std::string,
std::string > 
getProperties ()
 
std::map< std::string,
std::string > 
getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair
< std::string, int > > 
getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual ~Task ()
 

Static Public Attributes

static const char KIND [] ="CORBA"
 
static const char IMPL_NAME [] ="CORBA"
 
- Static Public Attributes inherited from YACS::ENGINE::ServiceNode
static const char KIND [] =""
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 Clone the node : must also clone the component instance ? More...
 
- Protected Member Functions inherited from YACS::ENGINE::ServiceNode
 ServiceNode (const std::string &name)
 
 ServiceNode (const ServiceNode &other, ComposedNode *father)
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
- Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
 ElementaryNode (const std::string &name)
 
 ElementaryNode (const ElementaryNode &other, ComposedNode *father)
 
void initCommonPartWithoutStateManagement (bool start)
 
virtual void createMultiDatastreamPorts ()
 
void edDisconnectAllLinksWithMe ()
 
bool areAllInputPortsValid () const
 
template<class PORT >
PORT * getPort (const std::string &name, const std::list< PORT * > &setOfPorts) const throw (Exception)
 
template<class PORT , class ENUMTYPE >
PORT * edAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
template<class PORT , class ENUMTYPE >
bool edCheckAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
template<class PORT >
static void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Protected Attributes inherited from YACS::ENGINE::ServiceNode
ComponentInstance_component
 
std::string _method
 
std::string _ref
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Class for CORBA Service Node.

See Also
InputCorbaPort
OutputCorbaPort

Definition at line 44 of file CORBANode.hxx.

Constructor & Destructor Documentation

CORBANode::CORBANode ( const CORBANode other,
ComposedNode father 
)

Definition at line 72 of file CORBANode.cxx.

References YACS::ENGINE::Node::_implementation, and IMPL_NAME.

Referenced by createNode(), and simpleClone().

72  :ServiceNode(other,father)
73 {
75 }
CORBANode::CORBANode ( const std::string &  name)

CORBANode constructor.

Definition at line 67 of file CORBANode.cxx.

References YACS::ENGINE::Node::_implementation, and IMPL_NAME.

67  : ServiceNode(name)
68 {
70 }

Member Function Documentation

ServiceNode * CORBANode::createNode ( const std::string &  name)
virtual

Create a CORBANode with the same component object and no input or output port.

Parameters
name: node name
Returns
a new CORBANode node

Implements YACS::ENGINE::ServiceNode.

Definition at line 263 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, CORBANode(), and YACS::ENGINE::ServiceNode::setComponent().

264 {
265 
266  CORBANode* node= new CORBANode(name);
267  node->setComponent(_component);
268  return node;
269 }
void CORBANode::execute ( )
virtual

Execute the service on the component associated to the node.

Implements YACS::ENGINE::Task.

Definition at line 78 of file CORBANode.cxx.

References YACS::ENGINE::ServiceNode::_component, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::ServiceNode::_method, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, gui.CONNECTOR::b, YACS::ENGINE::Bool, DEBTRACE, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::InputCorbaPort::getAny(), YACS::ENGINE::OutputCorbaPort::getAny(), YACS::ENGINE::OutputCorbaPort::getAnyOut(), YACS::ENGINE::DataPort::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Int, YACS::ENGINE::TypeCode::kind(), YACS::ENGINE::Objref, p, YACS::ENGINE::OutputCorbaPort::put(), YACS::ENGINE::String, and YACSTRACE.

79 {
80  YACSTRACE(1, "+++++++++++++ CorbaNode::execute: " << getName() << " +++++++++++++++" );
81  {
82  //DII request building :
83  // a service gets all its in parameters first
84  // then all its out parameters
85  // no inout parameters
86  // the return value (if any) is the first out parameter
87  // not yet user exception (only CORBA exception)
88 
89  CORBA::Object_var objComponent=((CORBAComponent*)_component)->getCompoPtr();
90  CORBA::Request_var req = objComponent->_request(_method.c_str());
91  CORBA::NVList_ptr arguments = req->arguments() ;
92 
93  DEBTRACE( "+++++++++++++++++CorbaNode::inputs+++++++++++++++++" )
94  int in_param=0;
95  //in parameters
96  list<InputPort *>::iterator iter2;
97  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
98  {
99  InputCorbaPort *p=(InputCorbaPort *)*iter2;
100  DEBTRACE( "port name: " << p->getName() )
101  DEBTRACE( "port kind: " << p->edGetType()->kind() )
102  CORBA::Any* ob=p->getAny();
103 #ifdef _DEVDEBUG_
104  CORBA::TypeCode_var typcod= ob->type();
105  switch(p->edGetType()->kind())
106  {
107  case Double:
108  CORBA::Double d;
109  *ob >>= d;
110  DEBTRACE( d )
111  break;
112  case Int:
113  CORBA::Long l;
114  *ob >>= l;
115  DEBTRACE( l )
116  break;
117  case String:
118  const char *s;
119  *ob >>= s;
120  DEBTRACE( s )
121  break;
122  case Bool:
123  CORBA::Boolean b;
124  if(*ob >>= CORBA::Any::to_boolean(b))
125  DEBTRACE( b )
126  else
127  DEBTRACE( "not a boolean" )
128  break;
129  case Objref:
130  DEBTRACE( typcod->id() )
131  break;
132  default:
133  break;
134  }
135 #endif
136  //add_value makes a copy of any (*ob). This copy will be deleted with the request
137  arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
138  in_param=in_param+1;
139  }
140 
141  //output parameters
142  DEBTRACE( "+++++++++++++++++CorbaNode::outputs+++++++++++++++++" )
143  list<OutputPort *>::iterator iter;
144  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
145  {
146  OutputCorbaPort *p=(OutputCorbaPort *)*iter;
147  DEBTRACE( "port name: " << p->getName() )
148  DEBTRACE( "port kind: " << p->edGetType()->kind() )
149  CORBA::Any* ob=p->getAnyOut();
150 #ifdef REFCNT
151  DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
152 #endif
153  //add_value makes a copy of any. Copy will be deleted with request
154  arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
155 #ifdef REFCNT
156  DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
157 #endif
158  delete ob;
159  }
160 
161  //return value
162  req->set_return_type(CORBA::_tc_void);
163 
164  DEBTRACE( "+++++++++++++++++CorbaNode::calculation+++++++++++++++++" << _method )
165  req->invoke();
166  CORBA::Exception *exc =req->env()->exception();
167  if( exc )
168  {
169  DEBTRACE( "An exception was thrown!" )
170  DEBTRACE( "The raised exception is of Type:" << exc->_name() )
171 
172  std::cerr << "The raised exception is of Type:" << exc->_name() << std::endl;
173  /*
174  if(strcmp(exc->_name(),"MARSHAL") == 0)
175  {
176  const char* ms = ((CORBA::MARSHAL*)exc)->NP_minorString();
177  if (ms)
178  std::cerr << "(CORBA::MARSHAL: minor = " << ms << ")" << std::endl;
179  else
180  std::cerr << "(CORBA::MARSHAL: minor = " << ((CORBA::MARSHAL*)exc)->minor() << ")" << std::endl;
181  }
182  */
183  _errorDetails="Execution problem: the raised exception is of Type:";
184  _errorDetails += exc->_name();
185  throw Exception("Execution problem");
186  }
187 
188  DEBTRACE( "++++++++++++CorbaNode::outputs++++++++++++" )
189  int out_param=in_param;
190  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
191  {
192  OutputCorbaPort *p=(OutputCorbaPort *)*iter;
193  DEBTRACE( "port name: " << p->getName() )
194  DEBTRACE( "port kind: " << p->edGetType()->kind() )
195  DEBTRACE( "port number: " << out_param )
196  CORBA::Any *ob=arguments->item(out_param)->value();
197 #ifdef REFCNT
198  DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
199 #endif
200 #ifdef _DEVDEBUG_
201  CORBA::TypeCode_var tc=ob->type();
202  switch(p->edGetType()->kind())
203  {
204  case Double:
205  CORBA::Double d;
206  *ob >>= d;
207  DEBTRACE( d )
208  break;
209  case Int:
210  CORBA::Long l;
211  *ob >>= l;
212  DEBTRACE( l )
213  break;
214  case String:
215  const char *s;
216  *ob >>= s;
217  DEBTRACE( s )
218  break;
219  case Objref:
220  DEBTRACE( tc->id() )
221  break;
222  default:
223  break;
224  }
225 #endif
226  //OutputPort must copy the input Any(ob).
227  //This Any will be deleted with the request.
228  //Copy is made by the method put.
229  p->put(ob);
230  out_param=out_param+1;
231 #ifdef REFCNT
232  DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
233 #endif
234  }
235  DEBTRACE( "++++++++++++++++++++++++++++++++++++++++++" )
236  }
237  //Request has been deleted (_var )
238  //All anys given to the request are deleted : don't forget to copy them
239  //if you want to keep them
240 #ifdef REFCNT
241  list<OutputPort *>::const_iterator iter;
242  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
243  {
244  OutputCorbaPort *p=(OutputCorbaPort *)*iter;
245  CORBA::Any *ob=p->getAny();
246  DEBTRACE("refcount CORBA : " << ((omni::TypeCode_base*)ob->pd_tc.in())->pd_ref_count);
247  }
248 #endif
249  DEBTRACE( "+++++++++++++++++ End CorbaNode::execute: " << getName() << " +++++++++++++++++" )
250 }
std::string CORBANode::getKind ( ) const
virtual

Return the service node kind.

A runtime can provide several implementations of a service node. Each implementation has a different kind. A ComponentInstance can be associated to a ServiceNode with the same kind.

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 61 of file CORBANode.cxx.

62 {
63  return KIND;
64 }
Node * CORBANode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Clone the node : must also clone the component instance ?

Implements YACS::ENGINE::Node.

Definition at line 253 of file CORBANode.cxx.

References CORBANode().

254 {
255  return new CORBANode(*this,father);
256 }
virtual std::string YACS::ENGINE::CORBANode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 55 of file CORBANode.hxx.

55 {return "YACS__ENGINE__CORBANode";}

Member Data Documentation

const char CORBANode::IMPL_NAME ="CORBA"
static

Definition at line 57 of file CORBANode.hxx.

Referenced by CORBANode(), and YACS::ENGINE::SalomeNode::SalomeNode().

const char CORBANode::KIND ="CORBA"
static

Definition at line 54 of file CORBANode.hxx.


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