summaryrefslogtreecommitdiff
path: root/tests/example_module.cpp
blob: 21916501cd92aee75ce9a6742013080bbfbac593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.

#include <gras/block.hpp>
#include <gras/factory.hpp>
#include <iostream>

struct MyBlock : gras::Block
{
    MyBlock(void):
        gras::Block("MyBlock")
    {
        this->register_call("get_num", &MyBlock::get_num);
    }

    ~MyBlock(void)
    {
        std::cout << "~MyBlock" << std::endl;
    }

    int get_num(void)
    {
        return 42;
    }

    //dummy work
    void work(const InputItems &, const OutputItems &){}
};

gras::Block *make_my_block(void)
{
    return new MyBlock();
}

GRAS_REGISTER_FACTORY("/tests/my_block", make_my_block)