diff options
| author | Manuel Traut <manut@mecka.net> | 2012-06-08 02:18:34 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-06-08 02:18:34 +0200 |
| commit | 53166efd73237bdbe762b832050ce7ae08f49b33 (patch) | |
| tree | 1b6b5cf0729fb7c503e298e9c2526ed4a9898e24 | |
| parent | 88c9e7588efbf948cafdd0421665388da63cbe89 (diff) | |
libdistrio_io: implement some generic functions
like get/set id/name for analog and digital io
Signed-off-by: Manuel Traut <manut@mecka.net>
| -rw-r--r-- | io/lib/Makefile | 2 | ||||
| -rw-r--r-- | io/lib/distrio_io.cpp | 35 | ||||
| -rw-r--r-- | io/lib/distrio_io.h | 189 |
3 files changed, 214 insertions, 12 deletions
diff --git a/io/lib/Makefile b/io/lib/Makefile index 4b79e01..008e98f 100644 --- a/io/lib/Makefile +++ b/io/lib/Makefile @@ -27,7 +27,7 @@ all: $(OBJ) idl: $(TAO_IDL) -GI -I$(DISTRIO_BASE)interfaces \ $(DISTRIO_BASE)interfaces/$(COMPONENT).idl - rm -f $(COMPONENT)I.cpp + rm -f $(COMPONENT)I.* .PHONY: idl_clean idl_clean: diff --git a/io/lib/distrio_io.cpp b/io/lib/distrio_io.cpp index deae171..f500159 100644 --- a/io/lib/distrio_io.cpp +++ b/io/lib/distrio_io.cpp @@ -28,7 +28,14 @@ // TAO_IDL - Generated from // be/be_codegen.cpp:1673 -#include "distrio_ioI.h" +#include "distrio_io.h" + +#include <distrio_error.h> + +Distrio_Digital_i::Distrio_Digital_i (std::string _name) +{ + io_name = _name; +} // Implementation skeleton constructor Distrio_Digital_i::Distrio_Digital_i (void) @@ -41,9 +48,10 @@ Distrio_Digital_i::~Distrio_Digital_i (void) } ::Distrio::Error * Distrio_Digital_i::name ( - ::CORBA::String_out name) + ::CORBA::String_out _name) { - // Add your implementation here + _name = CORBA::string_dup (io_name.c_str ()); + return distrio_success (); } ::Distrio::Error * Distrio_Digital_i::set ( @@ -86,15 +94,19 @@ void Distrio_Digital_i::last_update ( ::CORBA::Long Distrio_Digital_i::id ( void) { - // Add your implementation here + return io_id; } void Distrio_Digital_i::id ( - ::CORBA::Long id) + ::CORBA::Long _id) { - // Add your implementation here + io_id = _id; } +Distrio_Analog_i::Distrio_Analog_i (std::string _name) +{ + io_name = _name; +} // Implementation skeleton constructor Distrio_Analog_i::Distrio_Analog_i (void) { @@ -106,9 +118,10 @@ Distrio_Analog_i::~Distrio_Analog_i (void) } ::Distrio::Error * Distrio_Analog_i::name ( - ::CORBA::String_out name) + ::CORBA::String_out _name) { - // Add your implementation here + _name = CORBA::string_dup (io_name.c_str ()); + return distrio_success (); } ::Distrio::Error * Distrio_Analog_i::min ( @@ -157,13 +170,13 @@ void Distrio_Analog_i::last_update ( ::CORBA::Long Distrio_Analog_i::id ( void) { - // Add your implementation here + return io_id; } void Distrio_Analog_i::id ( - ::CORBA::Long id) + ::CORBA::Long _id) { - // Add your implementation here + io_id = _id; } // Implementation skeleton constructor diff --git a/io/lib/distrio_io.h b/io/lib/distrio_io.h new file mode 100644 index 0000000..7e0f394 --- /dev/null +++ b/io/lib/distrio_io.h @@ -0,0 +1,189 @@ +// -*- C++ -*- +// $Id$ + +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v2.1.2 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1616 + +#ifndef DISTRIO_IOI_MYUID7_H_ +#define DISTRIO_IOI_MYUID7_H_ + +#include "distrio_ioS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class Distrio_Digital_i + : public virtual POA_Distrio::Digital +{ +public: + // Constructor + Distrio_Digital_i (std::string _name); + Distrio_Digital_i (void); + + // Destructor + virtual ~Distrio_Digital_i (void); + + virtual + ::Distrio::Error * name ( + ::CORBA::String_out name); + + virtual + ::Distrio::Error * set ( + void); + + virtual + ::Distrio::Error * reset ( + void); + + virtual + ::Distrio::Error * get ( + ::CORBA::Long_out value); + + virtual + ::Distrio::Error * register_callback ( + ::Distrio::Device_ptr dev, + ::Distrio::Digital_trigger trigger); + + virtual + ::Distrio::Timestamp last_update ( + void); + + virtual + void last_update ( + const ::Distrio::Timestamp & last_update); + + virtual + ::CORBA::Long id ( + void); + + virtual + void id ( + ::CORBA::Long id); + +private: + std::string io_name; + ::CORBA::Long io_id; +}; + +class Distrio_Analog_i + : public virtual POA_Distrio::Analog +{ +public: + // Constructor + Distrio_Analog_i (std::string _name); + Distrio_Analog_i (void); + + // Destructor + virtual ~Distrio_Analog_i (void); + + virtual + ::Distrio::Error * name ( + ::CORBA::String_out name); + + virtual + ::Distrio::Error * min ( + ::CORBA::Long_out min); + + virtual + ::Distrio::Error * max ( + ::CORBA::Long_out max); + + virtual + ::Distrio::Error * set ( + ::CORBA::Long value); + + virtual + ::Distrio::Error * get ( + ::CORBA::Long_out value); + + virtual + ::Distrio::Error * register_callback ( + ::Distrio::Device_ptr dev, + const ::Distrio::Analog_trigger & trigger); + + virtual + ::Distrio::Timestamp last_update ( + void); + + virtual + void last_update ( + const ::Distrio::Timestamp & last_update); + + virtual + ::CORBA::Long id ( + void); + + virtual + void id ( + ::CORBA::Long id); +private: + std::string io_name; + ::CORBA::Long io_id; +}; + +class Distrio_Device_i + : public virtual POA_Distrio::Device +{ +public: + // Constructor + Distrio_Device_i (void); + + // Destructor + virtual ~Distrio_Device_i (void); + + virtual + ::Distrio::Error * name ( + ::CORBA::String_out name); + + virtual + ::Distrio::Error * execute ( + const ::Distrio::Dev_function & func); + + virtual + ::Distrio::Error * functions ( + ::Distrio::Dev_function_list_out funcs); + + virtual + ::Distrio::Error * callback_digital ( + ::Distrio::Digital_ptr io_dig); + + virtual + ::Distrio::Error * callback_analog ( + ::Distrio::Analog_ptr io_ana); + + virtual + ::CORBA::Long id ( + void); + + virtual + void id ( + ::CORBA::Long id); +}; + + +#endif /* DISTRIO_IOI_H_ */ |
