diff options
Diffstat (limited to 'devices/simple_dev/simple_dev.cpp')
| -rw-r--r-- | devices/simple_dev/simple_dev.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/devices/simple_dev/simple_dev.cpp b/devices/simple_dev/simple_dev.cpp new file mode 100644 index 0000000..eb2dfdd --- /dev/null +++ b/devices/simple_dev/simple_dev.cpp @@ -0,0 +1,45 @@ +#include <distrio_helper.h> +#include <distrio_error.h> + +#include <distrio_ioI.h> + +#include <iostream> + +class My_device : public Distrio_Device_i { + public: + ::CORBA::Long id (void) + { + return my_id; + } + void id (::CORBA::Long id) + { + my_id = id; + } + private: + ::CORBA::Long my_id; +}; + +int main (int argc, char **argv) +{ + int ret = 0; + My_device *dev; + + if (init_corba (argc, argv)) + return -EINVAL; + + if (run_orb ()) + return -EINVAL; + + dev = new My_device (); + + if (register_device ("simpele device", dev)) { + ret = -EINVAL; + goto out; + } + + std::cout << "registered id: " << dev->id () << std::endl; + +out: + free (dev); + return ret; +} |
