diff options
Diffstat (limited to 'tests/example_module.cpp')
-rw-r--r-- | tests/example_module.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/example_module.cpp b/tests/example_module.cpp new file mode 100644 index 0000000..2191650 --- /dev/null +++ b/tests/example_module.cpp @@ -0,0 +1,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) |