From 2ed6c9271f7aee3ccc94c746287683d784ca5b8c Mon Sep 17 00:00:00 2001 From: Alessio Igor Bogani <alessio.bogani@elettra.eu> Date: Tue, 21 Nov 2023 16:10:58 +0100 Subject: [PATCH] Regenerate using Pogo 9.7.8 --- src/USB2.cpp | 104 ++++++++++--------- src/USB2.h | 59 ++++++----- src/USB2.xmi | 4 +- src/USB2Class.cpp | 219 +++++++++++---------------------------- src/USB2Class.h | 81 +++++++-------- src/USB2StateMachine.cpp | 24 ++--- 6 files changed, 202 insertions(+), 289 deletions(-) diff --git a/src/USB2.cpp b/src/USB2.cpp index 0f6e71b..791e01b 100644 --- a/src/USB2.cpp +++ b/src/USB2.cpp @@ -78,12 +78,12 @@ namespace USB2_ns //-------------------------------------------------------- /** - * Method : USB2::USB2() - * Description : Constructors for a Tango device + * Method : USB2::USB2() + * Description: Constructors for a Tango device * implementing the classUSB2 */ //-------------------------------------------------------- -USB2::USB2(Tango::DeviceClass *cl, string &s) +USB2::USB2(Tango::DeviceClass *cl, std::string &s) : TANGO_BASE_CLASS(cl, s.c_str()) { /*----- PROTECTED REGION ID(USB2::constructor_1) ENABLED START -----*/ @@ -112,16 +112,21 @@ USB2::USB2(Tango::DeviceClass *cl, const char *s, const char *d) /*----- PROTECTED REGION END -----*/ // USB2::constructor_3 } +//-------------------------------------------------------- +USB2::~USB2() +{ + delete_device(); +} //-------------------------------------------------------- /** - * Method : USB2::delete_device() - * Description : will be called at device destruction or at init command + * Method : USB2::delete_device() + * Description: will be called at device destruction or at init command */ //-------------------------------------------------------- void USB2::delete_device() { - DEBUG_STREAM << "USB2::delete_device() " << device_name << endl; + DEBUG_STREAM << "USB2::delete_device() " << device_name << std::endl; /*----- PROTECTED REGION ID(USB2::delete_device) ENABLED START -----*/ close(); @@ -135,13 +140,13 @@ void USB2::delete_device() //-------------------------------------------------------- /** - * Method : USB2::init_device() - * Description : will be called at device initialization. + * Method : USB2::init_device() + * Description: will be called at device initialization. */ //-------------------------------------------------------- void USB2::init_device() { - DEBUG_STREAM << "USB2::init_device() create device " << device_name << endl; + DEBUG_STREAM << "USB2::init_device() create device " << device_name << std::endl; /*----- PROTECTED REGION ID(USB2::init_device_before) ENABLED START -----*/ // Initialization before get_device_property() call @@ -151,15 +156,15 @@ void USB2::init_device() init_error.clear(); /*----- PROTECTED REGION END -----*/ // USB2::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; @@ -185,8 +190,8 @@ void USB2::init_device() //-------------------------------------------------------- /** - * Method : USB2::get_device_property() - * Description : Read database to initialize property data members. + * Method : USB2::get_device_property() + * Description: Read database to initialize property data members. */ //-------------------------------------------------------- void USB2::get_device_property() @@ -215,7 +220,7 @@ void USB2::get_device_property() // Call database and extract values if (Tango::Util::instance()->_UseDb==true) get_db_device()->get_property(dev_prop); - + // get instance on USB2Class to get class property Tango::DbDatum def_prop, cl_prop; USB2Class *ds_class = @@ -328,8 +333,8 @@ void USB2::get_device_property() } //-------------------------------------------------------- /** - * Method : USB2::check_mandatory_property() - * Description : For mandatory properties check if defined in database. + * Method : USB2::check_mandatory_property() + * Description: For mandatory properties check if defined in database. */ //-------------------------------------------------------- void USB2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum &dev_prop) @@ -338,14 +343,12 @@ void USB2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum & 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(USB2::check_mandatory_property) ENABLED START -----*/ cerr << tms.str() << " for " << device_name << endl; @@ -357,19 +360,18 @@ void USB2::check_mandatory_property(Tango::DbDatum &class_prop, Tango::DbDatum & //-------------------------------------------------------- /** - * Method : USB2::always_executed_hook() - * Description : method always executed before any command is executed + * Method : USB2::always_executed_hook() + * Description: method always executed before any command is executed */ //-------------------------------------------------------- void USB2::always_executed_hook() { - DEBUG_STREAM << "USB2::always_executed_hook() " << device_name << endl; + DEBUG_STREAM << "USB2::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 *)"USB2::always_executed_hook()"); } /*----- PROTECTED REGION ID(USB2::always_executed_hook) ENABLED START -----*/ @@ -399,13 +401,13 @@ void USB2::always_executed_hook() //-------------------------------------------------------- /** - * Method : USB2::read_attr_hardware() - * Description : Hardware acquisition for attributes + * Method : USB2::read_attr_hardware() + * Description: Hardware acquisition for attributes */ //-------------------------------------------------------- -void USB2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) +void USB2::read_attr_hardware(TANGO_UNUSED(std::vector<long> &attr_list)) { - DEBUG_STREAM << "USB2::read_attr_hardware(vector<long> &attr_list) entering... " << endl; + DEBUG_STREAM << "USB2::read_attr_hardware(std::vector<long> &attr_list) entering... " << std::endl; /*----- PROTECTED REGION ID(USB2::read_attr_hardware) ENABLED START -----*/ // Add your own code @@ -416,7 +418,7 @@ void USB2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) //-------------------------------------------------------- /** * Read attribute InputLength related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -424,7 +426,7 @@ void USB2::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) //-------------------------------------------------------- void USB2::read_InputLength(Tango::Attribute &attr) { - DEBUG_STREAM << "USB2::read_InputLength(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "USB2::read_InputLength(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(USB2::read_InputLength) ENABLED START -----*/ // Set the attribute value attr_InputLength_read[0] = input_queue_length(); @@ -435,7 +437,7 @@ void USB2::read_InputLength(Tango::Attribute &attr) //-------------------------------------------------------- /** * Read attribute OutputLength related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -443,7 +445,7 @@ void USB2::read_InputLength(Tango::Attribute &attr) //-------------------------------------------------------- void USB2::read_OutputLength(Tango::Attribute &attr) { - DEBUG_STREAM << "USB2::read_OutputLength(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "USB2::read_OutputLength(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(USB2::read_OutputLength) ENABLED START -----*/ // Set the attribute value attr_OutputLength_read[0] = output_queue_length(); @@ -454,7 +456,7 @@ void USB2::read_OutputLength(Tango::Attribute &attr) //-------------------------------------------------------- /** * Read attribute Reconnections related method - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -462,7 +464,7 @@ void USB2::read_OutputLength(Tango::Attribute &attr) //-------------------------------------------------------- void USB2::read_Reconnections(Tango::Attribute &attr) { - DEBUG_STREAM << "USB2::read_Reconnections(Tango::Attribute &attr) entering... " << endl; + DEBUG_STREAM << "USB2::read_Reconnections(Tango::Attribute &attr) entering... " << std::endl; /*----- PROTECTED REGION ID(USB2::read_Reconnections) ENABLED START -----*/ // Set the attribute value attr_Reconnections_read[0] = reconnections; @@ -473,8 +475,8 @@ void USB2::read_Reconnections(Tango::Attribute &attr) //-------------------------------------------------------- /** - * Method : USB2::add_dynamic_attributes() - * Description : Create the dynamic attributes if any + * Method : USB2::add_dynamic_attributes() + * Description: Create the dynamic attributes if any * for specified device. */ //-------------------------------------------------------- @@ -490,14 +492,14 @@ void USB2::add_dynamic_attributes() //-------------------------------------------------------- /** * Command Write related method - * Description: * - * @param argin + * + * @param argin */ //-------------------------------------------------------- void USB2::write(const Tango::DevVarCharArray *argin) { - DEBUG_STREAM << "USB2::Write() - " << device_name << endl; + DEBUG_STREAM << "USB2::Write() - " << device_name << std::endl; /*----- PROTECTED REGION ID(USB2::write) ENABLED START -----*/ check_init(); @@ -545,16 +547,16 @@ void USB2::write(const Tango::DevVarCharArray *argin) //-------------------------------------------------------- /** * Command Read related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ //-------------------------------------------------------- Tango::DevVarCharArray *USB2::read(Tango::DevLong argin) { Tango::DevVarCharArray *argout; - DEBUG_STREAM << "USB2::Read() - " << device_name << endl; + DEBUG_STREAM << "USB2::Read() - " << device_name << std::endl; /*----- PROTECTED REGION ID(USB2::read) ENABLED START -----*/ check_init(); @@ -603,16 +605,16 @@ Tango::DevVarCharArray *USB2::read(Tango::DevLong argin) //-------------------------------------------------------- /** * Command ReadUntil related method - * Description: * - * @param argin - * @returns + * + * @param argin + * @returns */ //-------------------------------------------------------- Tango::DevVarCharArray *USB2::read_until(const Tango::DevVarCharArray *argin) { Tango::DevVarCharArray *argout; - DEBUG_STREAM << "USB2::ReadUntil() - " << device_name << endl; + DEBUG_STREAM << "USB2::ReadUntil() - " << device_name << std::endl; /*----- PROTECTED REGION ID(USB2::read_until) ENABLED START -----*/ check_init(); @@ -675,8 +677,8 @@ Tango::DevVarCharArray *USB2::read_until(const Tango::DevVarCharArray *argin) } //-------------------------------------------------------- /** - * Method : USB2::add_dynamic_commands() - * Description : Create the dynamic commands if any + * Method : USB2::add_dynamic_commands() + * Description: Create the dynamic commands if any * for specified device. */ //-------------------------------------------------------- diff --git a/src/USB2.h b/src/USB2.h index f84f566..2462644 100644 --- a/src/USB2.h +++ b/src/USB2.h @@ -43,11 +43,22 @@ /*----- PROTECTED REGION END -----*/ // USB2.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 + /** * USB2 class description: * */ + namespace USB2_ns { /*----- PROTECTED REGION ID(USB2::Additional Class Declarations) ENABLED START -----*/ @@ -80,15 +91,15 @@ public: // Timeout: Tango::DevLong timeout; // VendorID: - string vendorID; + std::string vendorID; // ProductID: - string productID; + std::string productID; // Interface: Tango::DevLong interface; // EndpointUP: - string endpointUP; + std::string endpointUP; // EndpointDOWN: - string endpointDOWN; + std::string endpointDOWN; // MaxPacketSize: Tango::DevLong maxPacketSize; @@ -108,7 +119,7 @@ public: * @param cl Class. * @param s Device Name */ - USB2(Tango::DeviceClass *cl,string &s); + USB2(Tango::DeviceClass *cl,std::string &s); /** * Constructs a newly device object. * @@ -127,7 +138,7 @@ public: /** * The device object destructor. */ - ~USB2() {delete_device();}; + ~USB2(); // Miscellaneous methods @@ -158,15 +169,15 @@ public: public: //-------------------------------------------------------- /* - * Method : USB2::read_attr_hardware() - * Description : Hardware acquisition for attributes. + * Method : USB2::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 @@ -175,7 +186,7 @@ public: virtual bool is_InputLength_allowed(Tango::AttReqType type); /** * Attribute OutputLength related methods - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -184,7 +195,7 @@ public: virtual bool is_OutputLength_allowed(Tango::AttReqType type); /** * Attribute Reconnections related methods - * Description: + * * * Data type: Tango::DevLong * Attr type: Scalar @@ -195,8 +206,8 @@ public: //-------------------------------------------------------- /** - * Method : USB2::add_dynamic_attributes() - * Description : Add dynamic attributes if any. + * Method : USB2::add_dynamic_attributes() + * Description: Add dynamic attributes if any. */ //-------------------------------------------------------- void add_dynamic_attributes(); @@ -208,27 +219,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); @@ -236,8 +247,8 @@ public: //-------------------------------------------------------- /** - * Method : USB2::add_dynamic_commands() - * Description : Add dynamic commands if any. + * Method : USB2::add_dynamic_commands() + * Description: Add dynamic commands if any. */ //-------------------------------------------------------- void add_dynamic_commands(); diff --git a/src/USB2.xmi b/src/USB2.xmi index 7569573..8f5cd00 100644 --- a/src/USB2.xmi +++ b/src/USB2.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="USB2" pogoRevision="9.4"> - <description description="" title="" sourcePath="/home/alessio/WIP/fermi/servers/usb2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="true" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <classes name="USB2" pogoRevision="9.7"> + <description description="" title="" sourcePath="/home/alessio/Sources/git-trees/usb2/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" 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="USB" manufacturer="none" reference=""/> </description> diff --git a/src/USB2Class.cpp b/src/USB2Class.cpp index 2c6b7eb..8b4eb48 100644 --- a/src/USB2Class.cpp +++ b/src/USB2Class.cpp @@ -72,17 +72,20 @@ namespace USB2_ns //=================================================================== USB2Class *USB2Class::_instance = NULL; +//=================================================================== +// Class constants +//=================================================================== //-------------------------------------------------------- /** - * method : USB2Class::USB2Class(string &s) + * method : USB2Class::USB2Class(std::string &s) * description : constructor for the USB2Class * * @param s The class name */ //-------------------------------------------------------- -USB2Class::USB2Class(string &s):Tango::DeviceClass(s) +USB2Class::USB2Class(std::string &s):Tango::DeviceClass(s) { - cout2 << "Entering USB2Class constructor" << endl; + TANGO_LOG_INFO << "Entering USB2Class constructor" << std::endl; set_default_property(); write_class_property(); @@ -90,7 +93,7 @@ USB2Class::USB2Class(string &s):Tango::DeviceClass(s) /*----- PROTECTED REGION END -----*/ // USB2Class::constructor - cout2 << "Leaving USB2Class constructor" << endl; + TANGO_LOG_INFO << "Leaving USB2Class constructor" << std::endl; } //-------------------------------------------------------- @@ -124,10 +127,10 @@ USB2Class *USB2Class::init(const char *name) { try { - string s(name); + std::string s(name); _instance = new USB2Class(s); } - catch (bad_alloc &) + catch (std::bad_alloc &) { throw; } @@ -146,7 +149,7 @@ USB2Class *USB2Class::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 @@ USB2Class *USB2Class::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<USB2 *>(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<USB2 *>(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<USB2 *>(device))->read_until(argin)); @@ -221,11 +224,11 @@ CORBA::Any *ReadUntilClass::execute(Tango::DeviceImpl *device, const CORBA::Any //=================================================================== //-------------------------------------------------------- /** - * Method : USB2Class::get_class_property() - * Description : Get the class property for specified name. + * Method : USB2Class::get_class_property() + * Description: Get the class property for specified name. */ //-------------------------------------------------------- -Tango::DbDatum USB2Class::get_class_property(string &prop_name) +Tango::DbDatum USB2Class::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 USB2Class::get_class_property(string &prop_name) //-------------------------------------------------------- /** - * Method : USB2Class::get_default_device_property() - * Description : Return the default value for device property. + * Method : USB2Class::get_default_device_property() + * Description: Return the default value for device property. */ //-------------------------------------------------------- -Tango::DbDatum USB2Class::get_default_device_property(string &prop_name) +Tango::DbDatum USB2Class::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 USB2Class::get_default_device_property(string &prop_name) //-------------------------------------------------------- /** - * Method : USB2Class::get_default_class_property() - * Description : Return the default value for class property. + * Method : USB2Class::get_default_class_property() + * Description: Return the default value for class property. */ //-------------------------------------------------------- -Tango::DbDatum USB2Class::get_default_class_property(string &prop_name) +Tango::DbDatum USB2Class::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 USB2Class::get_default_class_property(string &prop_name) //-------------------------------------------------------- /** - * Method : USB2Class::set_default_property() - * Description : Set default property (class and device) for wizard. + * Method : USB2Class::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 USB2Class::get_default_class_property(string &prop_name) //-------------------------------------------------------- void USB2Class::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 @@ -379,8 +382,8 @@ void USB2Class::set_default_property() //-------------------------------------------------------- /** - * Method : USB2Class::write_class_property() - * Description : Set class description fields as property in database + * Method : USB2Class::write_class_property() + * Description: Set class description fields as property in database */ //-------------------------------------------------------- void USB2Class::write_class_property() @@ -390,124 +393,25 @@ void USB2Class::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("USB2"); - 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); @@ -522,8 +426,8 @@ void USB2Class::write_class_property() //-------------------------------------------------------- /** - * Method : USB2Class::device_factory() - * Description : Create the device object(s) + * Method : USB2Class::device_factory() + * Description: Create the device object(s) * and store them in the device list */ //-------------------------------------------------------- @@ -538,7 +442,7 @@ void USB2Class::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 USB2(this, (*devlist_ptr)[i])); } @@ -567,12 +471,12 @@ void USB2Class::device_factory(const Tango::DevVarStringArray *devlist_ptr) } //-------------------------------------------------------- /** - * Method : USB2Class::attribute_factory() - * Description : Create the attribute object(s) + * Method : USB2Class::attribute_factory() + * Description: Create the attribute object(s) * and store them in the attribute list */ //-------------------------------------------------------- -void USB2Class::attribute_factory(vector<Tango::Attr *> &att_list) +void USB2Class::attribute_factory(std::vector<Tango::Attr *> &att_list) { /*----- PROTECTED REGION ID(USB2Class::attribute_factory_before) ENABLED START -----*/ @@ -596,7 +500,6 @@ void USB2Class::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); @@ -620,7 +523,6 @@ void USB2Class::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); @@ -644,7 +546,6 @@ void USB2Class::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); @@ -662,8 +563,8 @@ void USB2Class::attribute_factory(vector<Tango::Attr *> &att_list) } //-------------------------------------------------------- /** - * Method : USB2Class::pipe_factory() - * Description : Create the pipe object(s) + * Method : USB2Class::pipe_factory() + * Description: Create the pipe object(s) * and store them in the pipe list */ //-------------------------------------------------------- @@ -682,8 +583,8 @@ void USB2Class::pipe_factory() } //-------------------------------------------------------- /** - * Method : USB2Class::command_factory() - * Description : Create the command object(s) + * Method : USB2Class::command_factory() + * Description: Create the command object(s) * and store them in the command list */ //-------------------------------------------------------- @@ -737,19 +638,19 @@ void USB2Class::command_factory() * method : USB2Class::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 USB2Class::create_static_attribute_list(vector<Tango::Attr *> &att_list) +void USB2Class::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(USB2Class::create_static_att_list) ENABLED START -----*/ @@ -766,26 +667,26 @@ void USB2Class::create_static_attribute_list(vector<Tango::Attr *> &att_list) * @param list of all attributes */ //-------------------------------------------------------- -void USB2Class::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list) +void USB2Class::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()); USB2 *dev = static_cast<USB2 *> (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; @@ -799,13 +700,13 @@ void USB2Class::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist //-------------------------------------------------------- /** - * Method : USB2Class::get_attr_by_name() - * Description : returns Tango::Attr * object found by name + * Method : USB2Class::get_attr_object_by_name() + * Description: returns Tango::Attr * object found by name */ //-------------------------------------------------------- -Tango::Attr *USB2Class::get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname) +Tango::Attr *USB2Class::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/USB2Class.h b/src/USB2Class.h index f8c3284..0ad9a75 100644 --- a/src/USB2Class.h +++ b/src/USB2Class.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<USB2 *>(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<USB2 *>(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<USB2 *>(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<USB2 *>(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<USB2 *>(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<USB2 *>(dev))->is_ReadUntil_allowed(any);} @@ -182,43 +182,42 @@ class __declspec(dllexport) USB2Class : public Tango::DeviceClass class USB2Class : public Tango::DeviceClass #endif { - /*----- PROTECTED REGION ID(USB2Class::Additionnal DServer data members) ENABLED START -----*/ + /*----- PROTECTED REGION ID(USB2Class::Additional DServer data members) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // USB2Class::Additionnal DServer data members + /*----- PROTECTED REGION END -----*/ // USB2Class::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 USB2Class *init(const char *); static USB2Class *instance(); ~USB2Class(); - 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: - USB2Class(string &); + USB2Class(std::string &); static USB2Class *_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/USB2StateMachine.cpp b/src/USB2StateMachine.cpp index 0e8dd8c..b6975ba 100644 --- a/src/USB2StateMachine.cpp +++ b/src/USB2StateMachine.cpp @@ -54,8 +54,8 @@ namespace USB2_ns //-------------------------------------------------------- /** - * Method : USB2::is_InputLength_allowed() - * Description : Execution allowed for InputLength attribute + * Method : USB2::is_InputLength_allowed() + * Description: Execution allowed for InputLength attribute */ //-------------------------------------------------------- bool USB2::is_InputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -70,8 +70,8 @@ bool USB2::is_InputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : USB2::is_OutputLength_allowed() - * Description : Execution allowed for OutputLength attribute + * Method : USB2::is_OutputLength_allowed() + * Description: Execution allowed for OutputLength attribute */ //-------------------------------------------------------- bool USB2::is_OutputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -86,8 +86,8 @@ bool USB2::is_OutputLength_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : USB2::is_Reconnections_allowed() - * Description : Execution allowed for Reconnections attribute + * Method : USB2::is_Reconnections_allowed() + * Description: Execution allowed for Reconnections attribute */ //-------------------------------------------------------- bool USB2::is_Reconnections_allowed(TANGO_UNUSED(Tango::AttReqType type)) @@ -107,8 +107,8 @@ bool USB2::is_Reconnections_allowed(TANGO_UNUSED(Tango::AttReqType type)) //-------------------------------------------------------- /** - * Method : USB2::is_Write_allowed() - * Description : Execution allowed for Write attribute + * Method : USB2::is_Write_allowed() + * Description: Execution allowed for Write attribute */ //-------------------------------------------------------- bool USB2::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any)) @@ -127,8 +127,8 @@ bool USB2::is_Write_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : USB2::is_Read_allowed() - * Description : Execution allowed for Read attribute + * Method : USB2::is_Read_allowed() + * Description: Execution allowed for Read attribute */ //-------------------------------------------------------- bool USB2::is_Read_allowed(TANGO_UNUSED(const CORBA::Any &any)) @@ -147,8 +147,8 @@ bool USB2::is_Read_allowed(TANGO_UNUSED(const CORBA::Any &any)) //-------------------------------------------------------- /** - * Method : USB2::is_ReadUntil_allowed() - * Description : Execution allowed for ReadUntil attribute + * Method : USB2::is_ReadUntil_allowed() + * Description: Execution allowed for ReadUntil attribute */ //-------------------------------------------------------- bool USB2::is_ReadUntil_allowed(TANGO_UNUSED(const CORBA::Any &any)) -- GitLab