9 extern "C" void transit_(void *compo,double *dt);
10 extern "C" void perma_(void *compo);
12 //! Constructor for component "SOLIDE" instance
16 SOLIDE_i::SOLIDE_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 "SOLIDE" 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 SOLIDE_i::init_service(const char * service_name) {
40 CORBA::Boolean rtn = false;
41 string s_name(service_name);
46 std::cerr << "SOLIDE: 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","puissi");
50 p1->setDependencyType(CalciumTypes::ITERATION_DEPENDENCY);
51 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","tfi");
52 p1->setDependencyType(CalciumTypes::ITERATION_DEPENDENCY);
53 //initialization CALCIUM ports OUT
54 add_port<calcium_real_port_uses>("CALCIUM_real","uses","tempi");
55 add_port<calcium_real_port_uses>("CALCIUM_real","uses","tpi");
56 add_port<calcium_integer_port_uses>("CALCIUM_integer","uses","iconv");
58 catch(const PortAlreadyDefined& ex)
60 std::cerr << "SOLIDE: " << ex.what() << std::endl;
61 //Ports already created : we use them
65 std::cerr << "SOLIDE: unknown exception" << std::endl;
74 std::cerr << "SOLIDE: trun: " << std::endl;
75 //initialization CALCIUM ports IN
76 calcium_real_port_provides * p1;
77 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","rext");
78 p1->setDependencyType(CalciumTypes::TIME_DEPENDENCY);
79 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","puissa");
80 p1->setDependencyType(CalciumTypes::TIME_DEPENDENCY);
81 p1 = add_port<calcium_real_port_provides>("CALCIUM_real","provides","text");
82 p1->setDependencyType(CalciumTypes::TIME_DEPENDENCY);
83 //initialization CALCIUM ports OUT
84 add_port<calcium_real_port_uses>("CALCIUM_real","uses","tparoi");
85 add_port<calcium_real_port_uses>("CALCIUM_real","uses","rparoi");
86 add_port<calcium_real_port_uses>("CALCIUM_real","uses","temperature");
88 catch(const PortAlreadyDefined& ex)
90 std::cerr << "SOLIDE: " << ex.what() << std::endl;
91 //Ports already created : we use them
95 std::cerr << "SOLIDE: unknown exception" << std::endl;
102 void SOLIDE_i::prun()
104 std::cerr << "SOLIDE_i::prun" << std::endl;
105 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
106 char nom_instance[INSTANCE_LEN];
107 int info = cp_cd(component,nom_instance);
111 //to do or not to do ???
112 cp_fin(component,CP_ARRET);
114 catch ( const CalciumException & ex)
116 std::cerr << ex.what() << std::endl;
117 cp_fin(component,CP_ARRET);
121 std::cerr << "unexpected exception" << std::endl;
122 cp_fin(component,CP_ARRET);
124 std::cerr << "end of SOLIDE_i::prun" << std::endl;
127 void SOLIDE_i::trun(CORBA::Double dt)
129 std::cerr << "SOLIDE_i::trun" << std::endl;
130 Superv_Component_i * component = dynamic_cast<Superv_Component_i*>(this);
131 char nom_instance[INSTANCE_LEN];
132 int info = cp_cd(component,nom_instance);
135 transit_(&component,&dt);
136 //to do or not to do ???
137 cp_fin(component,CP_ARRET);
139 catch ( const CalciumException & ex)
141 std::cerr << ex.what() << std::endl;
142 cp_fin(component,CP_ARRET);
146 std::cerr << "unexpected exception" << std::endl;
147 cp_fin(component,CP_ARRET);
149 std::cerr << "end of SOLIDE_i::trun" << std::endl;
154 PortableServer::ObjectId * SOLIDEEngine_factory( CORBA::ORB_ptr orb,
155 PortableServer::POA_ptr poa,
156 PortableServer::ObjectId * contId,
157 const char *instanceName,
158 const char *interfaceName)
160 MESSAGE("PortableServer::ObjectId * SOLIDEEngine_factory()");
161 SOLIDE_i * myEngine = new SOLIDE_i(orb, poa, contId, instanceName, interfaceName);
162 return myEngine->getId() ;