Version: 8.3.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Superv_Component_i Class Reference

This class implements DSC_User component. More...

Inheritance diagram for Superv_Component_i:
Inheritance graph

Data Structures

struct  BadCast
 
struct  BadFabType
 
struct  BadProperty
 
struct  BadType
 
struct  NilPort
 
struct  PortAlreadyDefined
 
struct  PortNotConnected
 
struct  PortNotDefined
 
struct  UnexpectedState
 

Public Member Functions

 Superv_Component_i (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId *contId, const char *instanceName, const char *interfaceName, bool notif=false)
 
 Superv_Component_i (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, bool notif=false, bool regist=true)
 
virtual provides_portcreate_provides_control_port ()
 
virtual provides_portcreate_provides_data_and_control_port (const char *port_type)
 
virtual uses_portcreate_uses_control_port ()
 
virtual uses_portcreate_uses_data_and_control_port (const char *port_type)
 
virtual provides_portcreate_provides_data_port (const std::string &port_fab_type) throw (BadFabType)
 
virtual uses_portcreate_uses_data_port (const std::string &port_fab_type) throw (BadFabType)
 
virtual void add_port (const char *port_fab_type, const char *port_type, const char *port_name) throw (PortAlreadyDefined, BadFabType, BadType, BadProperty)
 
template<typename SpecificPortType >
SpecificPortType * add_port (const char *port_fab_type, const char *port_type, const char *port_name) throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty)
 
virtual void add_port (provides_port *port, const char *provides_port_name) throw (PortAlreadyDefined, NilPort, BadProperty)
 
virtual void add_port (uses_port *port, const char *uses_port_name) throw (PortAlreadyDefined, NilPort, BadProperty)
 
virtual void get_port (provides_port *&port, const char *provides_port_name) throw (PortNotDefined, PortNotConnected)
 
virtual void get_port (uses_port *&port, const char *uses_port_name) throw (PortNotDefined, PortNotConnected)
 
virtual void get_uses_port_names (std::vector< std::string > &port_names, const std::string servicename="") const
 
template<typename SpecificPortType >
SpecificPortType * get_port (const char *port_name) throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState)
 
virtual void provides_port_changed (const char *provides_port_name, int connection_nbr, const Engines::DSC::Message message)
 
virtual void uses_port_changed (const char *uses_port_name, Engines::DSC::uses_port *new_uses_port, const Engines::DSC::Message message)
 
virtual port_factoryget_factory (const std::string &factory_name)
 
void beginService (const char *serviceName)
 
virtual CORBA::Boolean init_service_with_multiple (const char *service_name, const Engines::Superv_Component::seq_multiple_param &params)
 
virtual void add_provides_port (Ports::Port_ptr ref, const char *provides_port_name, Ports::PortProperties_ptr port_prop) throw (Engines::DSC::PortAlreadyDefined, Engines::DSC::NilPort, Engines::DSC::BadProperty)
 
virtual void add_uses_port (const char *repository_id, const char *uses_port_name, Ports::PortProperties_ptr port_prop) throw (Engines::DSC::PortAlreadyDefined, Engines::DSC::BadProperty)
 
virtual Ports::Port_ptr get_provides_port (const char *provides_port_name, const CORBA::Boolean connection_error) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
 
virtual Engines::DSC::uses_portget_uses_port (const char *uses_port_name) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
 
virtual void connect_provides_port (const char *provides_port_name) throw (Engines::DSC::PortNotDefined)
 
virtual void connect_uses_port (const char *uses_port_name, Ports::Port_ptr provides_port_ref) throw (Engines::DSC::PortNotDefined, Engines::DSC::BadPortType, Engines::DSC::NilPort)
 
virtual CORBA::Boolean is_connected (const char *port_name) throw (Engines::DSC::PortNotDefined)
 
virtual void disconnect_provides_port (const char *provides_port_name, const Engines::DSC::Message message) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
 
virtual void disconnect_uses_port (const char *uses_port_name, Ports::Port_ptr provides_port_ref, const Engines::DSC::Message message) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected, Engines::DSC::BadPortReference)
 
virtual Ports::PortProperties_ptr get_port_properties (const char *port_name) throw (Engines::DSC::PortNotDefined)
 
char * instanceName ()
 
char * interfaceName ()
 
void ping ()
 
void destroy ()
 
CORBA::Long getStudyId ()
 
Engines::Container_ptr GetContainerRef ()
 
void setProperties (const Engines::FieldsDict &dico)
 
Engines::FieldsDict * getProperties ()
 
virtual void SetOption (const char *, const char *)
 
virtual char * GetOption (const char *)
 
void Names (const char *graphName, const char *nodeName)
 
bool Kill_impl ()
 
bool Stop_impl ()
 
bool Suspend_impl ()
 
bool Resume_impl ()
 
CORBA::Long CpuUsed_impl ()
 
virtual Engines::TMPFileDumpPython (CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, CORBA::Boolean isMultiFile, CORBA::Boolean &isValidScript)
 
virtual Engines::Salome_file_ptr getInputFileToService (const char *service_name, const char *Salome_file_name)
 
virtual Engines::Salome_file_ptr getOutputFileToService (const char *service_name, const char *Salome_file_name)
 
virtual void checkInputFilesToService (const char *service_name)
 
virtual Engines::Salome_file_ptr setInputFileToService (const char *service_name, const char *Salome_file_name)
 
virtual void checkOutputFilesToService (const char *service_name)
 
virtual Engines::Salome_file_ptr setOutputFileToService (const char *service_name, const char *Salome_file_name)
 
virtual bool hasObjectInfo ()
 
virtual char * getObjectInfo (CORBA::Long studyId, const char *entry)
 
virtual char * getVersion ()
 Get version of the component. More...
 
PortableServer::ObjectId * getId ()
 
Engines_Container_iGetContainerPtr ()
 
std::string getContainerName ()
 
void setContainerName ()
 
virtual bool setStudyId (CORBA::Long studyId)
 
void endService (const char *serviceName)
 
void sendMessage (const char *event_type, const char *message)
 
char * graphName ()
 
char * nodeName ()
 
bool Killer (pthread_t ThreadId, int signum)
 
void SetCurCpu ()
 
long CpuUsed ()
 
void CancelThread ()
 
virtual void configureSalome_file (std::string service_name, std::string file_port_name, Salome_file_i *file)
 

Static Public Member Functions

static void register_factory (const std::string &factory_name, port_factory *factory_ptr)
 
static void setTimeOut ()
 
static bool isMultiStudy ()
 
static bool isMultiInstance ()
 
static std::string GetDynLibraryName (const char *componentName)
 
static void writeEvent (const char *request, const std::string &containerName, const char *instance_name, const char *port_name, const char *error, const char *message)
 Write a record in the trace file. More...
 

Static Public Attributes

static long dscTimeOut =0
 

Protected Types

typedef std::map< std::string,
Salome_file_i * > 
_t_Salome_file_map
 
typedef std::map< std::string,
Engines_Component_i::_t_Salome_file_map * > 
_t_Service_file_map
 
enum  port_type { uses, provides, none }
 
typedef std::map< std::string,
port_t * > 
ports
 

Protected Attributes

int _studyId
 
std::string _instanceName
 
std::string _interfaceName
 
std::string _containerName
 
CORBA::ORB_var _orb
 
PortableServer::POA_var _poa
 
PortableServer::ObjectId * _id
 
PortableServer::ObjectId * _contId
 
Engines::Container_var _container
 
Engines_Component_i_thisObj
 
RegistryConnexion * _myConnexionToRegistry
 
NOTIFICATION_Supplier_notifSupplier
 
std::map< std::string, CORBA::Any > _fieldsDict
 
_t_Service_file_map _Input_Service_file_map
 
_t_Service_file_map _Output_Service_file_map
 
_t_Service_file_map::iterator _Service_file_map_it
 
_t_Salome_file_map::iterator _Salome_file_map_it
 
std::string _serviceName
 
std::string _graphName
 
std::string _nodeName
 
ports my_ports
 
ports::iterator my_ports_it
 

Static Protected Attributes

static bool _isMultiStudy = true
 
static bool _isMultiInstance = false
 

Detailed Description

This class implements DSC_User component.

This class allows a higher programming level than DSC_Basic. It enables a programming level for service's developpers who want to use DSC ports.

This class has two level for using and declare ports. The higher level proposes operations to add ports that are provided by default by SALOME like Calcium ports. It provides too some methods to add their own DSC_User ports.

