#ifndef _DATA_SHORT_PORT_PROVIDES_HXX_
#define _DATA_SHORT_PORT_PROVIDES_HXX_
+#include <SALOMEconfig.h>
+
#include <iostream>
#include "SALOME_Ports.hh"
#include "provides_port.hxx"
{
dynamic_cast<calcium_integer_port_provides *>(port)->setDependencyType(depend);
}
+ else if(std::string(type)=="CALCIUM_string")
+ {
+ dynamic_cast<calcium_string_port_provides *>(port)->setDependencyType(depend);
+ }
+ else if(std::string(type)=="CALCIUM_logical")
+ {
+ dynamic_cast<calcium_logical_port_provides *>(port)->setDependencyType(depend);
+ }
+ else if(std::string(type)=="CALCIUM_complex")
+ {
+ dynamic_cast<calcium_complex_port_provides *>(port)->setDependencyType(depend);
+ }
else
{
std::cerr << "unknown type:" << std::endl;
#ifndef _CALCIUM_PORT_PROVIDES_HXX_
#define _CALCIUM_PORT_PROVIDES_HXX_
+#include <SALOMEconfig.h>
+
#include "Calcium_Ports.hh"
#include "CalciumGenericProvidesPort.hxx"
#include "CalciumCouplingPolicy.hxx"
#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
#define _CALCIUM_INTEGER_PORT_USES_HXX_
+#include <SALOMEconfig.h>
+
#include "Calcium_Ports.hh"
#include "CalciumGenericUsesPort.hxx"
template < typename DataManipulator, typename COUPLING_POLICY>
GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
typename DataTable::iterator it;
- // for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
- // std::cout << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
- // DataManipulator::delete_data( (*it).second );
- // }
+ for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
+#ifdef _DEBUG_
+ std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
+#endif
+ DataManipulator::delete_data( (*it).second );
+ }
}
template < typename DataManipulator, typename COUPLING_POLICY> void
}
template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
-GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::~GenericUsesPort() {}
+GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::~GenericUsesPort()
+{
+ delete _my_ports;
+}
template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
const char *
GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put( CorbaInDataType data,
TimeType time,
TagType tag) {
- typedef typename CorbaPortType::_ptr_type CorbaPortTypePtr;
+ typedef typename CorbaPortType::_var_type CorbaPortTypeVar;
if (!_my_ports)
throw DSC_Exception(LOC("There is no connected provides port to communicate with."));
// OLD : DataType copyOfData; // = data; PB1
for(int i = 0; i < _my_ports->length(); i++) {
- CorbaPortTypePtr port = CorbaPortType::_narrow((*_my_ports)[i]);
+ CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]);
//if (i) { PB1
//OLD : copyOfData = DataManipulator::clone(data);
#ifdef _DEBUG_
#ifdef _DEBUG_
std::cerr << "GenericUsesPort::uses_port_changed" << std::endl;
#endif
- _my_ports = new Engines::DSC::uses_port(*new_uses_port);
+ _my_ports = new_uses_port;
}
#endif
#ifndef _PALM_COUPLING_POLICIES_HXX_
#define _PALM_COUPLING_POLICIES_HXX_
+#include <SALOMEconfig.h>
+
#include <CORBA.h>
#include <vector>
#include "DataIdFilter.hxx"
{
delete begin->second;
}
+
+ my_superv_ports_it = my_superv_ports.begin();
+ for(;my_superv_ports_it != my_superv_ports.end();my_superv_ports_it++)
+ delete my_superv_ports_it->second;
+
}
void
try {
- Engines_DSC_interface::add_provides_port(port->get_port_ref(),
+ Ports::PortProperties_var portproperties=port->get_port_properties();
+ Ports::Port_var portref=port->get_port_ref();
+ Engines_DSC_interface::add_provides_port(portref,
provides_port_name,
- port->get_port_properties());
+ portproperties);
superv_port_t * new_superv_port = new superv_port_t();
new_superv_port->p_ref = port;
assert(uses_port_name);
try {
+ Ports::PortProperties_var portproperties=port->get_port_properties();
Engines_DSC_interface::add_uses_port(port->get_repository_id(),
uses_port_name,
- port->get_port_properties());
+ portproperties);
superv_port_t * new_superv_port = new superv_port_t();
new_superv_port->u_ref = port;
my_superv_ports[uses_port_name] = new_superv_port;
assert(provides_port_name);
try {
- Engines_DSC_interface::get_provides_port(provides_port_name, false);
+ Ports::Port_var portref=Engines_DSC_interface::get_provides_port(provides_port_name, false);
port = my_superv_ports[provides_port_name]->p_ref;
} catch (const Engines::DSC::PortNotDefined&) {
throw PortNotDefined( LOC(OSS()<< "Le port provides "
assert(uses_port_name);
try {
- Engines_DSC_i::get_uses_port(uses_port_name);
+ Engines::DSC::uses_port * portseq=Engines_DSC_i::get_uses_port(uses_port_name);
+ delete portseq;
port = my_superv_ports[uses_port_name]->u_ref;
} catch (const Engines::DSC::PortNotDefined&) {
throw PortNotDefined( LOC(OSS()<< "Le port uses "
{
my_superv_ports_it = my_superv_ports.find(uses_port_name);
if (my_superv_ports_it != my_superv_ports.end())
- my_superv_ports[uses_port_name]->u_ref->uses_port_changed(new_uses_port,
+ my_superv_ports[uses_port_name]->u_ref->uses_port_changed(new Engines::DSC::uses_port(*new_uses_port),
message);
+ //delete the copy made by the caller
+ delete new_uses_port;
}
// A Superv_Component port.
struct superv_port_t {
superv_port_t():u_ref(NULL),p_ref(NULL){};
+ ~superv_port_t()
+ {
+ if(u_ref)delete u_ref;
+ if(p_ref)delete p_ref;
+ };
// For uses ports.
uses_port * u_ref;
// For provides ports.
try {
if ( superv_port->p_ref != NULL ) {
port = superv_port->p_ref;
- Engines_DSC_interface::get_provides_port(port_name, false);
+ Ports::Port_var portref=Engines_DSC_interface::get_provides_port(port_name, false);
}
else if ( superv_port->u_ref != NULL ) {
port = superv_port->u_ref;
- Engines_DSC_i::get_uses_port(port_name);
+ Engines::DSC::uses_port * portseq=Engines_DSC_i::get_uses_port(port_name);
+ delete portseq;
} else {
throw UnexpectedState( LOC(OSS()<< "Internal Error superv_port struct is inconsistent "));