From 827eee7ea5fb44f2d2b37a3fdbaa6a1ae2aa96ee Mon Sep 17 00:00:00 2001 From: Alessio Igor Bogani <alessioigorbogani@gmail.com> Date: Wed, 11 Oct 2023 12:41:35 +0200 Subject: [PATCH] Regenerate using Pogo 9.7.8 --- src/Socket2.cpp | 104 ++++++++--------- src/Socket2.h | 57 ++++++---- src/Socket2.xmi | 4 +- src/Socket2Class.cpp | 219 ++++++++++-------------------------- src/Socket2Class.h | 81 +++++++------ src/Socket2StateMachine.cpp | 24 ++-- 6 files changed, 201 insertions(+), 288 deletions(-) diff --git a/src/Socket2.cpp b/src/Socket2.cpp index e739a58..08b97be 100644 --- a/src/Socket2.cpp +++ b/src/Socket2.cpp @@ -84,12 +84,12 @@ namespace Socket2_ns //-------------------------------------------------------- /** - * Method : Socket2::Socket2() - * Description : Constructors for a Tango device + * Method : Socket2::Socket2() + * Description: Constructors for a Tango device * implementing the classSocket2 */ //-------------------------------------------------------- -Socket2::Socket2(Tango::DeviceClass *cl, string &s) +Socket2::Socket2(Tango::DeviceClass *cl, std::string &s) : TANGO_BASE_CLASS(cl, s.c_str()) { /*----- PROTECTED REGION ID(Socket2::constructor_1) ENABLED START -----*/ @@ -121,16 +121,21 @@ Socket2::Socket2(Tango::DeviceClass *cl, const char *s, const char *d) /*----- PROTECTED REGION END -----*/ // Socket2::constructor_3 } +//-------------------------------------------------------- +Socket2::~Socket2() +{ + delete_device(); +} //-------------------------------------------------------- /** - * Method : Socket2::delete_device() - * Description : will be called at device destruction or at init command + * Method : Socket2::delete_device() + * Description: will be called at device destruction or at init command */ //-------------------------------------------------------- void Socket2::delete_device() { - DEBUG_STREAM << "Socket2::delete_device() " << device_name << endl; + DEBUG_STREAM << "Socket2::delete_device() " << device_name << std::endl; /*----- PROTECTED REGION ID(Socket2::delete_device) ENABLED START -----*/ // Delete device allocated objects @@ -144,28 +149,28 @@ void Socket2::delete_device() //-------------------------------------------------------- /** - * Method : Socket2::init_device() - * Description : will be called at device initialization. + * Method : Socket2::init_device() + * Description: will be called at device initialization. */ //-------------------------------------------------------- void Socket2::init_device() { - DEBUG_STREAM << "Socket2::init_device() create device " << device_name << endl; + DEBUG_STREAM << "Socket2::init_device() create device " << device_name << std::endl; /*----- PROTECTED REGION ID(Socket2::init_device_before) ENABLED START -----*/ // Initialization before get_device_property() call init_error.clear(); /*----- PROTECTED REGION END -----*/ // Socket2::init_device_before - + // Get the device properties from database get_device_property(); - + attr_InputLength_read = new Tango::DevLong[1]; attr_OutputLength_read = new Tango::DevLong[1]; attr_Reconnections_read = new Tango::DevLong[1]; - // No longer if mandatory property not set. + // No longer if mandatory property not set. if (mandatoryNotDefined) return; @@ -204,8 +209,8 @@ void Socket2::init_device() //-------------------------------------------------------- /** - * Method : Socket2::get_device_property() - * Description : Read database to initialize property data members. + * Method : Socket2::get_device_property() + * Description: Read database to initialize property data members. */ //-------------------------------------------------------- void Socket2::get_device_property() @@ -232,7 +237,7 @@ void Socket2::get_device_property() // Call database and extract values if (Tango::Util::instance()->_UseDb==true) get_db_device()->get_property(dev_prop); - + // get instance on Socket2Class to get class property Tango::DbDatum def_prop, cl_prop; Socket2Class *ds_class = @@ -334,8 +339,8 @@ void Socket2::get_device_property() } //-------------------------------------------------------- /** - * Method : Socket2::check_mandatory_property() - * Description : For mandatory properties check if defined in database. + * Method : Socket2::check_mandatory_property() + * Description: For mandatory properties check if defined in database. */ //-------------------------------------------------------- void Socket2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum &dev_prop) @@ -344,14 +349,12 @@ void Socket2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatu if (class_prop.is_empty() && dev_prop.is_empty()) { TangoSys_OMemStream tms; - tms << endl <<"Property \'" << dev_prop.name; + tms << std::endl <<"Property \'" << dev_prop.name; if (Tango::Util::instance()->_UseDb==true) tms << "\' is mandatory but not defined in database"; else tms << "\' is mandatory but cannot be defined without database"; - string status(get_status()); - status += tms.str(); - set_status(status); + append_status(tms.str()); mandatoryNotDefined = true; /*----- PROTECTED REGION ID(Socket2::check_mandatory_property) ENABLED START -----*/ cerr << tms.str() << " for " << device_name << endl; @@ -363,19 +366,18 @@ void Socket2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatu //-------------------------------------------------------- /** - * Method : Socket2::always_executed_hook() - * Description : method always executed before any command is executed + * Method : Socket2::always_executed_hook() + * Description: method always executed before any command is executed */ //-------------------------------------------------------- void Socket2::always_executed_hook() { - DEBUG_STREAM << "Socket2::always_executed_hook() " << device_name << endl; + DEBUG_STREAM << "Socket2::always_executed_hook() " << device_name << std::endl; if (mandatoryNotDefined) { - string status(get_status()); Tango::Except::throw_exception( (const char *)"PROPERTY_NOT_SET", - status.c_str(), + get_status().c_str(), (const char *)"Socket2::always_executed_hook()"); } /*----- PROTECTED REGION ID(Socket2::always_executed_hook) ENABLED START -----*/ @@ -397,13 +399,13 @@ void Socket2::always_executed_hook() //-------------------------------------------------------- /** - * Method : Socket2::read_attr_hardware() - * Description : Hardware acquisition for attributes + * Method : Socket2::read_attr_hardware() + * Description: Hardware acquisition for attributes */ //-------------------------------------------------------- -void Socket2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) +void Socket2::read_attr_hardware(TANGO_UNUSED(std::vector<long> &attr_list)) { - DEBUG_STREAM << "Socket2::read_attr_hardware(vector<long> &attr_list) entering... " << endl; + DEBUG_STREAM << "Socket2::read_attr_hardware(std::vector<long> &attr_list) entering... " << std::endl; /*----- PROTECTED REGION ID(Socket2::read_attr_hardware) ENABLED START -----*/ // Add your own code @@ -414,7 +416,7 @@ void Socket2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) //-------------------------------------------------------- /** * Read attribute InputLength related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -422,7 +424,7 @@ void Socket2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) //-------------------------------------------------------- void Socket2::read_InputLength(Tango::Attribute &attr) { - DEBUG_STREAM << "Socket2::read_InputLength(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "Socket2::read_InputLength(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(Socket2::read_InputLength) ENABLED START -----*/ // Set the attribute value attr_InputLength_read[0] = input_queue_length() + data.size(); @@ -433,7 +435,7 @@ void Socket2::read_InputLength(Tango::Attribute &attr) //-------------------------------------------------------- /** * Read attribute OutputLength related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -441,7 +443,7 @@ void Socket2::read_InputLength(Tango::Attribute &attr) //-------------------------------------------------------- void Socket2::read_OutputLength(Tango::Attribute &attr) { - DEBUG_STREAM << "Socket2::read_OutputLength(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "Socket2::read_OutputLength(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(Socket2::read_OutputLength) ENABLED START -----*/ // Set the attribute value attr_OutputLength_read[0] = output_queue_length(); @@ -452,7 +454,7 @@ void Socket2::read_OutputLength(Tango::Attribute &attr) //-------------------------------------------------------- /** * Read attribute Reconnections related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -460,7 +462,7 @@ void Socket2::read_OutputLength(Tango::Attribute &attr) //-------------------------------------------------------- void Socket2::read_Reconnections(Tango::Attribute &attr) { - DEBUG_STREAM << "Socket2::read_Reconnections(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "Socket2::read_Reconnections(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(Socket2::read_Reconnections) ENABLED START -----*/ // Set the attribute value attr_Reconnections_read[0] = reconnections; @@ -471,8 +473,8 @@ void Socket2::read_Reconnections(Tango::Attribute &attr) //-------------------------------------------------------- /** - * Method : Socket2::add_dynamic_attributes() - * Description : Create the dynamic attributes if any + * Method : Socket2::add_dynamic_attributes() + * Description: Create the dynamic attributes if any * for specified device. */ //-------------------------------------------------------- @@ -488,14 +490,14 @@ void Socket2::add_dynamic_attributes() //-------------------------------------------------------- /** * Command Write related method - * Description: * - * @param argin + * + * @param argin */ //-------------------------------------------------------- void Socket2::write(const Tango::DevVarCharArray *argin) { - DEBUG_STREAM << "Socket2::Write() - " << device_name << endl; + DEBUG_STREAM << "Socket2::Write() - " << device_name << std::endl; /*----- PROTECTED REGION ID(Socket2::write) ENABLED START -----*/ check_init(); @@ -607,16 +609,16 @@ void Socket2::write(const Tango::DevVarCharArray *argin) //-------------------------------------------------------- /** * Command Read related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ //-------------------------------------------------------- Tango::DevVarCharArray *Socket2::read(Tango::DevLong argin) { Tango::DevVarCharArray *argout; - DEBUG_STREAM << "Socket2::Read() - " << device_name << endl; + DEBUG_STREAM << "Socket2::Read() - " << device_name << std::endl; /*----- PROTECTED REGION ID(Socket2::read) ENABLED START -----*/ check_init(); @@ -662,16 +664,16 @@ Tango::DevVarCharArray *Socket2::read(Tango::DevLong argin) //-------------------------------------------------------- /** * Command ReadUntil related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ //-------------------------------------------------------- Tango::DevVarCharArray *Socket2::read_until(const Tango::DevVarCharArray *argin) { Tango::DevVarCharArray *argout; - DEBUG_STREAM << "Socket2::ReadUntil() - " << device_name << endl; + DEBUG_STREAM << "Socket2::ReadUntil() - " << device_name << std::endl; /*----- PROTECTED REGION ID(Socket2::read_until) ENABLED START -----*/ check_init(); @@ -729,8 +731,8 @@ Tango::DevVarCharArray *Socket2::read_until(const Tango::DevVarCharArray *argin) } //-------------------------------------------------------- /** - * Method : Socket2::add_dynamic_commands() - * Description : Create the dynamic commands if any + * Method : Socket2::add_dynamic_commands() + * Description: Create the dynamic commands if any * for specified device. */ //-------------------------------------------------------- diff --git a/src/Socket2.h b/src/Socket2.h index f2c95fb..db8db7e 100644 --- a/src/Socket2.h +++ b/src/Socket2.h @@ -45,11 +45,22 @@ /*----- PROTECTED REGION END -----*/ // Socket2.h +#ifdef TANGO_LOG + // cppTango after c934adea (Merge branch 'remove-cout-definition' into 'main', 2022-05-23) + // nothing to do +#else + // cppTango 9.3-backports and older + #define TANGO_LOG cout + #define TANGO_LOG_INFO cout2 + #define TANGO_LOG_DEBUG cout3 +#endif // TANGO_LOG + /** * Socket2 class description: * */ + namespace Socket2_ns { /*----- PROTECTED REGION ID(Socket2::Additional Class Declarations) ENABLED START -----*/ @@ -91,15 +102,15 @@ class Socket2 : public TANGO_BASE_CLASS // Device property data members public: // Hostname: - string hostname; + std::string hostname; // Port: Tango::DevUShort port; // Protocol: - string protocol; + std::string protocol; // Timeout: Tango::DevLong timeout; // IOMultiplexing: Use `sleep` for fixed sleep and `select` for the syscall of the same name - string iOMultiplexing; + std::string iOMultiplexing; bool mandatoryNotDefined; @@ -117,7 +128,7 @@ public: * @param cl Class. * @param s Device Name */ - Socket2(Tango::DeviceClass *cl,string &s); + Socket2(Tango::DeviceClass *cl,std::string &s); /** * Constructs a newly device object. * @@ -136,7 +147,7 @@ public: /** * The device object destructor. */ - ~Socket2() {delete_device();}; + ~Socket2(); // Miscellaneous methods @@ -167,15 +178,15 @@ public: public: //-------------------------------------------------------- /* - * Method : Socket2::read_attr_hardware() - * Description : Hardware acquisition for attributes. + * Method : Socket2::read_attr_hardware() + * Description: Hardware acquisition for attributes. */ //-------------------------------------------------------- - virtual void read_attr_hardware(vector<long> &attr_list); + virtual void read_attr_hardware(std::vector<long> &attr_list); /** * Attribute InputLength related methods - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -184,7 +195,7 @@ public: virtual bool is_InputLength_allowed(Tango::AttReqType type); /** * Attribute OutputLength related methods - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -193,7 +204,7 @@ public: virtual bool is_OutputLength_allowed(Tango::AttReqType type); /** * Attribute Reconnections related methods - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -204,8 +215,8 @@ public: //-------------------------------------------------------- /** - * Method : Socket2::add_dynamic_attributes() - * Description : Add dynamic attributes if any. + * Method : Socket2::add_dynamic_attributes() + * Description: Add dynamic attributes if any. */ //-------------------------------------------------------- void add_dynamic_attributes(); @@ -217,27 +228,27 @@ public: public: /** * Command Write related method - * Description: * - * @param argin + * + * @param argin */ virtual void write(const Tango::DevVarCharArray *argin); virtual bool is_Write_allowed(const CORBA::Any &any); /** * Command Read related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ virtual Tango::DevVarCharArray *read(Tango::DevLong argin); virtual bool is_Read_allowed(const CORBA::Any &any); /** * Command ReadUntil related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ virtual Tango::DevVarCharArray *read_until(const Tango::DevVarCharArray *argin); virtual bool is_ReadUntil_allowed(const CORBA::Any &any); @@ -245,8 +256,8 @@ public: //-------------------------------------------------------- /** - * Method : Socket2::add_dynamic_commands() - * Description : Add dynamic commands if any. + * Method : Socket2::add_dynamic_commands() + * Description: Add dynamic commands if any. */ //-------------------------------------------------------- void add_dynamic_commands(); diff --git a/src/Socket2.xmi b/src/Socket2.xmi index 4405b3d..7393bf5 100644 --- a/src/Socket2.xmi +++ b/src/Socket2.xmi @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ASCII"?> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> - <classes name="Socket2" pogoRevision="9.4"> - <description description="" title="" sourcePath="/home/alessio/fermi/servers/socket2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <classes name="Socket2" pogoRevision="9.7"> + <description description="" title="" sourcePath="/home/alessio.bogani/Sources/git-trees/linkstabilizer/deps/socket2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> <identification contact="at elettra.eu> - Alessio Igor Bogani <alessio.bogani" author="Alessio Igor Bogani <alessio.bogani" emailDomain="elettra.eu>" classFamily="Communication" siteSpecific="" platform="Unix Like" bus="Socket" manufacturer="none" reference=""/> </description> diff --git a/src/Socket2Class.cpp b/src/Socket2Class.cpp index 0f81e6c..f491166 100644 --- a/src/Socket2Class.cpp +++ b/src/Socket2Class.cpp @@ -72,17 +72,20 @@ namespace Socket2_ns //=================================================================== Socket2Class *Socket2Class::_instance = NULL; +//=================================================================== +// Class constants +//=================================================================== //-------------------------------------------------------- /** - * method : Socket2Class::Socket2Class(string &s) + * method : Socket2Class::Socket2Class(std::string &s) * description : constructor for the Socket2Class * * @param s The class name */ //-------------------------------------------------------- -Socket2Class::Socket2Class(string &s):Tango::DeviceClass(s) +Socket2Class::Socket2Class(std::string &s):Tango::DeviceClass(s) { - cout2 << "Entering Socket2Class constructor" << endl; + TANGO_LOG_INFO << "Entering Socket2Class constructor" << std::endl; set_default_property(); write_class_property(); @@ -90,7 +93,7 @@ Socket2Class::Socket2Class(string &s):Tango::DeviceClass(s) /*----- PROTECTED REGION END -----*/ // Socket2Class::constructor - cout2 << "Leaving Socket2Class constructor" << endl; + TANGO_LOG_INFO << "Leaving Socket2Class constructor" << std::endl; } //-------------------------------------------------------- @@ -124,10 +127,10 @@ Socket2Class *Socket2Class::init(const char *name) { try { - string s(name); + std::string s(name); _instance = new Socket2Class(s); } - catch (bad_alloc &) + catch (std::bad_alloc &) { throw; } @@ -146,7 +149,7 @@ Socket2Class *Socket2Class::instance() { if (_instance == NULL) { - cerr << "Class is not initialised !!" << endl; + std::cerr << "Class is not initialized !!" << std::endl; exit(-1); } return _instance; @@ -170,7 +173,7 @@ Socket2Class *Socket2Class::instance() //-------------------------------------------------------- CORBA::Any *WriteClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) { - cout2 << "WriteClass::execute(): arrived" << endl; + TANGO_LOG_INFO << "WriteClass::execute(): arrived" << std::endl; const Tango::DevVarCharArray *argin; extract(in_any, argin); ((static_cast<Socket2 *>(device))->write(argin)); @@ -190,7 +193,7 @@ CORBA::Any *WriteClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_ //-------------------------------------------------------- CORBA::Any *ReadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) { - cout2 << "ReadClass::execute(): arrived" << endl; + TANGO_LOG_INFO << "ReadClass::execute(): arrived" << std::endl; Tango::DevLong argin; extract(in_any, argin); return insert((static_cast<Socket2 *>(device))->read(argin)); @@ -209,7 +212,7 @@ CORBA::Any *ReadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_a //-------------------------------------------------------- CORBA::Any *ReadUntilClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) { - cout2 << "ReadUntilClass::execute(): arrived" << endl; + TANGO_LOG_INFO << "ReadUntilClass::execute(): arrived" << std::endl; const Tango::DevVarCharArray *argin; extract(in_any, argin); return insert((static_cast<Socket2 *>(device))->read_until(argin)); @@ -221,11 +224,11 @@ CORBA::Any *ReadUntilClass::execute(Tango::DeviceImpl *device, const CORBA::Any //=================================================================== //-------------------------------------------------------- /** - * Method : Socket2Class::get_class_property() - * Description : Get the class property for specified name. + * Method : Socket2Class::get_class_property() + * Description: Get the class property for specified name. */ //-------------------------------------------------------- -Tango::DbDatum Socket2Class::get_class_property(string &prop_name) +Tango::DbDatum Socket2Class::get_class_property(std::string &prop_name) { for (unsigned int i=0 ; i<cl_prop.size() ; i++) if (cl_prop[i].name == prop_name) @@ -236,11 +239,11 @@ Tango::DbDatum Socket2Class::get_class_property(string &prop_name) //-------------------------------------------------------- /** - * Method : Socket2Class::get_default_device_property() - * Description : Return the default value for device property. + * Method : Socket2Class::get_default_device_property() + * Description: Return the default value for device property. */ //-------------------------------------------------------- -Tango::DbDatum Socket2Class::get_default_device_property(string &prop_name) +Tango::DbDatum Socket2Class::get_default_device_property(std::string &prop_name) { for (unsigned int i=0 ; i<dev_def_prop.size() ; i++) if (dev_def_prop[i].name == prop_name) @@ -251,11 +254,11 @@ Tango::DbDatum Socket2Class::get_default_device_property(string &prop_name) //-------------------------------------------------------- /** - * Method : Socket2Class::get_default_class_property() - * Description : Return the default value for class property. + * Method : Socket2Class::get_default_class_property() + * Description: Return the default value for class property. */ //-------------------------------------------------------- -Tango::DbDatum Socket2Class::get_default_class_property(string &prop_name) +Tango::DbDatum Socket2Class::get_default_class_property(std::string &prop_name) { for (unsigned int i=0 ; i<cl_def_prop.size() ; i++) if (cl_def_prop[i].name == prop_name) @@ -267,8 +270,8 @@ Tango::DbDatum Socket2Class::get_default_class_property(string &prop_name) //-------------------------------------------------------- /** - * Method : Socket2Class::set_default_property() - * Description : Set default property (class and device) for wizard. + * Method : Socket2Class::set_default_property() + * Description: Set default property (class and device) for wizard. * For each property, add to wizard property name and description. * If default value has been set, add it to wizard property and * store it in a DbDatum. @@ -276,10 +279,10 @@ Tango::DbDatum Socket2Class::get_default_class_property(string &prop_name) //-------------------------------------------------------- void Socket2Class::set_default_property() { - string prop_name; - string prop_desc; - string prop_def; - vector<string> vect_data; + std::string prop_name; + std::string prop_desc; + std::string prop_def; + std::vector<std::string> vect_data; // Set Default Class Properties @@ -354,8 +357,8 @@ void Socket2Class::set_default_property() //-------------------------------------------------------- /** - * Method : Socket2Class::write_class_property() - * Description : Set class description fields as property in database + * Method : Socket2Class::write_class_property() + * Description: Set class description fields as property in database */ //-------------------------------------------------------- void Socket2Class::write_class_property() @@ -365,124 +368,25 @@ void Socket2Class::write_class_property() return; Tango::DbData data; - string classname = get_name(); - string header; - string::size_type start, end; + std::string classname = get_name(); + std::string header; // Put title Tango::DbDatum title("ProjectTitle"); - string str_title(""); + std::string str_title(""); title << str_title; data.push_back(title); // Put Description Tango::DbDatum description("Description"); - vector<string> str_desc; + std::vector<std::string> str_desc; str_desc.push_back(""); description << str_desc; data.push_back(description); - // put cvs or svn location - string filename("Socket2"); - filename += "Class.cpp"; - - // check for cvs information - string src_path(CvsPath); - start = src_path.find("/"); - if (start!=string::npos) - { - end = src_path.find(filename); - if (end>start) - { - string strloc = src_path.substr(start, end-start); - // Check if specific repository - start = strloc.find("/cvsroot/"); - if (start!=string::npos && start>0) - { - string repository = strloc.substr(0, start); - if (repository.find("/segfs/")!=string::npos) - strloc = "ESRF:" + strloc.substr(start, strloc.length()-start); - } - Tango::DbDatum cvs_loc("cvs_location"); - cvs_loc << strloc; - data.push_back(cvs_loc); - } - } - - // check for svn information - else - { - string src_path(SvnPath); - start = src_path.find("://"); - if (start!=string::npos) - { - end = src_path.find(filename); - if (end>start) - { - header = "$HeadURL: "; - start = header.length(); - string strloc = src_path.substr(start, (end-start)); - - Tango::DbDatum svn_loc("svn_location"); - svn_loc << strloc; - data.push_back(svn_loc); - } - } - } - - // Get CVS or SVN revision tag - - // CVS tag - string tagname(TagName); - header = "$Name: "; - start = header.length(); - string endstr(" $"); - - end = tagname.find(endstr); - if (end!=string::npos && end>start) - { - string strtag = tagname.substr(start, end-start); - Tango::DbDatum cvs_tag("cvs_tag"); - cvs_tag << strtag; - data.push_back(cvs_tag); - } - - // SVN tag - string svnpath(SvnPath); - header = "$HeadURL: "; - start = header.length(); - - end = svnpath.find(endstr); - if (end!=string::npos && end>start) - { - string strloc = svnpath.substr(start, end-start); - - string tagstr ("/tags/"); - start = strloc.find(tagstr); - if ( start!=string::npos ) - { - start = start + tagstr.length(); - end = strloc.find(filename); - string strtag = strloc.substr(start, end-start-1); - - Tango::DbDatum svn_tag("svn_tag"); - svn_tag << strtag; - data.push_back(svn_tag); - } - } - - // Get URL location - string httpServ(HttpServer); - if (httpServ.length()>0) - { - Tango::DbDatum db_doc_url("doc_url"); - db_doc_url << httpServ; - data.push_back(db_doc_url); - } - // Put inheritance Tango::DbDatum inher_datum("InheritedFrom"); - vector<string> inheritance; + std::vector<std::string> inheritance; inheritance.push_back("TANGO_BASE_CLASS"); inher_datum << inheritance; data.push_back(inher_datum); @@ -497,8 +401,8 @@ void Socket2Class::write_class_property() //-------------------------------------------------------- /** - * Method : Socket2Class::device_factory() - * Description : Create the device object(s) + * Method : Socket2Class::device_factory() + * Description: Create the device object(s) * and store them in the device list */ //-------------------------------------------------------- @@ -513,7 +417,7 @@ void Socket2Class::device_factory(const Tango::DevVarStringArray *devlist_ptr) // Create devices and add it into the device list for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) { - cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl; + TANGO_LOG_DEBUG << "Device name : " << (*devlist_ptr)[i].in() << std::endl; device_list.push_back(new Socket2(this, (*devlist_ptr)[i])); } @@ -542,12 +446,12 @@ void Socket2Class::device_factory(const Tango::DevVarStringArray *devlist_ptr) } //-------------------------------------------------------- /** - * Method : Socket2Class::attribute_factory() - * Description : Create the attribute object(s) + * Method : Socket2Class::attribute_factory() + * Description: Create the attribute object(s) * and store them in the attribute list */ //-------------------------------------------------------- -void Socket2Class::attribute_factory(vector<Tango::Attr *> &att_list) +void Socket2Class::attribute_factory(std::vector<Tango::Attr *> &att_list) { /*----- PROTECTED REGION ID(Socket2Class::attribute_factory_before) ENABLED START -----*/ @@ -571,7 +475,6 @@ void Socket2Class::attribute_factory(vector<Tango::Attr *> &att_list) // min_warning not set for InputLength // delta_t not set for InputLength // delta_val not set for InputLength - inputlength->set_default_properties(inputlength_prop); // Not Polled inputlength->set_disp_level(Tango::OPERATOR); @@ -595,7 +498,6 @@ void Socket2Class::attribute_factory(vector<Tango::Attr *> &att_list) // min_warning not set for OutputLength // delta_t not set for OutputLength // delta_val not set for OutputLength - outputlength->set_default_properties(outputlength_prop); // Not Polled outputlength->set_disp_level(Tango::OPERATOR); @@ -619,7 +521,6 @@ void Socket2Class::attribute_factory(vector<Tango::Attr *> &att_list) // min_warning not set for Reconnections // delta_t not set for Reconnections // delta_val not set for Reconnections - reconnections->set_default_properties(reconnections_prop); // Not Polled reconnections->set_disp_level(Tango::OPERATOR); @@ -637,8 +538,8 @@ void Socket2Class::attribute_factory(vector<Tango::Attr *> &att_list) } //-------------------------------------------------------- /** - * Method : Socket2Class::pipe_factory() - * Description : Create the pipe object(s) + * Method : Socket2Class::pipe_factory() + * Description: Create the pipe object(s) * and store them in the pipe list */ //-------------------------------------------------------- @@ -657,8 +558,8 @@ void Socket2Class::pipe_factory() } //-------------------------------------------------------- /** - * Method : Socket2Class::command_factory() - * Description : Create the command object(s) + * Method : Socket2Class::command_factory() + * Description: Create the command object(s) * and store them in the command list */ //-------------------------------------------------------- @@ -712,19 +613,19 @@ void Socket2Class::command_factory() * method : Socket2Class::create_static_attribute_list * description : Create the a list of static attributes * - * @param att_list the ceated attribute list + * @param att_list the created attribute list */ //-------------------------------------------------------- -void Socket2Class::create_static_attribute_list(vector<Tango::Attr *> &att_list) +void Socket2Class::create_static_attribute_list(std::vector<Tango::Attr *> &att_list) { for (unsigned long i=0 ; i<att_list.size() ; i++) { - string att_name(att_list[i]->get_name()); + std::string att_name(att_list[i]->get_name()); transform(att_name.begin(), att_name.end(), att_name.begin(), ::tolower); defaultAttList.push_back(att_name); } - cout2 << defaultAttList.size() << " attributes in default list" << endl; + TANGO_LOG_INFO << defaultAttList.size() << " attributes in default list" << std::endl; /*----- PROTECTED REGION ID(Socket2Class::create_static_att_list) ENABLED START -----*/ @@ -741,26 +642,26 @@ void Socket2Class::create_static_attribute_list(vector<Tango::Attr *> &att_list) * @param list of all attributes */ //-------------------------------------------------------- -void Socket2Class::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list) +void Socket2Class::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, std::vector<Tango::Attr *> &att_list) { Tango::Util *tg = Tango::Util::instance(); for (unsigned long i=0 ; i<devlist_ptr->length() ; i++) { - Tango::DeviceImpl *dev_impl = tg->get_device_by_name(((string)(*devlist_ptr)[i]).c_str()); + Tango::DeviceImpl *dev_impl = tg->get_device_by_name(((std::string)(*devlist_ptr)[i]).c_str()); Socket2 *dev = static_cast<Socket2 *> (dev_impl); - vector<Tango::Attribute *> &dev_att_list = dev->get_device_attr()->get_attribute_list(); - vector<Tango::Attribute *>::iterator ite_att; + std::vector<Tango::Attribute *> &dev_att_list = dev->get_device_attr()->get_attribute_list(); + std::vector<Tango::Attribute *>::iterator ite_att; for (ite_att=dev_att_list.begin() ; ite_att != dev_att_list.end() ; ++ite_att) { - string att_name((*ite_att)->get_name_lower()); + std::string att_name((*ite_att)->get_name_lower()); if ((att_name == "state") || (att_name == "status")) continue; - vector<string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name); + std::vector<std::string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name); if (ite_str == defaultAttList.end()) { - cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl; + TANGO_LOG_INFO << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << std::endl; Tango::Attribute &att = dev->get_device_attr()->get_attr_by_name(att_name.c_str()); dev->remove_attribute(att_list[att.get_attr_idx()], true, false); --ite_att; @@ -774,13 +675,13 @@ void Socket2Class::erase_dynamic_attributes(const Tango::DevVarStringArray *devl //-------------------------------------------------------- /** - * Method : Socket2Class::get_attr_by_name() - * Description : returns Tango::Attr * object found by name + * Method : Socket2Class::get_attr_object_by_name() + * Description: returns Tango::Attr * object found by name */ //-------------------------------------------------------- -Tango::Attr *Socket2Class::get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname) +Tango::Attr *Socket2Class::get_attr_object_by_name(std::vector<Tango::Attr *> &att_list, std::string attname) { - vector<Tango::Attr *>::iterator it; + std::vector<Tango::Attr *>::iterator it; for (it=att_list.begin() ; it<att_list.end() ; ++it) if ((*it)->get_name()==attname) return (*it); diff --git a/src/Socket2Class.h b/src/Socket2Class.h index 690ecca..c35e4ad 100644 --- a/src/Socket2Class.h +++ b/src/Socket2Class.h @@ -64,8 +64,8 @@ class InputLengthAttrib: public Tango::Attr { public: InputLengthAttrib():Attr("InputLength", - Tango::DEV_LONG, Tango::READ) {}; - ~InputLengthAttrib() {}; + Tango::DEV_LONG, Tango::READ) {} + ~InputLengthAttrib() {} virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<Socket2 *>(dev))->read_InputLength(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) @@ -77,8 +77,8 @@ class OutputLengthAttrib: public Tango::Attr { public: OutputLengthAttrib():Attr("OutputLength", - Tango::DEV_LONG, Tango::READ) {}; - ~OutputLengthAttrib() {}; + Tango::DEV_LONG, Tango::READ) {} + ~OutputLengthAttrib() {} virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<Socket2 *>(dev))->read_OutputLength(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) @@ -90,8 +90,8 @@ class ReconnectionsAttrib: public Tango::Attr { public: ReconnectionsAttrib():Attr("Reconnections", - Tango::DEV_LONG, Tango::READ) {}; - ~ReconnectionsAttrib() {}; + Tango::DEV_LONG, Tango::READ) {} + ~ReconnectionsAttrib() {} virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<Socket2 *>(dev))->read_Reconnections(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) @@ -106,20 +106,20 @@ public: class WriteClass : public Tango::Command { public: - WriteClass(const char *name, + WriteClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out, const char *in_desc, const char *out_desc, Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; + :Command(cmd_name,in,out,in_desc,out_desc, level) {} - WriteClass(const char *name, + WriteClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out) - :Command(name,in,out) {}; - ~WriteClass() {}; - + :Command(cmd_name,in,out) {} + ~WriteClass() {} + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) {return (static_cast<Socket2 *>(dev))->is_Write_allowed(any);} @@ -129,20 +129,20 @@ public: class ReadClass : public Tango::Command { public: - ReadClass(const char *name, + ReadClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out, const char *in_desc, const char *out_desc, Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; + :Command(cmd_name,in,out,in_desc,out_desc, level) {} - ReadClass(const char *name, + ReadClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out) - :Command(name,in,out) {}; - ~ReadClass() {}; - + :Command(cmd_name,in,out) {} + ~ReadClass() {} + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) {return (static_cast<Socket2 *>(dev))->is_Read_allowed(any);} @@ -152,20 +152,20 @@ public: class ReadUntilClass : public Tango::Command { public: - ReadUntilClass(const char *name, + ReadUntilClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out, const char *in_desc, const char *out_desc, Tango::DispLevel level) - :Command(name,in,out,in_desc,out_desc, level) {}; + :Command(cmd_name,in,out,in_desc,out_desc, level) {} - ReadUntilClass(const char *name, + ReadUntilClass(const char *cmd_name, Tango::CmdArgType in, Tango::CmdArgType out) - :Command(name,in,out) {}; - ~ReadUntilClass() {}; - + :Command(cmd_name,in,out) {} + ~ReadUntilClass() {} + virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any); virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any) {return (static_cast<Socket2 *>(dev))->is_ReadUntil_allowed(any);} @@ -182,43 +182,42 @@ class __declspec(dllexport) Socket2Class : public Tango::DeviceClass class Socket2Class : public Tango::DeviceClass #endif { - /*----- PROTECTED REGION ID(Socket2Class::Additionnal DServer data members) ENABLED START -----*/ + /*----- PROTECTED REGION ID(Socket2Class::Additional DServer data members) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // Socket2Class::Additionnal DServer data members + /*----- PROTECTED REGION END -----*/ // Socket2Class::Additional DServer data members public: // write class properties data members Tango::DbData cl_prop; Tango::DbData cl_def_prop; Tango::DbData dev_def_prop; - // Method prototypes static Socket2Class *init(const char *); static Socket2Class *instance(); ~Socket2Class(); - Tango::DbDatum get_class_property(string &); - Tango::DbDatum get_default_device_property(string &); - Tango::DbDatum get_default_class_property(string &); - + Tango::DbDatum get_class_property(std::string &); + Tango::DbDatum get_default_device_property(std::string &); + Tango::DbDatum get_default_class_property(std::string &); + protected: - Socket2Class(string &); + Socket2Class(std::string &); static Socket2Class *_instance; void command_factory(); - void attribute_factory(vector<Tango::Attr *> &); + void attribute_factory(std::vector<Tango::Attr *> &); void pipe_factory(); void write_class_property(); void set_default_property(); void get_class_property(); - string get_cvstag(); - string get_cvsroot(); - + std::string get_cvstag(); + std::string get_cvsroot(); + private: - void device_factory(const Tango::DevVarStringArray *); - void create_static_attribute_list(vector<Tango::Attr *> &); - void erase_dynamic_attributes(const Tango::DevVarStringArray *,vector<Tango::Attr *> &); - vector<string> defaultAttList; - Tango::Attr *get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname); + void device_factory(TANGO_UNUSED(const Tango::DevVarStringArray *)); + void create_static_attribute_list(std::vector<Tango::Attr *> &); + void erase_dynamic_attributes(const Tango::DevVarStringArray *,std::vector<Tango::Attr *> &); + std::vector<std::string> defaultAttList; + Tango::Attr *get_attr_object_by_name(std::vector<Tango::Attr *> &att_list, std::string attname); }; } // End of namespace diff --git a/src/Socket2StateMachine.cpp b/src/Socket2StateMachine.cpp index 40c8972..b7e8e1d 100644 --- a/src/Socket2StateMachine.cpp +++ b/src/Socket2StateMachine.cpp @@ -54,8 +54,8 @@ namespace Socket2_ns //-------------------------------------------------------- /** - * Method : Socket2::is_InputLength_allowed() - * Description : Execution allowed for InputLength attribute + * Method : Socket2::is_InputLength_allowed() + * Description: Execution allowed for InputLength attribute */ //-------------------------------------------------------- bool Socket2::is_InputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -70,8 +70,8 @@ bool Socket2::is_InputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : Socket2::is_OutputLength_allowed() - * Description : Execution allowed for OutputLength attribute + * Method : Socket2::is_OutputLength_allowed() + * Description: Execution allowed for OutputLength attribute */ //-------------------------------------------------------- bool Socket2::is_OutputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -86,8 +86,8 @@ bool Socket2::is_OutputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : Socket2::is_Reconnections_allowed() - * Description : Execution allowed for Reconnections attribute + * Method : Socket2::is_Reconnections_allowed() + * Description: Execution allowed for Reconnections attribute */ //-------------------------------------------------------- bool Socket2::is_Reconnections_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -107,8 +107,8 @@ bool Socket2::is_Reconnections_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : Socket2::is_Write_allowed() - * Description : Execution allowed for Write attribute + * Method : Socket2::is_Write_allowed() + * Description: Execution allowed for Write attribute */ //-------------------------------------------------------- bool Socket2::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any)) @@ -127,8 +127,8 @@ bool Socket2::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : Socket2::is_Read_allowed() - * Description : Execution allowed for Read attribute + * Method : Socket2::is_Read_allowed() + * Description: Execution allowed for Read attribute */ //-------------------------------------------------------- bool Socket2::is_Read_allowed(TANGO_UNUSED(const CORBA::Any &any)) @@ -147,8 +147,8 @@ bool Socket2::is_Read_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : Socket2::is_ReadUntil_allowed() - * Description : Execution allowed for ReadUntil attribute + * Method : Socket2::is_ReadUntil_allowed() + * Description: Execution allowed for ReadUntil attribute */ //-------------------------------------------------------- bool Socket2::is_ReadUntil_allowed(TANGO_UNUSED(const CORBA::Any &any)) -- GitLab