Last active
May 10, 2016 23:56
-
-
Save jonathan-beard/6a2fe1d9796cb7bb102cb8b34800fff1 to your computer and use it in GitHub Desktop.
RaftLib hello world. To build, set -std=c++11, link with raftlib library, and make sure you have boost installed.
This file contains 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
#include <raft> | |
#include <raftio> | |
#include <cstdlib> | |
#include <string> | |
class hi : public raft::kernel | |
{ | |
public: | |
hi() : raft::kernel() | |
{ | |
output.addPort< std::string >( "0" ); | |
} | |
virtual raft::kstatus run() | |
{ | |
output[ "0" ].push( std::string( "Hello World\n" ) ); | |
return( raft::stop ); | |
} | |
}; | |
int | |
main( int argc, char **argv ) | |
{ | |
/** instantiate print kernel **/ | |
raft::print< std::string > p; | |
/** instantiate hello world kernel **/ | |
hi hello; | |
/** make a map object **/ | |
raft::map m; | |
/** add kernels to map, both hello and p are executed concurrently **/ | |
m += hello >> p; | |
/** execute the map **/ | |
m.exe(); | |
return( EXIT_SUCCESS ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment