#include "block.h" #include using namespace std; class OFDMInsertCP : public Block { private: InPort < complex > * in; OutPort < complex > * out; Parameter < long > * NcpPar; Parameter < long > * NcorePar; public: OFDMInsertCP(const Blockopt & blockopt) : Block(blockopt) {} void makeParameters() { NcpPar = new Parameter < long > (this, "Ncp", 64); NcorePar = new Parameter < long > (this, "Ncore", 256); } void makeIOPorts() { in = new InPort < complex > (this, "in", NcorePar->value()); out = new OutPort < complex > (this, "out", NcpPar->value() + NcorePar->value() ); } void go() { complex buffer[NcorePar->value()]; for (int n = 0;n < NcorePar->value() - NcpPar->value() ;n++) buffer[n] = in->read(); for (int n = NcorePar->value() - NcpPar->value(); n < NcorePar->value() ;n++) { buffer[n] = in->read(); out->write(buffer[n]); } for (int n = 0;n < NcorePar->value() ;n++) { out->write(buffer[n]); } } }; PUBLISH(OFDMInsertCP);