Version: 9.15.0
YACS::ENGINE::SalomeNode Class Reference

Class for Salome component Service Node. More...

#include <CORBANode.hxx>

Inheritance diagram for YACS::ENGINE::SalomeNode:
Collaboration diagram for YACS::ENGINE::SalomeNode:

Public Member Functions

 SalomeNode (const SalomeNode &other, ComposedNode *father)
 
 SalomeNode (const std::string &name)
 SalomeNode constructor. More...
 
virtual ~SalomeNode ()
 
virtual void execute ()
 Execute the service on the component associated to the node. More...
 
virtual ServiceNodecreateNode (const std::string &name)
 Create a SalomeNode 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 ()
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
- 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)
 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)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const
 
virtual void checkBasicConsistency () const
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const
 
std::string getOutPortName (const OutPort *) const
 
InputPortgetInputPort (const std::string &name) const
 
OutputPortgetOutputPort (const std::string &name) const
 
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
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
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)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
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
 
ComplexWeightgetWeight ()
 
void setWeight (double elementaryWeight)
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
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)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
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...
 
void writeDotInFile (const std::string &fileName) const
 
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
 
InPropertyPortgetInPropertyPort () const
 
virtual OutPortgetOutPort (const std::string &name) const
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
virtual ComposedNodegetRootNode () const
 
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 void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual void imposeResource (const std::string &resource_name, const std::string &container_name)
 
virtual bool canAcceptImposedResource ()
 
virtual bool hasImposedResource () const
 
virtual ~Task ()
 

Static Public Attributes

static const char KIND [] ="Salome"
 
- Static Public Attributes inherited from YACS::ENGINE::ServiceNode
static const char KIND [] =""
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 
- 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
 
template<class PORT , class ENUMTYPE >
PORT * edAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
 
template<class PORT , class ENUMTYPE >
bool edCheckAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type)
 
- 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 ()
 

Private Attributes

YACS::BASES::Mutex _mutex
 

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...
 
static void checkValidityOfNodeName (const std::string &name)
 
- 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)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Static Protected Member Functions inherited from YACS::ENGINE::Node
static void checkValidityOfPortName (const std::string &name)
 
static ComposedNodecheckHavingCommonFather (Node *node1, Node *node2)
 
- Protected Attributes inherited from YACS::ENGINE::ServiceNode
ComponentInstance_component
 
std::string _method
 
std::string _ref
 
- Protected Attributes inherited from YACS::ENGINE::ElementaryNode
std::list< InputPort * > _setOfInputPort
 
std::list< OutputPort * > _setOfOutputPort
 
std::list< InputDataStreamPort * > _setOfInputDataStreamPort
 
std::list< OutputDataStreamPort * > _setOfOutputDataStreamPort
 
ComplexWeight _weight
 
bool _createDatastreamPorts
 
bool _multi_port_node
 
- Protected Attributes inherited from YACS::ENGINE::Node
InGate _inGate
 
OutGate _outGate
 
InPropertyPort_inPropertyPort
 
std::string _name
 
ComposedNode_father
 
YACS::StatesForNode _state
 
int _modified
 
std::string _errorDetails
 
int _numId
 
std::string _implementation
 
std::map< std::string, std::string > _propertyMap
 
Node_eventReceiver =nullptr
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Class for Salome component Service Node.

See also
InputCorbaPort
OutputCorbaPort

Definition at line 67 of file CORBANode.hxx.

Constructor & Destructor Documentation

◆ SalomeNode() [1/2]

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

Definition at line 286 of file CORBANode.cxx.

286  :ServiceNode(other,father)
287 {
289 }
static const char IMPL_NAME[]
Definition: CORBANode.hxx:57
std::string _implementation
Definition: Node.hxx:97
ServiceNode(const std::string &name)
Definition: ServiceNode.cxx:55

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

Referenced by createNode(), and simpleClone().

◆ SalomeNode() [2/2]

SalomeNode::SalomeNode ( const std::string &  name)

SalomeNode constructor.

Definition at line 281 of file CORBANode.cxx.

281  :ServiceNode(name)
282 {
284 }

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

◆ ~SalomeNode()

SalomeNode::~SalomeNode ( )
virtual

Definition at line 291 of file CORBANode.cxx.

292 {
293 }

Member Function Documentation

◆ createNode()

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

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

Parameters
name: node name
Returns
a new SalomeNode node

Implements YACS::ENGINE::ServiceNode.