Note
This class doesn't implement the init_service CORBA operation.

Member Function Documentation

virtual provides_port* Superv_Component_i::create_provides_control_port ( )
inlinevirtual
Warning
currently disabled.
virtual provides_port* Superv_Component_i::create_provides_data_and_control_port ( const char *  port_type)
inlinevirtual
Warning
currently disabled.
virtual uses_port* Superv_Component_i::create_uses_control_port ( )
inlinevirtual
Warning
currently disabled.
virtual uses_port* Superv_Component_i::create_uses_data_and_control_port ( const char *  port_type)
inlinevirtual
Warning
currently disabled.
provides_port * Superv_Component_i::create_provides_data_port ( const std::string &  port_fab_type) throw (BadFabType)
virtual

This method permits to create a provides port provided by the platform. (See documentation of DSC for knoing these ports).

Parameters
port_fab_typetype provides port.
Returns
the provides port.
Note
It's user repsonsability to destroy the provides port.
uses_port * Superv_Component_i::create_uses_data_port ( const std::string &  port_fab_type) throw (BadFabType)
virtual

This method permits to create a uses port provided by the platform. (See documentation of DSC for knoing these ports).

Parameters
port_fab_typetype uses port.
Returns
the uses port.
Note
It's user repsonsability to destroy the uses port.
SpecificPortType * Superv_Component_i::add_port ( const char *  port_fab_type,
const char *  port_type,
const char *  port_name 
) throw (PortAlreadyDefined, BadFabType, BadType, BadProperty)
virtual

Adds a port to the component. With this method only Salomé's provided DSC ports can be added.

Parameters
port_fab_typetype of the port.
port_typeuses or provides.
port_namethe name of the port in the component.
template<typename SpecificPortType >
SpecificPortType* Superv_Component_i::add_port ( const char *  port_fab_type,
const char *  port_type,
const char *  port_name 
) throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty)

Adds a port to the component. With this method only Salomé's provided DSC ports can be added.

Parameters
port_fab_typetype of the port.
port_typeuses or provides.
port_namethe name of the port in the component.
Returns
the created port.
void Superv_Component_i::add_port ( provides_port port,
const char *  provides_port_name 
) throw (PortAlreadyDefined, NilPort, BadProperty)
virtual

Adds a created provides port to the component.

Parameters
portthe provides port.
provides_port_namethe name of the port in the component.
void Superv_Component_i::add_port ( uses_port port,
const char *  uses_port_name 
) throw (PortAlreadyDefined, NilPort, BadProperty)
virtual

Adds a created uses port to the component.

Parameters
portthe uses port.
uses_port_namethe name of the port in the component.
void Superv_Component_i::get_port ( provides_port *&  port,
const char *  provides_port_name 
) throw (PortNotDefined, PortNotConnected)
virtual

Gets the provides port already added in the component.

Parameters
portthe provides port pointer.
provides_port_namethe name of the port.
void Superv_Component_i::get_port ( uses_port *&  port,
const char *  uses_port_name 
) throw (PortNotDefined, PortNotConnected)
virtual

Gets the uses port already added in the component.

Parameters
portthe uses port pointer.
uses_port_namethe name of the port.
void Superv_Component_i::get_uses_port_names ( std::vector< std::string > &  port_names,
const std::string  servicename = "" 
) const
virtual

Gets the list of the ports of a service. If servicename is not set, all the ports of the component are returned.

Parameters
port_namesthe ports's list.
servicenameservice's name.
template<typename SpecificPortType >
SpecificPortType * Superv_Component_i::get_port ( const char *  port_name) throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState)

Gets a port already added in the component.

Parameters
port_namethe name of the port.
Returns
a port's pointer.
void Superv_Component_i::provides_port_changed ( const char *  provides_port_name,
int  connection_nbr,
const Engines::DSC::Message  message 
)
virtual
void Superv_Component_i::uses_port_changed ( const char *  uses_port_name,
Engines::DSC::uses_port new_uses_port,
const Engines::DSC::Message  message 
)
virtual
void Superv_Component_i::register_factory ( const std::string &  factory_name,
port_factory factory_ptr 
)
static

Add a factory the component. If the factory_name is already used, the new library is not added.

