Skip to content

Instantly share code, notes, and snippets.

@jonathan-beard
Last active May 10, 2016 23:56
Show Gist options
  • Save jonathan-beard/6a2fe1d9796cb7bb102cb8b34800fff1 to your computer and use it in GitHub Desktop.
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.
#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