Definition at line 844 of file CORBANode.cxx.

845 {
846  SalomeNode* node=new SalomeNode(name);
847  node->setComponent(_component);
848  return node;
849 }
Class for Salome component Service Node.
Definition: CORBANode.hxx:68
SalomeNode(const SalomeNode &other, ComposedNode *father)
Definition: CORBANode.cxx:286
ComponentInstance * _component
Definition: ServiceNode.hxx:60
virtual void setComponent(ComponentInstance *compo)
Associate an existing component instance to this service node AND check the consistency regarding the...

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

◆ execute()

void SalomeNode::execute ( )
virtual

Execute the service on the component associated to the node.

Implements YACS::ENGINE::Task.

Definition at line 518 of file CORBANode.cxx.

519 {
520  YACSTRACE(1,"+++++++++++++++++ SalomeNode::execute: " << getName() << " " << _method << " +++++++++++++++++" );
521  {
522  CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
523  Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
524 
525  // Set component properties
526  std::map<std::string,std::string> amap=getProperties();
527  if(amap.size() > 0)
528  {
529  Engines::FieldsDict_var dico = new Engines::FieldsDict;
530  dico->length(amap.size());
531  std::map<std::string,std::string>::const_iterator it;
532  int i=0;
533  for(it = amap.begin(); it != amap.end(); ++it)
534  {
535  dico[i].key=CORBA::string_dup(it->first.c_str());
536  dico[i].value <<=it->second.c_str();
537  i++;
538  }
539  compo->setProperties(dico);
540  }
541 
542  //DII request building :
543  // a service gets all its in parameters first
544  // then all its out parameters
545  // no inout parameters
546  // the return value (if any) is the first out parameter
547  //
548  CORBA::Request_var req ;
549  try
550  {
551  req = objComponent->_request(_method.c_str());
552  }
553  catch(CORBA::SystemException& ex)
554  {
555  std::string msg="component '" +_ref+ "' has no service '" + _method+ "'";
556  _errorDetails=msg;
557  throw Exception(msg);
558  }
559  CORBA::NVList_ptr arguments = req->arguments() ;
560 
561  DEBTRACE( "+++++++++++++++++SalomeNode::inputs+++++++++++++++++" );
562  int in_param=0;
563  //in parameters
564  list<InputPort *>::iterator iter2;
565  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
566  {
567  InputCorbaPort *p=(InputCorbaPort *)*iter2;
568  if(p->edGetType()->isA(Runtime::_tc_file))
569  continue;
570  DEBTRACE( "port name: " << p->getName() );
571  DEBTRACE( "port kind: " << p->edGetType()->kind() );
572  CORBA::Any* ob=p->getAny();
573 #ifdef _DEVDEBUG_
574  CORBA::TypeCode_var tc=ob->type();
575  switch(p->edGetType()->kind())
576  {
577  case Double:
578  CORBA::Double d;
579  *ob >>= d;
580  DEBTRACE( d )
581  break;
582  case Int:
583  CORBA::Long l;
584  *ob >>= l;
585  DEBTRACE( l )
586  break;
587  case String:
588  const char *s;
589  *ob >>= s;
590  DEBTRACE( s )
591  break;
592  case Objref:
593  DEBTRACE( tc->id() )
594  break;
595  default:
596  break;
597  }
598 #endif
599  //add_value makes a copy of any. Copy will be deleted with request
600  arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_IN ) ;
601  in_param=in_param+1;
602  }
603  //in files
604  int nfiles=0;
605  DEBTRACE("checkInputFilesToService: " << _method);
606  try
607  {
608  for(iter2 = _setOfInputPort.begin(); iter2 != _setOfInputPort.end(); iter2++)
609  {
610  InputCorbaPort *p=(InputCorbaPort *)*iter2;
611  if(!p->edGetType()->isA(Runtime::_tc_file))
612  continue;
613  std::string filename=p->getName();
614  // replace ':' by '.'. Needed because port name can not contain '.'
615  string::size_type debut =filename.find_first_of(':',0);
616  while(debut != std::string::npos)
617  {
618  filename[debut]='.';
619  debut=filename.find_first_of(':',debut);
620  }
621  DEBTRACE( "inport with file: " << filename );
622  Engines::Salome_file_var isf=compo->setInputFileToService(_method.c_str(),p->getName().c_str());
623  isf->setDistributedFile(filename.c_str());
624  Engines::Salome_file_ptr osf;
625  CORBA::Any* any=p->getAny();
626  *any >>= osf;
627  isf->connect(osf);
628  nfiles++;
629  }
630  if(nfiles)
631  compo->checkInputFilesToService(_method.c_str());
632  }
633  catch( const SALOME::SALOME_Exception& ex )
634  {
635  std::string text="Execution problem in checkInputFilesToService: ";
636  text += (const char*)ex.details.text;
637  _errorDetails=text;
638  throw Exception(text);
639  }
640  catch(CORBA::SystemException& ex)
641  {
642  std::string msg="Execution problem: component probably does not support files ??";
643  _errorDetails=msg;
644  throw Exception(msg);
645  }
646 
647  //out parameters
648  DEBTRACE( "+++++++++++++++++SalomeNode::outputs+++++++++++++++++" )
649  list<OutputPort *>::iterator iter;
650  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
651  {
653  DEBTRACE( "port name: " << p->getName() )
654  DEBTRACE( "port kind: " << p->edGetType()->kind() )
655  if(p->edGetType()->isA(Runtime::_tc_file))
656  continue;
657  CORBA::Any* ob=p->getAnyOut();
658  //add_value makes a copy of any. Copy will be deleted with request
659  arguments->add_value( p->getName().c_str() , *ob , CORBA::ARG_OUT );
660  delete ob;
661  }
662 
663  //return value
664  //if return type is set to void (not mandatory, it's set by default)
665  //the return value will not be marshalled as a return value but
666  //as the first out argument (don't forget to add it as the first output argument)
667  req->set_return_type(CORBA::_tc_void);
668  //user exceptions
669  req->exceptions()->add(SALOME::_tc_SALOME_Exception);
670 
671  DEBTRACE( "+++++++++++++++++SalomeNode::calculation+++++++++++++++++" << _method )
672  req->invoke();
673  CORBA::Exception *exc =req->env()->exception();
674  if( exc )
675  {
676  DEBTRACE( "An exception was thrown!" )
677  DEBTRACE( "The raised exception is of Type:" << exc->_name() )
678 
679  CORBA::SystemException* sysexc;
680  sysexc=CORBA::SystemException::_downcast(exc);
681  if(sysexc != NULL)
682  {
683  // It's a SystemException
684  DEBTRACE( "minor code: " << sysexc->minor() );
685  DEBTRACE( "completion code: " << sysexc->completed() );
686  std::string text="Execution problem: ";
687  std::string excname=sysexc->_name();
688  if(excname == "BAD_OPERATION")
689  {
690  text=text+"component '" +_ref+ "' has no service '" + _method+ "'";
691  }
692  else if(excname == "BAD_PARAM")
693  {
694  text=text+"A parameter (input or output) passed to the call is out of range or otherwise considered illegal.\n";
695  text=text+"Minor code: "+sysexc->NP_minorString();
696  }
697  else if(excname == "MARSHAL" && sysexc->minor() == omni::MARSHAL_PassEndOfMessage)
698  {
699  text=text+"probably an error in arguments of service '" + _method + "' from component '" +_ref+ "'";
700  }
701  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalResults)
702  {
703  text=text+"probably an error in output arguments of service '" + _method + "' from component '" +_ref+ "'";
704  }
705  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_UnMarshalArguments)
706  {
707  text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
708  }
709  else if(excname == "COMM_FAILURE" && sysexc->minor() == omni::COMM_FAILURE_WaitingForReply)
710  {
711  text=text+"probably an error in input arguments of service '" + _method + "' from component '" +_ref+ "'";
712  }
713  else
714  {
715  DEBTRACE(sysexc->NP_minorString() );
716  text=text+"System Exception "+ excname;
717  }
718  _errorDetails=text;
719  throw Exception(text);
720  }
721 
722  // Not a System Exception
723  CORBA::UnknownUserException* userexc;
724  userexc=CORBA::UnknownUserException::_downcast(exc);
725  if(userexc != NULL)
726  {
727  CORBA::Any anyExcept = userexc->exception();
728 
729  const SALOME::SALOME_Exception* salexc;
730  if(anyExcept >>= salexc)
731  {
732  DEBTRACE("SALOME_Exception: "<< salexc->details.sourceFile);
733  DEBTRACE("SALOME_Exception: "<<salexc->details.lineNumber);
734  _errorDetails=salexc->details.text;
735  throw Exception("Execution problem: Salome Exception occurred" + getErrorDetails() );
736  }
737  std::string msg="Execution problem: User Exception occurred";
738  _errorDetails=msg;
739  throw Exception(msg);
740  }
741  std::string msg="Execution problem";
742  _errorDetails=msg;
743  throw Exception(msg);
744  }
745 
746  DEBTRACE( "++++++++++++SalomeNode::outputs++++++++++++" )
747  int out_param=in_param;
748  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
749  {
751  DEBTRACE( "port name: " << p->getName() );
752  DEBTRACE( "port kind: " << p->edGetType()->kind() );
753  DEBTRACE( "port number: " << out_param );
754  if(p->edGetType()->isA(Runtime::_tc_file))
755  continue;
756  CORBA::Any *ob=arguments->item(out_param)->value();
757 #ifdef _DEVDEBUG_
758  switch(p->edGetType()->kind())
759  {
760  case Double:
761  CORBA::Double d;
762  *ob >>= d;
763  DEBTRACE( d )
764  break;
765  case Int:
766  CORBA::Long l;
767  *ob >>= l;
768  DEBTRACE( l )
769  break;
770  case String:
771  const char *s;
772  *ob >>= s;
773  DEBTRACE( s )
774  break;
775  default:
776  break;
777  }
778 #endif
779  //OutputPort must copy the input Any(ob).
780  //This Any will be deleted with the request.
781  //Copy is made by the method put.
782  p->put(ob);
783  out_param=out_param+1;
784  }
785 
786  //Out files
787  nfiles=0;
788  DEBTRACE("checkOutputFilesToService: " << _method);
789  try
790  {
791  for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
792  {
794  if(!p->edGetType()->isA(Runtime::_tc_file))
795  continue;
796  // The output port has a file object : special treatment
797  std::string filename=p->getName();
798  // replace ':' by '.'. Needed because port name can not contain '.'
799  string::size_type debut =filename.find_first_of(':',0);
800  while(debut != std::string::npos)
801  {
802  filename[debut]='.';
803  debut=filename.find_first_of(':',debut);
804  }
805  DEBTRACE( "outport with file: " << filename );
806  Engines::Salome_file_var osf=compo->setOutputFileToService(_method.c_str(),p->getName().c_str());
807  osf->setLocalFile(filename.c_str());
808  CORBA::Any any;
809  any <<= osf;
810  p->put(&any);
811  }
812  if(nfiles)
813  compo->checkOutputFilesToService(_method.c_str());
814  }
815  catch( const SALOME::SALOME_Exception& ex )
816  {
817  std::string text=(const char*)ex.details.text;
818  _errorDetails=text;
819  throw Exception("Execution problem in checkOutputFilesToService: " + text);
820  }
821  catch(CORBA::SystemException& ex)
822  {
823  std::string msg="Execution problem: component probably does not support files ?";
824  _errorDetails=msg;
825  throw Exception(msg);
826  }
827  }
828  //Request has been deleted (_var )
829  //All anys given to the request are deleted : don't forget to copy them
830  //if you want to keep them
831  DEBTRACE( "+++++++++++++++++ End SalomeNode::execute: " << getName() << " +++++++++++++++++" )
832 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
#define YACSTRACE(level, msg)
YACSTRACE macro for dynamic trace: print only if YACS_TRACELEVEL environment variable is set and leve...
Definition: YacsTrace.hxx:41
: Interface for management of storage of data formated dynamically in its TypeCode....
Definition: Any.hxx:79
std::string getName() const
std::list< InputPort * > _setOfInputPort
virtual std::string getErrorDetails()
Give a description of error when node status is ERROR.
std::list< OutputPort * > _setOfOutputPort
Class for CORBA Input Ports.
Definition: CORBAPorts.hxx:45
std::string _name
Definition: Node.hxx:89
std::map< std::string, std::string > getProperties()
Definition: Node.cxx:509
const std::string & getName() const
Definition: Node.hxx:125
std::string _errorDetails
Definition: Node.hxx:93
static YACS::ENGINE::TypeCode * _tc_file
Definition: Runtime.hxx:140
Class for Salome component instance.
Proc * p
Definition: driver.cxx:216