Parameters
factory_namename of the factory (used by Superv_Component_i::create_provides_data_port and Superv_Component_i::create_uses_data_port)
factory_ptrfactory pointer (destroyed by the component)
port_factory * Superv_Component_i::get_factory ( const std::string &  factory_name)
virtual

Get a factory from the component.

Parameters
factory_namename of the factory.
Returns
factory pointer, NULL if the factory doesn't exist.
virtual void Engines_DSC_i::add_provides_port ( Ports::Port_ptr  ref,
const char *  provides_port_name,
Ports::PortProperties_ptr  port_prop 
) throw (Engines::DSC::PortAlreadyDefined, Engines::DSC::NilPort, Engines::DSC::BadProperty)
inlinevirtualinherited
virtual void Engines_DSC_i::add_uses_port ( const char *  repository_id,
const char *  uses_port_name,
Ports::PortProperties_ptr  port_prop 
) throw (Engines::DSC::PortAlreadyDefined, Engines::DSC::BadProperty)
inlinevirtualinherited
virtual Ports::Port_ptr Engines_DSC_i::get_provides_port ( const char *  provides_port_name,
const CORBA::Boolean  connection_error 
) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
inlinevirtualinherited
virtual Engines::DSC::uses_port* Engines_DSC_i::get_uses_port ( const char *  uses_port_name) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
inlinevirtualinherited
virtual void Engines_DSC_i::connect_provides_port ( const char *  provides_port_name) throw (Engines::DSC::PortNotDefined)
inlinevirtualinherited
virtual void Engines_DSC_i::connect_uses_port ( const char *  uses_port_name,
Ports::Port_ptr  provides_port_ref 
) throw (Engines::DSC::PortNotDefined, Engines::DSC::BadPortType, Engines::DSC::NilPort)
inlinevirtualinherited
virtual CORBA::Boolean Engines_DSC_i::is_connected ( const char *  port_name) throw (Engines::DSC::PortNotDefined)
inlinevirtualinherited
virtual void Engines_DSC_i::disconnect_provides_port ( const char *  provides_port_name,
const Engines::DSC::Message  message 
) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected)
inlinevirtualinherited
virtual void Engines_DSC_i::disconnect_uses_port ( const char *  uses_port_name,
Ports::Port_ptr  provides_port_ref,
const Engines::DSC::Message  message 
) throw (Engines::DSC::PortNotDefined, Engines::DSC::PortNotConnected, Engines::DSC::BadPortReference)
inlinevirtualinherited
virtual Ports::PortProperties_ptr Engines_DSC_i::get_port_properties ( const char *  port_name) throw (Engines::DSC::PortNotDefined)
inlinevirtualinherited
char * Engines_Component_i::instanceName ( )
inherited

CORBA method: return name of the instance, unique in this Container

char * Engines_Component_i::interfaceName ( )
inherited

CORBA method: return name of the component class

void Engines_Component_i::ping ( )
inherited

CORBA method: Test if instance is alive and responds

void Engines_Component_i::destroy ( )
inherited

CORBA method: Deactivate this instance. CORBA object is deactivated (do not respond any more to CORBA calls), the connection to Regsitry is removed (Registry informed of deactivation), internal server reference counter on the derived servant class is decremented, to allow destruction of the class (delete) by POA, when there are no more references. – TO BE USED BY CONTAINER ONLY (Container housekeeping) –

CORBA::Long Engines_Component_i::getStudyId ( )
inherited

CORBA method: Get study Id

Returns
-1: not initialised (Internal Error) 0: multistudy component instance >0: study id associated to this instance
Engines::Container_ptr Engines_Component_i::GetContainerRef ( )
inherited

CORBA method: return CORBA reference of the Container

void Engines_Component_i::setProperties ( const Engines::FieldsDict &  dico)
inherited

CORBA method: Gives a sequence of (key=string,value=any) to the component. Base class component stores the sequence in a map. The map is cleared before. This map is for use by derived classes.

Parameters
dicosequence of (key=string,value=any)
Engines::FieldsDict * Engines_Component_i::getProperties ( )
inherited

CORBA method: returns a previously stored map (key=string,value=any) as a sequence. (see setProperties)

void Engines_Component_i::SetOption ( const char *  ,
const char *   
)
virtualinherited

