2 #include "DSCCODAENG.hxx"
6 //! Constructor for component "DSCCODA" instance
10 DSCCODA_i::DSCCODA_i(CORBA::ORB_ptr orb,
11 PortableServer::POA_ptr poa,
12 PortableServer::ObjectId * contId,
13 const char *instanceName,
14 const char *interfaceName)
15 : Superv_Component_i(orb, poa, contId, instanceName, interfaceName)
17 cout << "create component" << endl;
19 _id = _poa->activate_object(_thisObj);
24 //! Destructor for component "DSCCODA" instance
25 DSCCODA_i::~DSCCODA_i()
29 //! Register datastream ports for a component service given its name
31 * \param service_name : service name
32 * \return true if port registering succeeded, false if not
35 DSCCODA_i::init_service(const char * service_name) {
36 CORBA::Boolean rtn = false;
37 string s_name(service_name);
42 std::cerr << "DSCCODA: prun: uses " << std::endl;
43 add_port("BASIC_short", "uses", "prun_out_port");
44 std::cerr << "DSCCODA: prun: provides " << std::endl;
45 add_port("BASIC_short", "provides", "prun_in_port");
47 //catch(const PortAlreadyDefined& ex)
48 catch(PortAlreadyDefined ex)
50 std::cerr << "DSCCODA: deja defini" << ex.what() << std::endl;
51 //Ports already created : we use them
55 std::cerr << "DSCCODA: exception inconnue" << std::endl;
64 std::cerr << "DSCCODA: trun: uses " << std::endl;
65 add_port("BASIC_short", "uses", "trun_out_port");
66 std::cerr << "DSCCODA: trun: provides " << std::endl;
67 add_port("BASIC_short", "provides", "trun_in_port");
69 catch(const PortAlreadyDefined& ex)
71 std::cerr << "DSCCODA: deja defini" << std::endl;
72 //Ports already created : we use them
76 std::cerr << "DSCCODA: exception inconnue" << std::endl;
83 void DSCCODA_i::prun(CORBA::Long niter)
85 cout << "DSCCODA_i::prun" << endl;
86 uses_port * temp = NULL;
87 get_port(temp, "prun_out_port");
88 _out_port = dynamic_cast<data_short_port_uses *>(temp);
89 //get_port((uses_port*&)_out_port, "run_out_port");
91 provides_port * temp2 = NULL;
92 get_port(temp2, "prun_in_port");
93 _in_port = dynamic_cast<data_short_port_provides *>(temp2);
97 for(int i=0;i<niter;i++)
100 cout << "DSCCODA Got: " << j << endl;
106 void DSCCODA_i::trun(CORBA::Long niter)
108 cout << "DSCCODA_i::trun" << endl;
109 uses_port * temp = NULL;
110 get_port(temp, "trun_out_port");
111 _out_port = dynamic_cast<data_short_port_uses *>(temp);
112 //get_port((uses_port*&)_out_port, "run_out_port");
114 provides_port * temp2 = NULL;
115 get_port(temp2, "trun_in_port");
116 _in_port = dynamic_cast<data_short_port_provides *>(temp2);
119 for(int i=0;i<niter;i++)
122 cout << "DSCCODA Got: " << j << endl;
131 PortableServer::ObjectId * DSCCODAEngine_factory( CORBA::ORB_ptr orb,
132 PortableServer::POA_ptr poa,
133 PortableServer::ObjectId * contId,
134 const char *instanceName,
135 const char *interfaceName)
137 MESSAGE("PortableServer::ObjectId * DSCCODAEngine_factory()");
138 DSCCODA_i * myEngine = new DSCCODA_i(orb, poa, contId, instanceName, interfaceName);
139 return myEngine->getId() ;