diff options
| author | Manuel Traut <manut@mecka.net> | 2012-06-07 16:00:59 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2012-06-07 16:00:59 +0200 |
| commit | e3f225cd4fb60437d94288849f7af03179d56f6b (patch) | |
| tree | 7c4ef56f5c83fc6cdd6d74a0aa8011f0f39b0307 /common | |
| parent | f5e17d19e473e501ffa964ec3ccda1970ecafbf2 (diff) | |
retriving digital ios inside a device works now
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'common')
| -rw-r--r-- | common/Makefile | 5 | ||||
| -rw-r--r-- | common/distrio_helper.cpp | 13 | ||||
| -rw-r--r-- | common/distrio_helper.h | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/common/Makefile b/common/Makefile index c869a74..27498ac 100644 --- a/common/Makefile +++ b/common/Makefile @@ -7,8 +7,9 @@ DISTRIO_BASE = ../ DISTRIO_IO = $(DISTRIO_BASE)io/lib DISTRIO_MANAGER = $(DISTRIO_BASE)manager/lib -CFLAGS += -fPIC -I. -I$(DISTRIO_IO) -I$(DISTRIO_MANAGER) +CFLAGS += -g -fPIC -I. -I$(DISTRIO_IO) -I$(DISTRIO_MANAGER) CXXFLAGS += $(CFLAGS) +LDFLAGS += -lrt TAO_IDL := tao_idl @@ -22,7 +23,7 @@ IDL_CLEANFILES = $(COMPONENT)C.cpp $(COMPONENT)C.inl $(COMPONENT)I.h \ $(COMPONENT)S.h $(COMPONENT)C.h $(COMPONENT)S.cpp all: $(OBJ) - $(LD) -shared -o $(LIB) $(OBJ) + $(LD) $(LDFLAGS) -shared -o $(LIB) $(OBJ) .PHONY: idl idl: diff --git a/common/distrio_helper.cpp b/common/distrio_helper.cpp index 076719c..ad0a5cd 100644 --- a/common/distrio_helper.cpp +++ b/common/distrio_helper.cpp @@ -56,7 +56,7 @@ out: return ret; } -int register_digital (std::string _name, Distrio_Digital_i *digital) +int register_digital (Distrio_Digital_i *digital) { CosNaming::Name name; CORBA::Object_var obj, manager_obj; @@ -73,12 +73,13 @@ int register_digital (std::string _name, Distrio_Digital_i *digital) oid = ref.poa->activate_object (digital); obj = digital->_this (); name.length (1); - name[0].id = CORBA::string_dup (_name.c_str ()); + e = digital->name (name[0].id); + free (e); name[0].kind = CORBA::string_dup ("digital_io"); ref.nc->rebind (name, obj.in ()); - } catch (CORBA::Exception &e) { + } catch (CORBA::Exception &exc) { std::cerr << "CORBA bind digital io at naming service failed: " - << e << std::endl; + << exc << std::endl; return -1; } @@ -120,9 +121,11 @@ Distrio::Digital_ptr lookup_digital (std::string _name) for (unsigned int i = 0; i < dig_list->length (); i++) { ::CORBA::String_var name; Distrio::Error *e; + e = dig_list[i]->name (name); free (e); - if (! _name.compare (name)) { + + if (! _name.compare (name.in ())) { Distrio::Digital_ptr ptr = dig_list[i]; return ptr; } diff --git a/common/distrio_helper.h b/common/distrio_helper.h index 3f96d93..69a6ef0 100644 --- a/common/distrio_helper.h +++ b/common/distrio_helper.h @@ -42,7 +42,7 @@ static corba_ref ref = { /** initialize corba orb - argc, argv as passed to main() */ int init_corba (int argc, char **argv); /** register a digital io with a common name at the naming service */ -int register_digital (std::string _name, Distrio_Digital_i *digital); +int register_digital (Distrio_Digital_i *digital); /** lookup a digital io by a common name at the manager */ Distrio::Digital_ptr lookup_digital (std::string _name); /** register a device with a common name at the naming service */ |
