/*THIS IS THE PORT_IMPL.CPP FILE*/ void dataIn_complexShort_i::pushPacket(const PortTypes::ShortSequence &I,const PortTypes::ShortSequence &Q) {//addition 4 lines cout << "Pushpacket received, length " << I.length() << endl; for (unsigned int i =0; i < I.length(); ++i) { cout << "NRZ Receiver: " << I[i] << endl ; nrz_data->bufferI[i]=I[i]; //cout <<"buffer data"<bufferI[i]<start_processing.signal(); //processing_thread = new omni_thread(process_data, (void *) this); //nrzdata_active = true; //processing_thread->start(); }// end for /*THIS IS THE nrz_DATA.CPP FILE*/ NRZ_data_i::NRZ_data_i(const char *uuid, omni_condition *con) : Resource_impl(uuid) { component_running = con; inPort0_servant = new dataIn_complexShort_i(this); inPort0_var = inPort0_servant->_this(); outPort0_servant = new dataOut_complexShort_i(this); outPort0_var = outPort0_servant->_this(); outPort0_active = false; component_alive = true; // addition bufferI.length(16); cout<<"in NRZ.cpp"<< endl; //processing_thread = new omni_thread(process_data, (void *) this); //nrzdata_active = true; //processing_thread->start(); } NRZ_data_i::~NRZ_data_i(void) { delete inPort0_servant; delete outPort0_servant; } CORBA::Object_ptr NRZ_data_i::getPort( const char* _id ) throw (CORBA::SystemException, CF::PortSupplier::UnknownPort) { if (strcmp(_id,"in") == 0) { return inPort0_var; } if (strcmp(_id,"out") == 0) { outPort0_active = true; return CF::Port::_duplicate(outPort0_var); } return NULL; } void NRZ_data_i::start() throw (CORBA::SystemException, CF::Resource::StartError) {// addition 3 lines cout << "starting NRZ process" <start(); } void NRZ_data_i::stop() throw (CORBA::SystemException, CF::Resource::StopError) { nrzdata_active = false; } void NRZ_data_i::releaseObject() throw (CORBA::SystemException, CF::LifeCycle::ReleaseError) { // Clear the component running condition so main shuts down everything component_alive = false; component_running->signal(); } void NRZ_data_i::initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException) { } void NRZ_data_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration) { } //Addition to generated code - whole function void process_data(void *data) { NRZ_data_i *tx = (NRZ_data_i *) data; CORBA::ULong packet_size = (CORBA::ULong) 16; PortTypes::ShortSequence nrzdataI; PortTypes::ShortSequence Q; //int I[10]; //int Q[10]; nrzdataI.length(packet_size); Q.length(packet_size); while(tx->nrzdata_active){ cout <<"processing incoming data"<< endl; /* for ( int i = 0; i < packet_size ; i ++) { I[i] = (CORBA::Short) (rand() % 2); // I[i] = abs(I[i]); Q[i] = (CORBA::Short) i*2; cout << "I data: " << I[i] << endl; }// end for loop*/ //tx->outPort0_servant->send_data(nrzdataI,Q); //sleep(1); } //end while //cout << "I data: " <processing_thread2->exit(); } // end function //nrz_data->start(); nrz_data->process_data(void *data); }