CORBA method: This method is to set an option specific to a certain EngineComponent.

char * Engines_Component_i::GetOption ( const char *  )
virtualinherited

CORBA method: This method is to get value of an option specific to a certain EngineComponent.

void Engines_Component_i::Names ( const char *  graphName,
const char *  nodeName 
)
inherited

CORBA method: used by Supervision to give names to this instance

bool Engines_Component_i::Kill_impl ( )
inherited

CORBA method: used in Supervision

bool Engines_Component_i::Stop_impl ( )
inherited

CORBA method: used in Supervision

bool Engines_Component_i::Suspend_impl ( )
inherited

CORBA method: used in Supervision

bool Engines_Component_i::Resume_impl ( )
inherited

CORBA method: used in Supervision

CORBA::Long Engines_Component_i::CpuUsed_impl ( )
inherited

CORBA method:

Engines::TMPFile * Engines_Component_i::DumpPython ( CORBA::Object_ptr  theStudy,
CORBA::Boolean  isPublished,
CORBA::Boolean  isMultiFile,
CORBA::Boolean &  isValidScript 
)
virtualinherited

C++ method: DumpPython default implementation

char * Engines_Component_i::getVersion ( )
virtualinherited

Get version of the component.

This method is supposed to be implemented in all derived classes; default implementation returns empty string that means that no version information about the component is available.

Note
The version of the component is stored to the study, as a part of general persistence mechanism; once stored, version information in the study cannot be changed.
Returns
string containing component's version, e.g. "1.0"
PortableServer::ObjectId * Engines_Component_i::getId ( )
inherited

C++ method: return CORBA instance id, the id is set in derived class constructor, when instance is activated.

Engines_Container_i * Engines_Component_i::GetContainerPtr ( )
inherited

C++ method: return Container Servant

std::string Engines_Component_i::getContainerName ( )
inherited

C++ method: return the name of the container associated with this component This name does not contains the "/Containers" string and all "/" are replaced by "_"

Returns
the container name (reformatted)
void Engines_Component_i::setContainerName ( )
inherited

C++ method: set the name of the container associated with this component (attribute containerName) This name does not contains the "/Containers" string and all "/" are replaced by "</em>"

Returns
the container name (reformatted)

CORBA::Boolean Engines_Component_i::setStudyId ( CORBA::Long  studyId)
virtualinherited

C++ method: set study Id

Parameters
studyId0 if instance is not associated to a study, >0 otherwise (== study id)
Returns
true if the set of study Id is OK must be set once by Container, at instance creation, and cannot be changed after.
std::string Engines_Component_i::GetDynLibraryName ( const char *  componentName)
staticinherited

C++ method: return standard library name built on component name

void Engines_Component_i::endService ( const char *  serviceName)
inherited

C++ method: used by derived classes for supervision

void Engines_Component_i::sendMessage ( const char *  event_type,
const char *  message 
)
inherited

C++ method: Send message to event channel

char * Engines_Component_i::graphName ( )
inherited

C++ method: – CHECK IF USED –

char * Engines_Component_i::nodeName ( )
inherited

C++ method: – CHECK IF USED –

bool Engines_Component_i::Killer ( pthread_t  ThreadId,
int  signum 
)
inherited

C++ method: used in Supervision (see kill_impl)

void Engines_Component_i::SetCurCpu ( )
inherited

C++ method:

long Engines_Component_i::CpuUsed ( )
inherited

C++ method:

void Engines_Component_i::CancelThread ( )
inherited

C++ method:

void Engines_Component_i::configureSalome_file ( std::string  service_name,
std::string  file_port_name,
Salome_file_i file 
)
virtualinherited

C++ method: used to configure the Salome_file into the runtime.

Parameters
service_namename of the service that use this Salome_file
file_port_namename of the Salome_file
fileSalome_file C++ object
void Engines_DSC_interface::writeEvent ( const char *  request,
const std::string &  containerName,
const char *  instance_name,
const char *  port_name,
const char *  error,
const char *  message 
)
staticinherited

Write a record in the trace file.

Parameters
requestthe name of the request executed
containerNamethe name of the container where the request is executed
instance_namethe name of the component where the request is executed
port_namethe name of the port that is concerned
errorif an error has occured, a string that identifies the error
messageinformations about error or about the request