-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : DSC_interface.cxx
// Author : André RIBES (EDF)
// Module : KERNEL
//
#include <string>
#include "DSC_interface.hxx"
+#ifdef WNT
+#else
#include <sys/time.h>
+#endif
#include <fstream>
#include <sys/stat.h>
#include <sstream>
void
Engines_DSC_interface::add_provides_port(Ports::Port_ptr ref,
- const char* provides_port_name,
- Ports::PortProperties_ptr port_prop)
+ const char* provides_port_name,
+ Ports::PortProperties_ptr port_prop)
throw (Engines::DSC::PortAlreadyDefined,
Engines::DSC::NilPort,
Engines::DSC::BadProperty)
void
Engines_DSC_interface::add_uses_port(const char* repository_id,
- const char* uses_port_name,
- Ports::PortProperties_ptr port_prop)
+ const char* uses_port_name,
+ Ports::PortProperties_ptr port_prop)
throw (Engines::DSC::PortAlreadyDefined,
Engines::DSC::BadProperty)
{
Ports::Port_ptr
Engines_DSC_interface::get_provides_port(const char* provides_port_name,
- const CORBA::Boolean connection_error)
+ const CORBA::Boolean connection_error)
throw (Engines::DSC::PortNotDefined,
- Engines::DSC::PortNotConnected,
- Engines::DSC::BadPortType)
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType)
{
// Method arg test
assert(provides_port_name);
Engines::DSC::uses_port *
Engines_DSC_interface::get_uses_port(const char* uses_port_name)
throw (Engines::DSC::PortNotDefined,
- Engines::DSC::PortNotConnected,
- Engines::DSC::BadPortType)
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType)
{
// Method arg test
assert(uses_port_name);
my_ports[provides_port_name]->connection_nbr += 1;
// User code is informed
provides_port_changed(provides_port_name,
- my_ports[provides_port_name]->connection_nbr,
- Engines::DSC::AddingConnection
- );
+ my_ports[provides_port_name]->connection_nbr,
+ Engines::DSC::AddingConnection
+ );
}
void
Engines_DSC_interface::connect_uses_port(const char* uses_port_name,
- Ports::Port_ptr provides_port_ref)
+ Ports::Port_ptr provides_port_ref)
throw (Engines::DSC::PortNotDefined,
- Engines::DSC::BadPortType,
- Engines::DSC::NilPort)
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort)
{
// Method arg test
assert(uses_port_name);
my_ports[uses_port_name]->connection_nbr += 1;
// User code is informed
uses_port_changed(uses_port_name,
- new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs),
- Engines::DSC::AddingConnection);
+ new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs),
+ Engines::DSC::AddingConnection);
}
else {
Engines::DSC::BadPortType BPT;
BPT.expected = CORBA::string_dup("Expected ...");
BPT.received = CORBA::string_dup((std::string("Received an incorrect repository id type ")+
- repository_id).c_str());
+ repository_id).c_str());
throw BPT;
}
void
Engines_DSC_interface::disconnect_provides_port(const char* provides_port_name,
- const Engines::DSC::Message message)
+ const Engines::DSC::Message message)
throw (Engines::DSC::PortNotDefined,
Engines::DSC::PortNotConnected)
{
{
my_ports[provides_port_name]->connection_nbr -= 1;
provides_port_changed(provides_port_name,
- my_ports[provides_port_name]->connection_nbr,
- message);
+ my_ports[provides_port_name]->connection_nbr,
+ message);
}
else
throw Engines::DSC::PortNotConnected();
void
Engines_DSC_interface::disconnect_uses_port(const char* uses_port_name,
- Ports::Port_ptr provides_port_ref,
- const Engines::DSC::Message message)
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
throw (Engines::DSC::PortNotDefined,
Engines::DSC::PortNotConnected,
Engines::DSC::BadPortReference)
{
if (my_ports[uses_port_name]->uses_port_refs[i]->_is_equivalent(provides_port_ref))
{
- port_index = i;
- break;
+ port_index = i;
+ break;
}
}
if (port_index == -1)
for(;index_ancien < seq_length;) {
if (index_ancien == port_index)
{
- // Rien a faire !
- // On ne change pas le index du nouveau tableau
- index_ancien += 1;
+ // Rien a faire !
+ // On ne change pas le index du nouveau tableau
+ index_ancien += 1;
}
else
{
- (*new_uses_port)[index_nouveau] = my_ports[uses_port_name]->uses_port_refs[index_ancien];
- index_ancien += 1;
- index_nouveau += 1;
+ (*new_uses_port)[index_nouveau] = my_ports[uses_port_name]->uses_port_refs[index_ancien];
+ index_ancien += 1;
+ index_nouveau += 1;
}
}
// The user code is informed
uses_port_changed(uses_port_name,
- new_uses_port,
- message);
+ new_uses_port,
+ message);
}
else
throw Engines::DSC::PortNotConnected();
initTrace(containerName);
if(traceLevel == 0)return;
+#ifdef WNT
+#else
struct timeval tv;
gettimeofday(&tv,0);
long tt0=tv.tv_sec/3600; //hours
*out << message ;
*out << std::endl;
}
+#endif
}