From 9e6c9d52634036e201694315a167b2abc4b4b0bb Mon Sep 17 00:00:00 2001 From: Claudio Scafuri <claudio.scafuri@elettra.eu> Date: Tue, 31 Mar 2020 17:42:02 +0200 Subject: [PATCH] compile on 18.04 x86_64, removed compiler warnings, gitlab conventions --- CHANGELOG | 3 + Makefile | 195 +----------------- BridgeAttr.cpp => src/BridgeAttr.cpp | 0 BridgeAttr.h => src/BridgeAttr.h | 0 BridgeAttribute.h => src/BridgeAttribute.h | 0 ClassFactory.cpp => src/ClassFactory.cpp | 0 .../RPC2TangoBridge.cpp | 16 +- RPC2TangoBridge.h => src/RPC2TangoBridge.h | 0 .../RPC2TangoBridgeClass.cpp | 0 .../RPC2TangoBridgeClass.h | 0 .../RPC2TangoBridgeStateMachine.cpp | 1 - .../RPC2TangoBridgeThread.cpp | 0 .../RPC2TangoBridgeThread.h | 2 +- RPCHandleSet.cpp => src/RPCHandleSet.cpp | 8 +- RPCHandleSet.h => src/RPCHandleSet.h | 0 RpcHandle.cpp => src/RpcHandle.cpp | 2 +- RpcHandle.h => src/RpcHandle.h | 0 RpcReadHandle.cpp => src/RpcReadHandle.cpp | 10 +- RpcReadHandle.h => src/RpcReadHandle.h | 4 +- RpcWriteHandle.cpp => src/RpcWriteHandle.cpp | 8 +- RpcWriteHandle.h => src/RpcWriteHandle.h | 12 +- .../attribute_converter.cpp | 36 ++-- .../attribute_converter.h | 0 main.cpp => src/main.cpp | 5 +- .../read_dynamic_attribute.cpp | 3 +- .../write_dynamic_attribute.cpp | 7 - 26 files changed, 61 insertions(+), 251 deletions(-) rename BridgeAttr.cpp => src/BridgeAttr.cpp (100%) rename BridgeAttr.h => src/BridgeAttr.h (100%) rename BridgeAttribute.h => src/BridgeAttribute.h (100%) rename ClassFactory.cpp => src/ClassFactory.cpp (100%) rename RPC2TangoBridge.cpp => src/RPC2TangoBridge.cpp (97%) rename RPC2TangoBridge.h => src/RPC2TangoBridge.h (100%) rename RPC2TangoBridgeClass.cpp => src/RPC2TangoBridgeClass.cpp (100%) rename RPC2TangoBridgeClass.h => src/RPC2TangoBridgeClass.h (100%) rename RPC2TangoBridgeStateMachine.cpp => src/RPC2TangoBridgeStateMachine.cpp (95%) rename RPC2TangoBridgeThread.cpp => src/RPC2TangoBridgeThread.cpp (100%) rename RPC2TangoBridgeThread.h => src/RPC2TangoBridgeThread.h (99%) rename RPCHandleSet.cpp => src/RPCHandleSet.cpp (96%) rename RPCHandleSet.h => src/RPCHandleSet.h (100%) rename RpcHandle.cpp => src/RpcHandle.cpp (98%) rename RpcHandle.h => src/RpcHandle.h (100%) rename RpcReadHandle.cpp => src/RpcReadHandle.cpp (98%) rename RpcReadHandle.h => src/RpcReadHandle.h (87%) rename RpcWriteHandle.cpp => src/RpcWriteHandle.cpp (97%) rename RpcWriteHandle.h => src/RpcWriteHandle.h (54%) rename attribute_converter.cpp => src/attribute_converter.cpp (86%) rename attribute_converter.h => src/attribute_converter.h (100%) rename main.cpp => src/main.cpp (90%) rename read_dynamic_attribute.cpp => src/read_dynamic_attribute.cpp (99%) rename write_dynamic_attribute.cpp => src/write_dynamic_attribute.cpp (95%) diff --git a/CHANGELOG b/CHANGELOG index 68d32ab..2de76b1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,3 +7,6 @@ 2013/03/06 release_04 - compilato con tango-8.0.5 + +2020/03/31 release 1.0.1 +- moved to gitlab, new project structure and makefile, compiled on 18.04 x86_64 diff --git a/Makefile b/Makefile index d513ada..c31fd4b 100644 --- a/Makefile +++ b/Makefile @@ -1,193 +1,6 @@ -#============================================================================= -# -# file : Makefile -# -# description : Include for the RPC2TangoBridge class. -# -# project : Makefile to generate a Tango server -# -# $Author: claudio $ -# -# $Revision: 1.8 $ -# -# -# copyleft : European Synchrotron Radiation Facility -# BP 220, Grenoble 38043 -# FRANCE -# -#============================================================================= -# This file is generated by POGO -# (Program Obviously used to Generate tango Object) -# -# (c) - Software Engineering Group - ESRF -#============================================================================= -# +NAME_SRV = rpc2tango-bridge-srv -CLASS = RPC2TangoBridge -MAJOR_VERS = 1 -MINOR_VERS = 1 -RELEASE = Release_$(MAJOR_VERS)_$(MINOR_VERS) +CXXFLAGS += -I/runtime/elettra/include +LDFLAGS += -L/runtime/elettra/lib -llpc -lnc -lRpcResolver -llpcresolve -#----------------------------------------- -# Set default home directories -#----------------------------------------- - -TANGO_HOME = /usr/local/tango-9.2.5a -OMNI_HOME = /usr/local/omniorb-4.2.1 -ZMQ_HOME = //usr/local/zeromq-4.0.7 -CPP_SERVERS = $(TANGO_HOME)/cppserver - - - -#ifdef no_debug - DEBUG = -O2 -#else -# DEBUG = -g -#endif - -CC = c++ -CC_SHLIB = $(CC) -fPIC -AR = ar - -AR_SL = $(CC) -fPIC -shared -SL_EXT = so -VERS_OPT = -Wl,-soname, - -INCLUDE_DIRS = -I$(TANGO_HOME)/include/tango \ - -I$(OMNI_HOME)/include \ - -I$(ZMQ_HOME)/include \ - -I. \ - -I$(CPP_SERVERS)/include -I/runtime/elettra/include - -SERVER_DIR = ./rpcserver -OBJS_DIR = obj -LIB_DIRS = -L $(TANGO_HOME)/lib -L $(OMNI_HOME)/lib -L$(ZMQ_HOME)/lib -L/runtime/elettra/lib - -TARGET_LIB = $(CPP_SERVERS)/lib/libtgclasses.a - - -#----------------------------------------- -# Set CXXFLAGS and LFLAGS -#----------------------------------------- - - -CXXFLAGS = -std=c++0x $(DEBUG) -D_REENTRANT $(INCLUDE_DIRS) -LFLAGS = $(DEBUG) $(LIB_DIRS) \ - -ltango \ - -llog4tango \ - -lomniORB4 \ - -lomniDynamic4 \ - -lomnithread \ - -lCOS4 \ - -lzmq \ - -ldl -lpthread -llpc -lnc \ - -lRpcResolver -llpcresolve - - - - -#----------------------------------------- -# Set dependences -#----------------------------------------- - -DEPENDPATH += $(SERVER_DIR) - -SVC_OBJS = $(OBJS_DIR)/main.o \ - $(OBJS_DIR)/ClassFactory.o \ - $(OBJS_DIR)/$(CLASS)Class.o \ - $(OBJS_DIR)/$(CLASS)StateMachine.o \ - $(OBJS_DIR)/$(CLASS).o \ - $(OBJS_DIR)/RPC2TangoBridgeThread.o \ - $(OBJS_DIR)/BridgeAttr.o \ - $(OBJS_DIR)/RpcHandle.o $(OBJS_DIR)/RpcWriteHandle.o \ - $(OBJS_DIR)/read_dynamic_attribute.o \ - $(OBJS_DIR)/write_dynamic_attribute.o \ - $(OBJS_DIR)/attribute_converter.o \ - $(OBJS_DIR)/RPCHandleSet.o \ - $(OBJS_DIR)/RpcReadHandle.o - -SHLIB_OBJS = $(OBJS_DIR)/RPC2TangoBridgeThread.so.o \ - $(OBJS_DIR)/$(CLASS)Class.so.o \ - $(OBJS_DIR)/$(CLASS)StateMachine.so.o \ - $(OBJS_DIR)/$(CLASS).so.o - - -SVC_INC = $(CLASS)Class.h \ - RPC2TangoBridgeThread.h \ - BridgeAttr.h \ - RpcHandle.h \ - RpcWriteHandle.h \ - attribute_converter.h \ - RPCHandleSet.h \ - RpcReadHandle.h \ - $(CLASS).h - - -$(OBJS_DIR)/%.o: %.cpp $(SVC_INC) - $(CC) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.o - -$(OBJS_DIR)/%.so.o: %.cpp $(SVC_INC) - $(CC_SHLIB) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.so.o - - -#----------------------------------------- -# Make Entry -#----------------------------------------- -all: $(CLASS) - -$(CLASS): make_obj_dir make_bin_dir $(SVC_OBJS) - $(CC) $(SVC_OBJS) -o $(CLASS) $(LFLAGS) - @mv $(CLASS) bin/$(CLASS) - -shlib: make_obj_dir make_shlib_dir $(SHLIB_OBJS) - $(AR_SL) -o \ - shlib/$(CLASS).$(SL_EXT).$(MAJOR_VERS).$(MINOR_VERS) \ - $(VERS_OPT)shlib/$(CLASS).$(SL_EXT).$(MAJOR_VERS) \ - $(SHLIB_OBJS) $(LFLAGS) - @rm -f shlib/$(CLASS).$(SL_EXT) - @cd shlib; \ - ln -s $(CLASS).$(SL_EXT).$(MAJOR_VERS).$(MINOR_VERS) $(CLASS).$(SL_EXT) - -clean: - rm -f $(OBJS_DIR)/*.o \ - $(OBJS_DIR)/*.so.o \ - bin/$(CLASS) \ - core - -make_obj_dir: - @mkdir -p obj - -make_bin_dir: - @mkdir -p bin - -make_shlib_dir: - @mkdir -p shlib - -#----------------------------------------- -# Install binary file -#----------------------------------------- -install: - cp bin/$(CLASS) $(TANGO_HOME)/bin - -#----------------------------------------- -# Update class library and header files -# recompile without debug mode. -#----------------------------------------- -lib: clean - @make no_debug=1 - cp *.h $(CPP_SERVERS)/include - ar ruv $(TARGET_LIB)/$(CLASS).o - ar ruv $(TARGET_LIB)/$(CLASS)Class.o - ar ruv $(TARGET_LIB)/$(CLASS)StateMachine.o - ident $(TARGET_LIB)/* | grep $(CLASS) - -#---------------------------------------------------- -# Tag the CVS module corresponding to this class -#---------------------------------------------------- -tag: - @cvstag "$(CLASS)-$(RELEASE)" - @make $(CLASS) - @make show_tag - -show_tag: - @cvstag -d +include ../makefiles/Make-9.3.3.in diff --git a/BridgeAttr.cpp b/src/BridgeAttr.cpp similarity index 100% rename from BridgeAttr.cpp rename to src/BridgeAttr.cpp diff --git a/BridgeAttr.h b/src/BridgeAttr.h similarity index 100% rename from BridgeAttr.h rename to src/BridgeAttr.h diff --git a/BridgeAttribute.h b/src/BridgeAttribute.h similarity index 100% rename from BridgeAttribute.h rename to src/BridgeAttribute.h diff --git a/ClassFactory.cpp b/src/ClassFactory.cpp similarity index 100% rename from ClassFactory.cpp rename to src/ClassFactory.cpp diff --git a/RPC2TangoBridge.cpp b/src/RPC2TangoBridge.cpp similarity index 97% rename from RPC2TangoBridge.cpp rename to src/RPC2TangoBridge.cpp index 861222a..6e5dcbb 100644 --- a/RPC2TangoBridge.cpp +++ b/src/RPC2TangoBridge.cpp @@ -1,4 +1,3 @@ -static const char *RcsId = "$Header: /home/cvsadm/cvsroot/elettra/server/RPC2TangoBridge/RPC2TangoBridge.cpp,v 1.6 2017-03-28 09:39:02 claudio Exp $"; //+============================================================================= // // file : RPC2TangoBridge.cpp @@ -124,15 +123,10 @@ RPC2TangoBridge::RPC2TangoBridge(Tango::DeviceClass *cl,const char *s,const char void RPC2TangoBridge::delete_device() { // Delete device's allocated object - int cnt = 0, handlecnt = 0; - int totatt; + set_state(Tango::CLOSE); set_status("deallocating attributes and freeing resources"); - //printf("\e[1;32m*\e[0m freeing RPC resources and deleting dynamic attributes...\n"); - - totatt = namesMap.size() + spectrumNamesMap.size(); - map<string, BridgeAttr* >::iterator mapiter; /* NOTE: tango: device.c if an attribute already exists, the new attribute is deleted! * So: remove all attributes in delete device. @@ -249,7 +243,7 @@ void RPC2TangoBridge::get_device_property() */ void RPC2TangoBridge::AllocateAttributes() { - int i = 0, totatt = 0, j; + //int i = 0, totatt = 0, j; char rpcentity[MAXLEN]; UserDefaultAttrProp default_att_prop; @@ -275,14 +269,14 @@ void RPC2TangoBridge::AllocateAttributes() // //exit(EXIT_SUCCESS); // } - for(i = 0; i < rpc_items.size(); i++) + for(unsigned int i = 0; i < rpc_items.size(); i++) { // printf("\n- rpc_items %d:\"%s\"\n", i, rpc_items[i].c_str()); memset(rpcentity, 0, MAXLEN); strncpy(rpcentity, rpc_items[i].c_str(), MAXLEN - 1); // print_progress(totatt, i); - bool force_is_spectrum = force_spectrum(rpcentity); + /*bool force_is_spectrum = */force_spectrum(rpcentity); map<string, BridgeAttr*> ::iterator scalarMapIter = namesMap.find(string(rpcentity)); map<string, SpectrumBridgeAttr*> ::iterator spectrumMapIter = spectrumNamesMap.find(string(rpcentity)); if( scalarMapIter != namesMap.end() || spectrumMapIter != spectrumNamesMap.end() ) @@ -546,7 +540,7 @@ void RPC2TangoBridge::on() bool RPC2TangoBridge::force_spectrum(char *s) { - int i; + unsigned int i; for(i = 0; i < strlen(s); i++) if(s[i] == ',') break; diff --git a/RPC2TangoBridge.h b/src/RPC2TangoBridge.h similarity index 100% rename from RPC2TangoBridge.h rename to src/RPC2TangoBridge.h diff --git a/RPC2TangoBridgeClass.cpp b/src/RPC2TangoBridgeClass.cpp similarity index 100% rename from RPC2TangoBridgeClass.cpp rename to src/RPC2TangoBridgeClass.cpp diff --git a/RPC2TangoBridgeClass.h b/src/RPC2TangoBridgeClass.h similarity index 100% rename from RPC2TangoBridgeClass.h rename to src/RPC2TangoBridgeClass.h diff --git a/RPC2TangoBridgeStateMachine.cpp b/src/RPC2TangoBridgeStateMachine.cpp similarity index 95% rename from RPC2TangoBridgeStateMachine.cpp rename to src/RPC2TangoBridgeStateMachine.cpp index 8cd9e8a..8383a13 100644 --- a/RPC2TangoBridgeStateMachine.cpp +++ b/src/RPC2TangoBridgeStateMachine.cpp @@ -1,4 +1,3 @@ -static const char *RcsId = "$Header: /home/cvsadm/cvsroot/elettra/server/RPC2TangoBridge/RPC2TangoBridgeStateMachine.cpp,v 1.1.1.1 2008-04-28 09:13:16 giacomo Exp $"; //+============================================================================= // // file : RPC2TangoBridgeStateMachine.cpp diff --git a/RPC2TangoBridgeThread.cpp b/src/RPC2TangoBridgeThread.cpp similarity index 100% rename from RPC2TangoBridgeThread.cpp rename to src/RPC2TangoBridgeThread.cpp diff --git a/RPC2TangoBridgeThread.h b/src/RPC2TangoBridgeThread.h similarity index 99% rename from RPC2TangoBridgeThread.h rename to src/RPC2TangoBridgeThread.h index 1f34698..8d35fcd 100644 --- a/RPC2TangoBridgeThread.h +++ b/src/RPC2TangoBridgeThread.h @@ -23,6 +23,6 @@ class RPC2TangoBridgeThread : public omni_thread }; -}; +} #endif diff --git a/RPCHandleSet.cpp b/src/RPCHandleSet.cpp similarity index 96% rename from RPCHandleSet.cpp rename to src/RPCHandleSet.cpp index 06d111e..550fa4d 100644 --- a/RPCHandleSet.cpp +++ b/src/RPCHandleSet.cpp @@ -19,7 +19,7 @@ RPCHandleSet *RPCHandleSet::instance() RPCReadHandle *RPCHandleSet::readHandleFromList(const char *rpc_call) { - int i, res; + unsigned int i, res; RPCReadHandle *han; char *host; short int port; @@ -41,7 +41,7 @@ RPCReadHandle *RPCHandleSet::readHandleFromList(const char *rpc_call) RPCWriteHandle *RPCHandleSet::writeHandleFromList(const char *rpc_call) { - int i, res; + unsigned int i, res; RPCWriteHandle *han; char *host; short int port; @@ -63,7 +63,7 @@ RPCWriteHandle *RPCHandleSet::writeHandleFromList(const char *rpc_call) void RPCHandleSet::removeHandle(RPCHandle *h) { - int i; + unsigned int i; for(i = 0; i < rpcHandles.size(); i++) { if(rpcHandles[i] == h) @@ -81,7 +81,7 @@ void RPCHandleSet::removeHandle(RPCHandle *h) RPCHandle *RPCHandleSet::handleFromList(const char *rpc_call) { - int i, res; + unsigned int i, res; RPCHandle *han; char *host; short int port; diff --git a/RPCHandleSet.h b/src/RPCHandleSet.h similarity index 100% rename from RPCHandleSet.h rename to src/RPCHandleSet.h diff --git a/RpcHandle.cpp b/src/RpcHandle.cpp similarity index 98% rename from RpcHandle.cpp rename to src/RpcHandle.cpp index 01fdd61..05d5a61 100644 --- a/RpcHandle.cpp +++ b/src/RpcHandle.cpp @@ -105,7 +105,7 @@ bool RPCHandle::connected() int RPCHandle::split_rpccall(const char *call, char* fam, char *mem, char* act, char* mode) { - int i = 0, delim1, delim2, delim3; + unsigned int i = 0, delim1, delim2, delim3; int underline_cnt = 0; int calllen = strlen(call); diff --git a/RpcHandle.h b/src/RpcHandle.h similarity index 100% rename from RpcHandle.h rename to src/RpcHandle.h diff --git a/RpcReadHandle.cpp b/src/RpcReadHandle.cpp similarity index 98% rename from RpcReadHandle.cpp rename to src/RpcReadHandle.cpp index 3d2312b..46fdf7f 100644 --- a/RpcReadHandle.cpp +++ b/src/RpcReadHandle.cpp @@ -10,9 +10,9 @@ RPCReadHandle::RPCReadHandle(RPCHandle* h) : RPCHandle(h) } -long int RPCReadHandle::read_long(const char *callname, int* ok) +idl_long_int RPCReadHandle::read_long(const char *callname, int* ok) { - long int ret; + idl_long_int ret; char error[MAXERRLEN]; long res = -1; char fam[RPCSPLITLEN], mem[RPCSPLITLEN], act[RPCSPLITLEN], mode[RPCSPLITLEN]; @@ -121,9 +121,9 @@ unsigned char RPCReadHandle::read_uchar(const char *callname, int* ok) } -short int RPCReadHandle::read_short(const char *callname, int* ok) +idl_short_int RPCReadHandle::read_short(const char *callname, int* ok) { - short ret; + idl_short_int ret; long res = -1; char error[MAXERRLEN]; char fam[RPCSPLITLEN], mem[RPCSPLITLEN], act[RPCSPLITLEN], mode[RPCSPLITLEN]; @@ -405,7 +405,7 @@ booleanArray RPCReadHandle::read_sboolean(const char *callname, int* ok) booleanArray rdata; rdata.length = 0; rdata.sequence = NULL; - long rfLong; + idl_long_int rfLong; if(split_rpccall(callname, fam, mem, act, mode) < 0) { diff --git a/RpcReadHandle.h b/src/RpcReadHandle.h similarity index 87% rename from RpcReadHandle.h rename to src/RpcReadHandle.h index 923db32..71aca56 100644 --- a/RpcReadHandle.h +++ b/src/RpcReadHandle.h @@ -17,9 +17,9 @@ class RPCReadHandle : public RPCHandle public: RPCReadHandle(RPCHandle *h); - long int read_long(const char *callname, int* ok); + idl_long_int read_long(const char *callname, int* ok); double read_double(const char *callname, int* ok); - short int read_short(const char *callname, int* ok); + idl_short_int read_short(const char *callname, int* ok); unsigned char read_uchar(const char *callname, int* ok); unsigned char read_boolean(const char *callname, int* ok); string read_string(const char *callname, int* ok); diff --git a/RpcWriteHandle.cpp b/src/RpcWriteHandle.cpp similarity index 97% rename from RpcWriteHandle.cpp rename to src/RpcWriteHandle.cpp index f31c841..4239fdd 100644 --- a/RpcWriteHandle.cpp +++ b/src/RpcWriteHandle.cpp @@ -21,7 +21,7 @@ RPCWriteHandle::~RPCWriteHandle() } -bool RPCWriteHandle::write_long(const char *callname, long lvalue) +bool RPCWriteHandle::write_long(const char *callname, idl_long_int lvalue) { bool ret; char error[MAXERRLEN]; @@ -107,7 +107,7 @@ bool RPCWriteHandle::write_double(const char *callname, double dvalue) return ret; } -bool RPCWriteHandle::write_short(const char *callname, short svalue) +bool RPCWriteHandle::write_short(const char *callname, idl_short_int svalue) { bool ret; long res = -1; @@ -148,7 +148,7 @@ bool RPCWriteHandle::write_short(const char *callname, short svalue) bool RPCWriteHandle::write_string(const char *callname, char **s) { - bool ret; +// bool ret; // long res = -1; // char error[MAXERRLEN]; // char fam[RPCSPLITLEN], mem[RPCSPLITLEN], act[RPCSPLITLEN], mode[RPCSPLITLEN]; @@ -182,7 +182,7 @@ bool RPCWriteHandle::write_string(const char *callname, char **s) // /* release lock */ // unlockRpc(); //printf("\e[1;35m;4minfo\e[0m write_string not implemented yet\n"); - ret = -1; +// ret = -1; return false; } diff --git a/RpcWriteHandle.h b/src/RpcWriteHandle.h similarity index 54% rename from RpcWriteHandle.h rename to src/RpcWriteHandle.h index 7179715..e0750ad 100644 --- a/RpcWriteHandle.h +++ b/src/RpcWriteHandle.h @@ -21,12 +21,12 @@ class RPCWriteHandle : public RPCHandle RPCWriteHandle(RPCHandle *h); ~RPCWriteHandle(); - bool write_long(const char *callname, long lvalue); - bool write_double(const char *callname, double dvalue); - bool write_short(const char *callname, short svalue); - bool write_boolean(const char *callname, bool bval); - bool write_string(const char *callname, char **string); - bool write_void(const char *callname); + bool write_long(const char *callname, idl_long_int lvalue); + bool write_double(const char *callname, double dvalue); + bool write_short(const char *callname, idl_short_int svalue); + bool write_boolean(const char *callname, bool bval); + bool write_string(const char *callname, char **string); + bool write_void(const char *callname); private: diff --git a/attribute_converter.cpp b/src/attribute_converter.cpp similarity index 86% rename from attribute_converter.cpp rename to src/attribute_converter.cpp index 0b2974b..4b2c06d 100644 --- a/attribute_converter.cpp +++ b/src/attribute_converter.cpp @@ -28,8 +28,8 @@ AttributeConverter::AttributeConverter(char *propertyName, bool force_spectrum) char fam[RPCSPLITLEN], mem[RPCSPLITLEN], act[RPCSPLITLEN], mode[RPCSPLITLEN]; UserDefaultAttrProp default_att_prop; - Database *db = new Database(); - DbData data; + //Database *db = new Database(); + //DbData data; memset(fam, 0, RPCSPLITLEN); memset(mem, 0, RPCSPLITLEN); @@ -69,8 +69,9 @@ AttributeConverter::AttributeConverter(char *propertyName, bool force_spectrum) } else if(data_type < 0) { - snprintf(res, 256, "\e[1;31m* \e[0merror creating \"%s\"" - "\e[0;37m [\e[1;31munrecognized data type \e[0;37m]\e[0m", propertyName); +// snprintf(res, 256, "\e[1;31m* \e[0merror creating \"%s\"" +// "\e[0;37m [\e[1;31munrecognized data type \e[0;37m]\e[0m", propertyName); + snprintf(res, 256, "merror creating %s :unrecognized data type ", propertyName); result = string(res); } } @@ -103,7 +104,7 @@ bool AttributeConverter::string1_contains2(const char* s1, const char* s2) */ bool AttributeConverter::isReadWrite(char* entry, char * rname, char *rwname) { - int i; + unsigned int i; memset(rname, 0, MAXLEN); memset(rwname, 0, MAXLEN); for(i = 0; i< MAXLEN - 1 && i < strlen(entry); i++) @@ -192,9 +193,10 @@ SpectrumBridgeAttr* AttributeConverter::createSpectrumAttribute(const char* name if(spattr != NULL) { - snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mspectrum" - "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRO\e[0;37m]\e[0m", - name, dataType(data_type).c_str()); +// snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mspectrum" +// "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRO\e[0;37m]\e[0m", +// name, dataType(data_type).c_str()); + snprintf(res, 256, "created %s spectrum %s", name, dataType(data_type).c_str()); result = string(res); default_att_prop.set_description(desc); @@ -217,9 +219,12 @@ BridgeAttr* AttributeConverter::createScalarAttribute(const char* name, long int if(attr != NULL) { - snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mscalar" - "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRO\e[0;37m]\e[0m", - name, dataType(data_type).c_str()); +// snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mscalar" +// "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRO\e[0;37m]\e[0m", +// name, dataType(data_type).c_str()); + + snprintf(res, 256, "created %s scalar %s", name, dataType(data_type).c_str()); + result = string(res); default_att_prop.set_description(desc); attr->set_default_properties(default_att_prop); @@ -241,9 +246,12 @@ BridgeAttr* AttributeConverter::createScalarAttribute(const char* name, const ch printf(".....createScalarAttribute_write %s %s\n",name,writeName); if(attr != NULL) { - snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mscalar" - "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRW\e[0;37m]\e[0m", - name, dataType(data_type).c_str()); +// snprintf(res, 256, "\e[1;32m* \e[0mcreated \"%s\"\t\e[0;37m[\e[0;32mscalar" +// "\e[0;37m, \e[0;32m%s\e[0;37m, \e[0;32mRW\e[0;37m]\e[0m", +// name, dataType(data_type).c_str()); + + snprintf(res, 256, "created %s scalar %s", name, dataType(data_type).c_str()); + default_att_prop.set_description(desc); attr->set_default_properties(default_att_prop); } diff --git a/attribute_converter.h b/src/attribute_converter.h similarity index 100% rename from attribute_converter.h rename to src/attribute_converter.h diff --git a/main.cpp b/src/main.cpp similarity index 90% rename from main.cpp rename to src/main.cpp index 797873b..762c4e2 100644 --- a/main.cpp +++ b/src/main.cpp @@ -1,4 +1,3 @@ -static const char *RcsId = "$Header: /home/cvsadm/cvsroot/elettra/server/RPC2TangoBridge/main.cpp,v 1.1.1.1 2008-04-28 09:13:16 giacomo Exp $"; //+============================================================================= // // file : main.cpp @@ -37,7 +36,7 @@ static const char *RcsId = "$Header: /home/cvsadm/cvsroot/elettra/server/RPC2Tan int main(int argc,char *argv[]) { - Tango::Util *tg; + Tango::Util *tg=0; try { // Initialise the device server @@ -66,6 +65,6 @@ int main(int argc,char *argv[]) cout << "Received a CORBA_Exception" << endl; cout << "Exiting" << endl; } - tg->server_cleanup(); + if (tg) tg->server_cleanup(); return(0); } diff --git a/read_dynamic_attribute.cpp b/src/read_dynamic_attribute.cpp similarity index 99% rename from read_dynamic_attribute.cpp rename to src/read_dynamic_attribute.cpp index 50fc9d0..7fb2c34 100644 --- a/read_dynamic_attribute.cpp +++ b/src/read_dynamic_attribute.cpp @@ -35,7 +35,6 @@ void RPC2TangoBridge::read_dynamic_attribute(Tango::Attribute &attr) int i; int ok; - bool release = true; /* tells Attribute::set_value to free memory after usage */ char error[256]; /* search name in scalars map first */ @@ -141,6 +140,7 @@ void RPC2TangoBridge::read_dynamic_attribute(Tango::Attribute &attr) if(ok) { DevBoolean *db = new DevBoolean; + sb.length = 1; if(rpcBool == 0) *db = false; else @@ -157,6 +157,7 @@ void RPC2TangoBridge::read_dynamic_attribute(Tango::Attribute &attr) if(ok) { DevBoolean *db = new DevBoolean; + sb.length = 1; if(rpcBool == 0) *db = false; else diff --git a/write_dynamic_attribute.cpp b/src/write_dynamic_attribute.cpp similarity index 95% rename from write_dynamic_attribute.cpp rename to src/write_dynamic_attribute.cpp index c4753a2..50a5d7f 100644 --- a/write_dynamic_attribute.cpp +++ b/src/write_dynamic_attribute.cpp @@ -22,19 +22,12 @@ bool RPC2TangoBridge::write_dynamic_attribute(Tango::WAttribute &attr) DevShort ds; DevDouble dd; DevBoolean db; - long int l; double d; short s; - unsigned char uc; string ress; bool b; - int i; - - bool release = true; /* tells Attribute::set_value to free memory after usage */ - char error[256]; - /* search name in scalars map first */ map<string, BridgeAttr*>::iterator mapiter; mapiter = namesMap.find(attr.get_name()); -- GitLab