9 extern "C" void transit_(void *compo,double *dt);
10 extern "C" void perma_(void *compo);
12 //! Constructor for component "NEUTRO" instance
16 NEUTRO_i::NEUTRO_i(CORBA::ORB_ptr orb,
17 PortableServer::POA_ptr poa,
18 PortableServer::ObjectId * contId,
19 const char *instanceName,
20 const char *interfaceName)
21 : Superv_Component_i(orb, poa, contId, instanceName, interfaceName)
23 cerr << "create component" << endl;
25 _id = _poa->activate_object(_thisObj);
28 //! Destructor for component "NEUTRO" instance
33 //! Register datastream ports for a component service given its name
35 * \param service_name : service name
36 * \return true if port registering succeeded, false if not
39 NEUTRO_i::init_service(const char * service_name) {
40 CORBA::Boolean rtn = false;
41 string s_name(service_name);
46 std::cerr << "NEUTRO: prun: " << std::endl;
47 //initialization CALCIUM ports IN
48 calcium_real_port_provides * p1;
49 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","tempi");
50 p1->setDependencyType(CalciumTypes::ITERATION_DEPENDENCY);
51 calcium_integer_port_provides * p2;
52 p2 = add_port<calcium_integer_port_provides>("CALCIUM_integer","provides","iconv");
53 p2->setDependencyType(CalciumTypes::ITERATION_DEPENDENCY);
54 //initialization CALCIUM ports OUT
55 add_port<calcium_real_port_uses>("CALCIUM_real","uses","puissi");
57 catch(const PortAlreadyDefined& ex)
59 std::cerr << "NEUTRO: " << ex.what() << std::endl;
60 //Ports already created : we use them
64 std::cerr << "NEUTRO: unknown exception" << std::endl;
73 std::cerr << "NEUTRO: trun: " << std::endl;
74 //initialization CALCIUM ports IN
75 calcium_real_port_provides * p1;
76 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","temperature");
77 p1->setDependencyType(CalciumTypes::TIME_DEPENDENCY);
78 //initialization CALCIUM ports OUT
79 add_port<calcium_real_port_uses>("CALCIUM_real","uses","puissance");
81 catch(const PortAlreadyDefined& ex)
83 std::cerr << "NEUTRO: " << ex.what() << std::endl;
84 //Ports already created : we use them
88 std::cerr << "NEUTRO: unknown exception" << std::endl;
97 std::cerr << "NEUTRO_i::prun" << std::endl;
98 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
99 char nom_instance[INSTANCE_LEN];
100 int info = cp_cd(component,nom_instance);
104 //to do or not to do ???
105 cp_fin(component,CP_ARRET);
107 catch ( const CalciumException & ex)
109 std::cerr << ex.what() << std::endl;
110 cp_fin(component,CP_ARRET);
114 std::cerr << "unexpected exception" << std::endl;
115 cp_fin(component,CP_ARRET);
117 std::cerr << "end of NEUTRO_i::prun" << std::endl;
120 void NEUTRO_i::trun(CORBA::Double dt)
122 std::cerr << "NEUTRO_i::trun" << std::endl;
123 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
124 char nom_instance[INSTANCE_LEN];
125 int info = cp_cd(component,nom_instance);
128 transit_(&component,&dt);
129 //to do or not to do ???
130 cp_fin(component,CP_ARRET);
132 catch ( const CalciumException & ex)
134 std::cerr << ex.what() << std::endl;
135 cp_fin(component,CP_ARRET);
139 std::cerr << "unexpected exception" << std::endl;
140 cp_fin(component,CP_ARRET);
142 std::cerr << "end of NEUTRO_i::trun" << std::endl;
147 PortableServer::ObjectId * NEUTROEngine_factory( CORBA::ORB_ptr orb,
148 PortableServer::POA_ptr poa,
149 PortableServer::ObjectId * contId,
150 const char *instanceName,
151 const char *interfaceName)
153 MESSAGE("PortableServer::ObjectId * NEUTROEngine_factory()");
154 NEUTRO_i * myEngine = new NEUTRO_i(orb, poa, contId, instanceName, interfaceName);
155 return myEngine->getId() ;