Example of Bobolang

This is a sample application (in the bobox/bofe/bobolang directory) which shows the power of Bobolang language. You can perform your own experiments in the model.bobolang file. After you run the application, the file is created. To visualize this file, install dot and run this command:

dot -Tpng -O

This will create file. For example, this Bobolang code:

model main<()><()> {
        bobox::stateless_dummy<()><()> stateless;
        bobox::stateful_dummy<()><()> stateful;
        bobox::parallel_dummy<()><()> parallel;

        input -> stateless -> stateful -> parallel -> output;

produces this image:

#include <fstream>

#include "bobox_manager.hpp"
#include "bobox_results.hpp"
#include "bobox_bobolang.hpp"
#include "bobox_basic_object_factory.hpp"

class runtime : public bobox::runtime, public bobox::basic_object_factory {
        virtual bobox::runtime *get_runtime() BOBOX_OVERRIDE { return this; }

int main(int argc, char *argv[])
        bobox::manager mng(bobox::SS_SMP, 0, bobox::plevel_type(4));

        runtime rt;

        std::ifstream in("model.bobolang");
        if (!in) {
                std::cerr << "Failed to open file 'model.bobolang'" << std::endl;
                return 1;

        bobox::request_id_type rqid = mng.create_request(bobox::bobolang::compile(in, &rt));


        std::ofstream dot("");
        mng.dump_request(rqid, dot, false, false);

        switch (mng.get_result(rqid)) {
                case bobox::RRT_ERROR: std::cout << "Error" << std::endl; break;
                case bobox::RRT_CANCELED: std::cout << "Canceled" << std::endl; break;
                case bobox::RRT_DEADLOCK: std::cout << "Deadlock" << std::endl; break;
                case bobox::RRT_MEMORY: std::cout << "Memory" << std::endl; break;
                case bobox::RRT_OK: std::cout << "OK" << std::endl; break;
                case bobox::RRT_TIMEOUT: std::cout << "Timeout" << std::endl; break;
                default: BOBOX_ASSERT(false); break;


        return 0;