27 #ifndef _SUPERV_COMPONENT_I_HXX_
28 #define _SUPERV_COMPONENT_I_HXX_
55 virtual public POA_Engines::Superv_Component
59 PortableServer::POA_ptr poa,
60 PortableServer::ObjectId * contId,
65 PortableServer::POA_ptr poa,
66 Engines::Container_ptr container,
67 const char *instanceName,
68 const char *interfaceName,
145 virtual void add_port(
const char * port_fab_type,
147 const char * port_name)
148 throw (PortAlreadyDefined, BadFabType, BadType, BadProperty);
159 template <
typename SpecificPortType >
160 SpecificPortType *
add_port(
const char * port_fab_type,
162 const char * port_name)
163 throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty);
172 const char* provides_port_name)
173 throw (PortAlreadyDefined, NilPort, BadProperty);
182 const char* uses_port_name)
183 throw (PortAlreadyDefined, NilPort, BadProperty);
192 const char* provides_port_name)
193 throw (PortNotDefined, PortNotConnected);
202 const char* uses_port_name)
203 throw (PortNotDefined, PortNotConnected);
214 const std::string servicename=
"")
const;
222 template <
typename SpecificPortType >
223 SpecificPortType *
get_port(
const char * port_name)
224 throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState);
290 PortableServer::ServantBase* servant=
dynamic_cast<PortableServer::ServantBase*
>(
p_ref);
293 PortableServer::POA_var poa =servant->_default_POA();
294 PortableServer::ObjectId_var oid = poa->servant_to_id(servant);
295 poa->deactivate_object(oid);
296 servant->_remove_ref();
317 template <
typename SpecificPortType > SpecificPortType *
319 const char * port_type,
320 const char * port_name)
321 throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty)
323 assert(port_fab_type);
326 SpecificPortType * retPort;
329 std::cout <<
"---- Superv_Component_i::add_port : Mark 0 ---- " << port_name <<
"----" << std::endl;
332 std::string s_port_type(port_type);
333 if (s_port_type ==
"provides") {
334 provides_port * port = create_provides_data_port(port_fab_type);
335 add_port(port, port_name);
336 retPort =
dynamic_cast<SpecificPortType *
>(port);
337 if ( retPort == NULL ) {
delete port;
338 throw BadCast(
LOC(
"Can't cast to asked port type " ));
341 else if (s_port_type ==
"uses") {
342 uses_port * port = create_uses_data_port(port_fab_type);
343 add_port(port, port_name);
345 std::cout <<
"---- Superv_Component_i::add_port : Mark 1 ---- " << port <<
"----" << std::endl;
346 std::cout <<
"---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->
get_repository_id() << std::endl;
348 retPort =
dynamic_cast<SpecificPortType *
>(port);
350 std::cout <<
"---- Superv_Component_i::add_port : Mark 2 ---- " << retPort <<
"----" << std::endl;
352 if ( retPort == NULL ) {
delete port;
353 throw BadCast(
LOC(
"Can't cast to asked port type " ));
357 throw BadType(
LOC(
OSS()<<
"port_type must be either 'provides' either 'uses' not "
364 template <
typename SpecificPortType > SpecificPortType *
370 SpecificPortType * retPort;
373 my_superv_ports_it = my_superv_ports.find(port_name);
374 if (my_superv_ports_it == my_superv_ports.end())
381 if ( superv_port->
p_ref != NULL ) {
382 port = superv_port->
p_ref;
385 else if ( superv_port->
u_ref != NULL ) {
386 port = superv_port->
u_ref;
395 << port_name <<
" does not exist."));
398 <<
" is not connected."));
401 retPort =
dynamic_cast<SpecificPortType *
>(port);
402 if ( retPort == NULL ) {
403 throw BadCast(
LOC(
"Can't cast to required port type " ));