References YACS::ENGINE::ServiceNode::_component, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::ServiceNode::_method, YACS::ENGINE::ServiceNode::_ref, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, YACS::ENGINE::Runtime::_tc_file, DEBTRACE, yacsorb.CORBAEngineTest::dico, YACS::ENGINE::Double, testCppPluginInvokation::ex, YACS::ENGINE::ElementaryNode::getErrorDetails(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::Node::getName(), YACS::ENGINE::Node::getProperties(), yacsorb.CORBAEngineTest::i, YACS::ENGINE::Int, testCppPluginInvokation::l, YACS::ENGINE::Objref, p, YACS::ENGINE::String, and YACSTRACE.

◆ getContainerLog()

std::string SalomeNode::getContainerLog ( )
virtual

returns a string that contains the name of the container log file if it exists

Do nothing here. To subclass

Reimplemented from YACS::ENGINE::Node.

Definition at line 851 of file CORBANode.cxx.

852 {
853  std::string msg="Component is not loaded";
854  try
855  {
856  CORBA::Object_var objComponent=((SalomeComponent*)_component)->getCompoPtr();
857  Engines::EngineComponent_var compo=Engines::EngineComponent::_narrow(objComponent);
858  if( !CORBA::is_nil(compo) )
859  {
860  Engines::Container_var cont= compo->GetContainerRef();
861  CORBA::String_var logname = cont->logfilename();
862  DEBTRACE(logname);
863  msg=logname;
864  std::string::size_type pos = msg.find(":");
865  msg=msg.substr(pos+1);
866  }
867  }
868  catch(CORBA::COMM_FAILURE& ex)
869  {
870  msg = ":Component no longer reachable: Caught system exception COMM_FAILURE";
871  msg += " -- unable to contact the object.";
872  }
873  catch(CORBA::SystemException& ex)
874  {
875  msg = ":Component no longer reachable: Caught a CORBA::SystemException.\n";
876  CORBA::Any tmp;
877  tmp <<= ex;
878  CORBA::TypeCode_var tc = tmp.type();
879  const char *p = tc->name();
880  if ( *p != '\0' )
881  msg += p;
882  else
883  msg += tc->id();
884  }
885  catch(CORBA::Exception& ex)
886  {
887  msg = ":Component no longer reachable: Caught CORBA::Exception.\n";
888  CORBA::Any tmp;
889  tmp <<= ex;
890  CORBA::TypeCode_var tc = tmp.type();
891  const char *p = tc->name();
892  if ( *p != '\0' )
893  msg += p;
894  else
895  msg += tc->id();
896  }
897  catch(omniORB::fatalException& fe)
898  {
899  msg = ":Component no longer reachable: Caught omniORB::fatalException.\n";
900  stringstream log;
901  log << " file: " << fe.file() << endl;
902  log << " line: " << fe.line() << endl;
903  log << " mesg: " << fe.errmsg() << endl;
904  msg += log.str();
905  }
906  catch(...)
907  {
908  msg = ":Component no longer reachable: Caught unknown exception.";
909  }
910  return msg;
911 }
string log
Definition: logview.py:23

References YACS::ENGINE::ServiceNode::_component, DEBTRACE, testCppPluginInvokation::ex, gui.logview::log, and p.

◆ getKind()

std::string SalomeNode::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 275 of file CORBANode.cxx.

276 {
277  return KIND;
278 }
static const char KIND[]
Definition: CORBANode.hxx:78

References KIND.

◆ shutdown()

void SalomeNode::shutdown ( int  level)
virtual

Stop all pending activities of the node.

This method should be called when a Proc is finished and must be deleted from the YACS server

Reimplemented from YACS::ENGINE::Node.

Definition at line 913 of file CORBANode.cxx.

914 {
915  DEBTRACE("SalomeNode::shutdown " << level);
916  if(_component)
917  _component->shutdown(level);
918 }
virtual void shutdown(int level)

References YACS::ENGINE::ServiceNode::_component, DEBTRACE, and YACS::ENGINE::ComponentInstance::shutdown().

◆ simpleClone()

Node * SalomeNode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Implements YACS::ENGINE::Node.

Definition at line 834 of file CORBANode.cxx.

835 {
836  return new SalomeNode(*this,father);
837 }

References SalomeNode().

◆ typeName()

virtual std::string YACS::ENGINE::SalomeNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 79 of file CORBANode.hxx.

79 {return "YACS__ENGINE__SalomeNode";}

Member Data Documentation

◆ _mutex

YACS::BASES::Mutex YACS::ENGINE::SalomeNode::_mutex
private

Definition at line 93 of file CORBANode.hxx.

◆ KIND

const char SalomeNode::KIND ="Salome"
static

Definition at line 78 of file CORBANode.hxx.

Referenced by getKind().


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