7 #include <CalciumInterface.hxx>
10 extern "C" void transit_(void *compo);
11 extern "C" void perma_(void *compo);
13 //! Constructor for component "INTERPI" instance
17 INTERPI_i::INTERPI_i(CORBA::ORB_ptr orb,
18 PortableServer::POA_ptr poa,
19 PortableServer::ObjectId * contId,
20 const char *instanceName,
21 const char *interfaceName)
22 : Superv_Component_i(orb, poa, contId, instanceName, interfaceName)
24 cerr << "create component" << endl;
26 _id = _poa->activate_object(_thisObj);
29 //! Destructor for component "INTERPI" instance
30 INTERPI_i::~INTERPI_i()
34 //! Register datastream ports for a component service given its name
36 * \param service_name : service name
37 * \return true if port registering succeeded, false if not
40 INTERPI_i::init_service(const char * service_name) {
41 CORBA::Boolean rtn = false;
42 string s_name(service_name);
47 std::cerr << "INTERPI: prun: " << std::endl;
48 //initialization CALCIUM ports IN
49 calcium_real_port_provides * p1;
50 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","tparoi");
51 p1->setDependencyType(CalciumTypes::ITERATION_DEPENDENCY);
52 //initialization CALCIUM ports OUT
53 add_port<calcium_real_port_uses>("CALCIUM_real","uses","tpar");
55 catch(const PortAlreadyDefined& ex)
57 std::cerr << "INTERPI: " << ex.what() << std::endl;
58 //Ports already created : we use them
62 std::cerr << "INTERPI: unknown exception" << std::endl;
71 std::cerr << "INTERPI: trun: " << std::endl;
72 //initialization CALCIUM ports IN
73 calcium_real_port_provides * p1;
74 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","tparoit");
75 p1->setDependencyType(CalciumTypes::TIME_DEPENDENCY);
76 //initialization CALCIUM ports OUT
77 add_port<calcium_real_port_uses>("CALCIUM_real","uses","tpart");
79 catch(const PortAlreadyDefined& ex)
81 std::cerr << "INTERPI: " << ex.what() << std::endl;
82 //Ports already created : we use them
86 std::cerr << "INTERPI: unknown exception" << std::endl;
93 void INTERPI_i::prun()
95 std::cerr << "INTERPI_i::prun" << std::endl;
96 beginService("INTERPI_i::prun");
97 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
98 char nom_instance[INSTANCE_LEN];
99 int info = cp_cd(component,nom_instance);
103 //to do or not to do ???
104 cp_fin(component,CP_ARRET);
106 catch ( const CalciumException & ex)
108 std::cerr << ex.what() << std::endl;
109 cp_fin(component,CP_ARRET);
113 std::cerr << "unexpected exception" << std::endl;
114 cp_fin(component,CP_ARRET);
116 endService("INTERPI_i::prun");
117 std::cerr << "end of INTERPI_i::prun" << std::endl;
120 void INTERPI_i::trun()
122 std::cerr << "INTERPI_i::trun" << std::endl;
123 beginService("INTERPI_i::trun");
124 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
125 char nom_instance[INSTANCE_LEN];
126 int info = cp_cd(component,nom_instance);
129 transit_(&component);
130 //to do or not to do ???
131 cp_fin(component,CP_ARRET);
133 catch ( const CalciumException & ex)
135 std::cerr << ex.what() << std::endl;
136 cp_fin(component,CP_ARRET);
140 std::cerr << "unexpected exception" << std::endl;
141 cp_fin(component,CP_ARRET);
143 endService("INTERPI_i::trun");
144 std::cerr << "end of INTERPI_i::trun" << std::endl;
149 PortableServer::ObjectId * INTERPIEngine_factory( CORBA::ORB_ptr orb,
150 PortableServer::POA_ptr poa,
151 PortableServer::ObjectId * contId,
152 const char *instanceName,
153 const char *interfaceName)
155 std::cerr << "INTERPIEngine_factory" << std::endl;
156 INTERPI_i * myEngine = new INTERPI_i(orb, poa, contId, instanceName, interfaceName);
157 return myEngine->getId() ;
160 PortableServer::ObjectId * INTERPJEngine_factory( CORBA::ORB_ptr orb,
161 PortableServer::POA_ptr poa,
162 PortableServer::ObjectId * contId,
163 const char *instanceName,
164 const char *interfaceName)
166 std::cerr << "INTERPJEngine_factory" << std::endl;
167 INTERPI_i * myEngine = new INTERPI_i(orb, poa, contId, instanceName, interfaceName);
168 return myEngine->getId() ;
170 PortableServer::ObjectId * INTERPKEngine_factory( CORBA::ORB_ptr orb,
171 PortableServer::POA_ptr poa,
172 PortableServer::ObjectId * contId,
173 const char *instanceName,
174 const char *interfaceName)
176 std::cerr << "INTERPKEngine_factory" << std::endl;
177 INTERPI_i * myEngine = new INTERPI_i(orb, poa, contId, instanceName, interfaceName);
178 return myEngine->getId() ;