Created
March 6, 2018 13:53
-
-
Save timcardenuto/63d3a03100ae415536206862394be572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
c++ -o test test.cpp -I/usr/local/redhawk/core/include -I/usr/local/redhawk/core/include/ossie -L/usr/local/redhawk/core/lib64 -L/usr/lib64 -lbulkio-2.1 -lbulkioInterfaces -lossiecf -lossieidl -lomniORB4 -lomnithread -DHAVE_BOOST -lboost_system-mt | |
*/ | |
#include <string> | |
#include <iostream> | |
#include <boost/thread.hpp> | |
//#include <ossie/Component.h> | |
#include <ossie/PortSupplier_impl.h> | |
#include <bulkio/bulkio.h> | |
class Test : public PortSupplier_impl {//public Component { | |
const char* uuid; | |
const char* label; | |
bulkio::InFloatPort *dataFloat; | |
public: | |
Test(const char*, const char*); | |
~Test(); | |
const char* getUuid(); | |
const char* getLabel(); | |
void run(); | |
}; | |
Test::Test(const char* _uuid, const char* _label) : PortSupplier_impl() {//Component(_uuid, _label) { | |
std::cout << "Test()" << std::endl; | |
uuid = _uuid; | |
std::cout << "set uuid to: " << uuid << std::endl; | |
label = _label; | |
std::cout << "set label to: " << label << std::endl; | |
// create bulkio port | |
dataFloat = new bulkio::InFloatPort("dataFloat"); | |
//Component *com = new Component("abcd"); | |
//com->addPort("dataFloat", dataFloat); | |
std::cout <<"addPort"<< std::endl; | |
addPort("dataFloat", dataFloat); | |
} | |
Test::~Test() { | |
// destroy bulkio port | |
//dataFloat->_remove_ref(); | |
//dataFloat = 0; | |
} | |
const char* Test::getUuid() { | |
std::cout << "getUuid()" << std::endl; | |
return uuid; | |
} | |
const char* Test::getLabel() { | |
std::cout << "getLabel()" << std::endl; | |
return label; | |
} | |
void Test::run() { | |
/* | |
int count = 0; | |
while(count < 10) { | |
std::cout << "checking bulkio port for data" << std::endl; | |
bulkio::InFloatStream inputStream = dataFloat->getCurrentStream(); | |
if (!inputStream) { // No streams are available | |
continue; | |
} | |
bulkio::FloatDataBlock block = inputStream.read(); | |
if (!block) { // No data available | |
// Propagate end-of-stream | |
if (inputStream.eos()) { | |
} | |
continue; | |
} | |
if (block.sriChanged()) { | |
// Update output SRI | |
} | |
// Get read-only access to the input data | |
redhawk::shared_buffer<float> inputData = block.buffer(); | |
count++; | |
sleep(1); | |
} | |
*/ | |
} | |
int main() { | |
std::cout << "#### Program Start ####" << std::endl; | |
std::string uuid = "abcd"; | |
std::string label = "1234"; | |
Test t(uuid.c_str(), label.c_str()); | |
std::cout << "test uuid: " << t.getUuid() << std::endl; | |
std::cout << "test label: " << t.getLabel() << std::endl; | |
//t.run(); | |
//bulkio::InFloatPort *dataFloat; | |
//dataFloat = new bulkio::InFloatPort("dataFloat"); | |
//Component com(uuid.c_str(), label.c_str()); | |
//Component *com = new Component(uuid.c_str(), label.c_str()); | |
//com->addPort("dataFloat", dataFloat); | |
//std::cout << "instantiated component " << std::endl; | |
//PortSupplier_impl port; | |
sleep(2); | |
//dataFloat->_remove_ref(); | |
//dataFloat = 0; | |
//t.~Test(); | |
std::cout << "#### Program End ####" << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment