diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp index 5c5dfb8dc323ad029dfcfa5031c8426dfae5833f..d6f793b5f2cfdb86a8f984592c6aae11a6226076 100644 --- a/src/ClassFactory.cpp +++ b/src/ClassFactory.cpp @@ -33,4 +33,4 @@ void Tango::DServer::class_factory() add_class(Vg_ns::VgClass::init("Vg")); } -/*----- PROTECTED REGION END -----*/ +/*----- PROTECTED REGION END -----*/ // Vg::ClassFactory.cpp diff --git a/src/Vg.cpp b/src/Vg.cpp index 70b314d293f0f6b7a1428f220f223578bf4ed6ad..a0dedf285ea6ad0ea18bb288d9abccbab3d38d92 100644 --- a/src/Vg.cpp +++ b/src/Vg.cpp @@ -20,46 +20,48 @@ #include <Vg.h> #include <VgClass.h> -/*----- PROTECTED REGION END -----*/ - +/*----- PROTECTED REGION END -----*/ // Vg.cpp /** - * Vg class description: - * + * Vg class description: + * */ //================================================================ -// // The following table gives the correspondence // between command and method names. // // Command name | Method name -//---------------------------------------------------------------- +//================================================================ // State | Inherited (no method) // Status | Inherited (no method) // On | on // Off | off //================================================================ +//================================================================ +// Attributes managed is: +//================================================================ +// Pressure | Tango::DevDouble Scalar +//================================================================ + namespace Vg_ns { - /*----- PROTECTED REGION ID(Vg::namespace_starting) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::namespace_starting) ENABLED START -----*/ // static initializations /*----- PROTECTED REGION END -----*/ // Vg::namespace_starting - - //-------------------------------------------------------- /** * Method : Vg::Vg() * Description : Constructors for a Tango device - * implementing the class Vg + * implementing the classVg */ //-------------------------------------------------------- Vg::Vg(Tango::DeviceClass *cl, string &s) - : TANGO_BASE_CLASS(cl, s.c_str()) + : TANGO_BASE_CLASS(cl, s.c_str()) { /*----- PROTECTED REGION ID(Vg::constructor_1) ENABLED START -----*/ @@ -69,7 +71,7 @@ Vg::Vg(Tango::DeviceClass *cl, string &s) } //-------------------------------------------------------- Vg::Vg(Tango::DeviceClass *cl, const char *s) - : TANGO_BASE_CLASS(cl, s) + : TANGO_BASE_CLASS(cl, s) { /*----- PROTECTED REGION ID(Vg::constructor_2) ENABLED START -----*/ @@ -79,7 +81,7 @@ Vg::Vg(Tango::DeviceClass *cl, const char *s) } //-------------------------------------------------------- Vg::Vg(Tango::DeviceClass *cl, const char *s, const char *d) - : TANGO_BASE_CLASS(cl, s, d) + : TANGO_BASE_CLASS(cl, s, d) { /*----- PROTECTED REGION ID(Vg::constructor_3) ENABLED START -----*/ @@ -88,15 +90,15 @@ Vg::Vg(Tango::DeviceClass *cl, const char *s, const char *d) /*----- PROTECTED REGION END -----*/ // Vg::constructor_3 } - //-------------------------------------------------------- /** - * Method : Vg::delete_device()() + * Method : Vg::delete_device() * Description : will be called at device destruction or at init command */ //-------------------------------------------------------- void Vg::delete_device() { + DEBUG_STREAM << "Vg::delete_device() " << device_name << endl; /*----- PROTECTED REGION ID(Vg::delete_device) ENABLED START -----*/ if(init_completed) @@ -119,21 +121,17 @@ void Vg::delete_device() /*----- PROTECTED REGION END -----*/ // Vg::delete_device delete[] attr_Pressure_read; - delete[] attr_DeviceState_read; - } - //-------------------------------------------------------- /** * Method : Vg::init_device() - * Description : // will be called at device initialization. + * Description : will be called at device initialization. */ //-------------------------------------------------------- void Vg::init_device() { DEBUG_STREAM << "Vg::init_device() create device " << device_name << endl; - /*----- PROTECTED REGION ID(Vg::init_device_before) ENABLED START -----*/ set_state(Tango::INIT); @@ -147,12 +145,11 @@ void Vg::init_device() /*----- PROTECTED REGION END -----*/ // Vg::init_device_before - // Get the device properties (if any) from database + + // Get the device properties from database get_device_property(); attr_Pressure_read = new Tango::DevDouble[1]; - attr_DeviceState_read = new Tango::DevUChar[1]; - /*----- PROTECTED REGION ID(Vg::init_device) ENABLED START -----*/ if(get_state() != Tango::FAULT) @@ -175,12 +172,10 @@ void Vg::init_device() /*----- PROTECTED REGION END -----*/ // Vg::init_device } - - //-------------------------------------------------------- /** * Method : Vg::get_device_property() - * Description : // Add your own code to initialize + * Description : Read database to initialize property data members. */ //-------------------------------------------------------- void Vg::get_device_property() @@ -256,8 +251,8 @@ void Vg::get_device_property() // And try to extract MaxBackOff value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> maxBackOff; - } + /*----- PROTECTED REGION ID(Vg::get_device_property_after) ENABLED START -----*/ if(dev_prop[0].is_empty()) @@ -313,7 +308,6 @@ void Vg::get_device_property() } /*----- PROTECTED REGION END -----*/ // Vg::get_device_property_after - } //-------------------------------------------------------- @@ -324,7 +318,7 @@ void Vg::get_device_property() //-------------------------------------------------------- void Vg::always_executed_hook() { - INFO_STREAM << "Vg::always_executed_hook() " << device_name << endl; + DEBUG_STREAM << "Vg::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(Vg::always_executed_hook) ENABLED START -----*/ if(update_allowed()) @@ -335,15 +329,13 @@ void Vg::always_executed_hook() /*----- PROTECTED REGION END -----*/ // Vg::always_executed_hook } - - //-------------------------------------------------------- /** * Method : Vg::read_attr_hardware() - * Description : Hardware acquisition for attributes. + * Description : Hardware acquisition for attributes */ //-------------------------------------------------------- -void Vg::read_attr_hardware(vector<long> &attr_list) +void Vg::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) { DEBUG_STREAM << "Vg::read_attr_hardware(vector<long> &attr_list) entering... " << endl; /*----- PROTECTED REGION ID(Vg::read_attr_hardware) ENABLED START -----*/ @@ -351,17 +343,15 @@ void Vg::read_attr_hardware(vector<long> &attr_list) // Add your own code /*----- PROTECTED REGION END -----*/ // Vg::read_attr_hardware - } - //-------------------------------------------------------- /** - * Read Pressure attribute + * Read attribute Pressure related method * Description: * * Data type: Tango::DevDouble - * Attr type: Scalar + * Attr type: Scalar */ //-------------------------------------------------------- void Vg::read_Pressure(Tango::Attribute &attr) @@ -385,84 +375,28 @@ void Vg::read_Pressure(Tango::Attribute &attr) /*----- PROTECTED REGION END -----*/ // Vg::read_Pressure } -//-------------------------------------------------------- -/** - * Read DeviceState attribute - * Description: - * - * Data type: Tango::DevUChar - * Attr type: Scalar - */ -//-------------------------------------------------------- -void Vg::read_DeviceState(Tango::Attribute &attr) -{ - DEBUG_STREAM << "Vg::read_DeviceState(Tango::Attribute &attr) entering... " << endl; - /*----- PROTECTED REGION ID(Vg::read_DeviceState) ENABLED START -----*/ - - // Set the attribute value - attr.set_value(attr_DeviceState_read); - - /*----- PROTECTED REGION END -----*/ // Vg::read_DeviceState -} //-------------------------------------------------------- /** - * Write DeviceState attribute values to hardware. - * - * Data type: Tango::DevUChar - * Attr type: Scalar - */ -//-------------------------------------------------------- -void Vg::write_DeviceState(Tango::WAttribute &attr) -{ - DEBUG_STREAM << "Vg::write_DeviceState(Tango::Attribute &attr) entering... " << endl; - - // Retrieve write value - Tango::DevUChar w_val; - attr.get_write_value(w_val); - - /*----- PROTECTED REGION ID(Vg::write_DeviceState) ENABLED START -----*/ - - if (w_val >= DEVICESTATE_T_SIZE) { - Tango::Except::throw_exception("", "Value out of range", \ - "Vg::write_DeviceState()"); - } - *attr_DeviceState_read = w_val; - - /*----- PROTECTED REGION END -----*/ // Vg::write_DeviceState -} - - -//-------------------------------------------------------- -/** - * Method : Vg::VgClass::add_dynamic_attributes() + * Method : Vg::add_dynamic_attributes() * Description : Create the dynamic attributes if any - * for specified device. + * for specified device. */ //-------------------------------------------------------- void Vg::add_dynamic_attributes() { - /*----- PROTECTED REGION ID(Vg::Class::add_dynamic_attributes) ENABLED START -----*/ - + /*----- PROTECTED REGION ID(Vg::add_dynamic_attributes) ENABLED START -----*/ + // Add your own code to create and add dynamic attributes if any - - /*----- PROTECTED REGION END -----*/ // Vg::Class::add_dynamic_attributes - + + /*----- PROTECTED REGION END -----*/ // Vg::add_dynamic_attributes } - - -//======================================================== -// Command execution methods -//======================================================== - //-------------------------------------------------------- /** - * Execute the On command: + * Command On related method * Description: * - * @param argin - * @returns */ //-------------------------------------------------------- void Vg::on() @@ -483,16 +417,12 @@ void Vg::on() } /*----- PROTECTED REGION END -----*/ // Vg::on - } - //-------------------------------------------------------- /** - * Execute the Off command: + * Command Off related method * Description: * - * @param argin - * @returns */ //-------------------------------------------------------- void Vg::off() @@ -513,11 +443,24 @@ void Vg::off() } /*----- PROTECTED REGION END -----*/ // Vg::off - +} +//-------------------------------------------------------- +/** + * Method : Vg::add_dynamic_commands() + * Description : Create the dynamic commands if any + * for specified device. + */ +//-------------------------------------------------------- +void Vg::add_dynamic_commands() +{ + /*----- PROTECTED REGION ID(Vg::add_dynamic_commands) ENABLED START -----*/ + + // Add your own code to create and add dynamic commands if any + + /*----- PROTECTED REGION END -----*/ // Vg::add_dynamic_commands } - - /*----- PROTECTED REGION ID(Vg::namespace_ending) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::namespace_ending) ENABLED START -----*/ //======================================================== // Private methods diff --git a/src/Vg.h b/src/Vg.h index 379497411c709a900beb5f161ba2001de6a54df9..e1dd8c77d30b3a0d94a9eb446a26b65967956feb 100644 --- a/src/Vg.h +++ b/src/Vg.h @@ -19,28 +19,25 @@ #include <tango.h> -/*----- PROTECTED REGION END -----*/ - +/*----- PROTECTED REGION END -----*/ // Vg.h /** - * Vg class Description: - * + * Vg class description: + * */ namespace Vg_ns { - /*----- PROTECTED REGION ID(Vg::Additional Class Declarations) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::Additional Class Declarations) ENABLED START -----*/ // Additional Class Declarations /*----- PROTECTED REGION END -----*/ // Vg::Additional Class Declarations - - class Vg : public TANGO_BASE_CLASS +class Vg : public TANGO_BASE_CLASS { - - /*----- PROTECTED REGION ID(Vg::Data Members) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::Data Members) ENABLED START -----*/ static const size_t STRING_SIZE = 1024; @@ -52,9 +49,9 @@ namespace Vg_ns /*----- PROTECTED REGION END -----*/ // Vg::Data Members - // Device property data members -public: // TpgDevice: +public: + // TpgDevice: string tpgDevice; // Channel: Tango::DevShort channel; @@ -62,33 +59,29 @@ public: // TpgDevice: Tango::DevLong timeout; // MaxBackOff: Tango::DevLong maxBackOff; - // Attribute data members public: Tango::DevDouble *attr_Pressure_read; - Tango::DevUChar *attr_DeviceState_read; - - // Constructors and destructors public: /** - * Constructs a newly allocated Command object. + * Constructs a newly device object. * * @param cl Class. * @param s Device Name */ Vg(Tango::DeviceClass *cl,string &s); /** - * Constructs a newly allocated Command object. + * Constructs a newly device object. * * @param cl Class. * @param s Device Name */ Vg(Tango::DeviceClass *cl,const char *s); /** - * Constructs a newly allocated Command object. + * Constructs a newly device object. * * @param cl Class. * @param s Device name @@ -96,27 +89,26 @@ public: */ Vg(Tango::DeviceClass *cl,const char *s,const char *d); /** - * The object destructor. - */ + * The device object destructor. + */ ~Vg() {delete_device();}; - // Miscellaneous methods public: - /** + /* * will be called at device destruction or at init command. */ void delete_device(); - /** + /* * Initialize the device */ virtual void init_device(); - /** + /* * Read the device properties from database */ - void get_device_property(); - /** + void get_device_property(); + /* * Always executed method before execution command method. */ virtual void always_executed_hook(); @@ -124,63 +116,63 @@ public: // Attribute methods public: - /** + //-------------------------------------------------------- + /* * Method : Vg::read_attr_hardware() * Description : Hardware acquisition for attributes. */ + //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); - - /** - * Pressure attribute related methods. - * Description: - * - * Data type: Tango::DevDouble - * Attr type: Scalar - */ +/** + * Attribute Pressure related methods + * Description: + * + * Data type: Tango::DevDouble + * Attr type: Scalar + */ virtual void read_Pressure(Tango::Attribute &attr); virtual bool is_Pressure_allowed(Tango::AttReqType type); - - /** - * DeviceState attribute related methods. - * Description: - * - * Data type: Tango::DevUChar - * Attr type: Scalar - */ - virtual void read_DeviceState(Tango::Attribute &attr); - virtual void write_DeviceState(Tango::WAttribute &attr); - virtual bool is_DeviceState_allowed(Tango::AttReqType type); - - - + //-------------------------------------------------------- /** * Method : Vg::add_dynamic_attributes() * Description : Add dynamic attributes if any. */ - void add_dynamic_attributes(); + //-------------------------------------------------------- + void add_dynamic_attributes(); + -// Command related methods -public: +// Command related methods +public: /** - * Command On related methods. + * Command On related method + * Description: + * */ - void on(); + virtual void on(); virtual bool is_On_allowed(const CORBA::Any &any); - /** - * Command Off related methods. + * Command Off related method + * Description: + * */ - void off(); + virtual void off(); virtual bool is_Off_allowed(const CORBA::Any &any); + //-------------------------------------------------------- + /** + * Method : Vg::add_dynamic_commands() + * Description : Add dynamic commands if any. + */ + //-------------------------------------------------------- + void add_dynamic_commands(); - /*----- PROTECTED REGION ID(Vg::Additional Method prototypes) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::Additional Method prototypes) ENABLED START -----*/ bool update_allowed(); void update_state(); @@ -189,15 +181,14 @@ public: void exception_handler(Tango::DevFailed &, Tango::DevState, const std::string); /*----- PROTECTED REGION END -----*/ // Vg::Additional Method prototypes - }; - /*----- PROTECTED REGION ID(Vg::Additional Classes Definitions) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::Additional Classes Definitions) ENABLED START -----*/ // Additional Classes definitions /*----- PROTECTED REGION END -----*/ // Vg::Additional Classes Definitions -} // namespace +} // End of namespace -#endif // VG_H +#endif // Vg_H diff --git a/src/Vg.xmi b/src/Vg.xmi index d3147d664257be800b12c47cbc38116c625926ae..372b2f524f9c2e95c6e36b0a2b792a54dd2ed9cb 100644 --- a/src/Vg.xmi +++ b/src/Vg.xmi @@ -1,10 +1,9 @@ <?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="Vg"> - <description description="" title="Vg" sourcePath="/home/lorenzo/src/a/fermi/servers/vg/src" language="Cpp" filestogenerate="XMI file,Code files" hasAbstractCommand="false" hasAbstractAttribute="false"> + <classes name="Vg" pogoRevision="9.6"> + <description description="" title="Vg" sourcePath="/home/lorenzo/src/gitlab/cs/ds/vg/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> <identification contact="at elettra.trieste.it - marco.demarco" author="marco.demarco" emailDomain="elettra.trieste.it" classFamily="Vacuum" siteSpecific="" platform="Unix Like" bus="TCP/UDP" manufacturer="none" reference=""/> - <comments commandsTable="//================================================================
//
// The following table gives the correspondence
// between command and method names.
//
// Command name | Method name
//----------------------------------------------------------------
// State | Inherited (no method)
// Status | Inherited (no method)
// On | on
// Off | off
//================================================================"/> </description> <deviceProperties name="TpgDevice" description=""> <type xsi:type="pogoDsl:StringType"/> @@ -26,7 +25,7 @@ <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <DefaultPropValue>60</DefaultPropValue> </deviceProperties> - <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR"> + <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> </argin> @@ -35,7 +34,7 @@ </argout> <status abstract="true" inherited="true" concrete="true"/> </commands> - <commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR"> + <commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> </argin> @@ -44,7 +43,7 @@ </argout> <status abstract="true" inherited="true" concrete="true"/> </commands> - <commands name="On" description="" execMethod="on" displayLevel="EXPERT"> + <commands name="On" description="" execMethod="on" displayLevel="EXPERT" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> @@ -56,7 +55,7 @@ <excludedStates>DISABLE</excludedStates> <excludedStates>FAULT</excludedStates> </commands> - <commands name="Off" description="" execMethod="off" displayLevel="EXPERT"> + <commands name="Off" description="" execMethod="off" displayLevel="EXPERT" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> @@ -68,7 +67,7 @@ <excludedStates>DISABLE</excludedStates> <excludedStates>FAULT</excludedStates> </commands> - <attributes name="Pressure" attType="Scalar" rwType="READ" displayLevel="OPERATOR" maxX="" maxY="" allocReadMember="true"> + <attributes name="Pressure" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true"> <dataType xsi:type="pogoDsl:DoubleType"/> <changeEvent fire="false" libCheckCriteria="true"/> <archiveEvent fire="false" libCheckCriteria="true"/> @@ -79,14 +78,6 @@ <readExcludedStates>DISABLE</readExcludedStates> <readExcludedStates>FAULT</readExcludedStates> </attributes> - <attributes name="DeviceState" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" maxX="" maxY="" memorized="true" allocReadMember="true"> - <dataType xsi:type="pogoDsl:UCharType"/> - <changeEvent fire="false" libCheckCriteria="true"/> - <archiveEvent fire="false" libCheckCriteria="true"/> - <dataReadyEvent fire="false" libCheckCriteria="true"/> - <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> - </attributes> <states name="ON" description=""> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> @@ -102,6 +93,6 @@ <states name="FAULT" description=""> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> - <preferences docHome="./doc_html" makefileHome="/usr/local/tango-7.2.6/share/pogo/preferences"/> + <preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.3/share/pogo/preferences"/> </classes> </pogoDsl:PogoSystem> diff --git a/src/VgClass.cpp b/src/VgClass.cpp index 6d82fbe2b107e3e43938c4eac964d1f4dac55637..3126cb190a7e738ae4eccd4bddf33aad2270c5a0 100644 --- a/src/VgClass.cpp +++ b/src/VgClass.cpp @@ -18,7 +18,7 @@ #include <VgClass.h> -/*----- PROTECTED REGION END -----*/ +/*----- PROTECTED REGION END -----*/ // VgClass.cpp //------------------------------------------------------------------- /** @@ -38,11 +38,8 @@ __declspec(dllexport) } } - namespace Vg_ns { - - //=================================================================== // Initialize pointer for singleton pattern //=================================================================== @@ -56,21 +53,19 @@ VgClass *VgClass::_instance = NULL; * @param s The class name */ //-------------------------------------------------------- -VgClass::VgClass(string &s):DeviceClass(s) +VgClass::VgClass(string &s):Tango::DeviceClass(s) { cout2 << "Entering VgClass constructor" << endl; set_default_property(); - get_class_property(); write_class_property(); - /*----- PROTECTED REGION ID(Vg::Class::constructor) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::constructor) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // Vg::Class::constructor + /*----- PROTECTED REGION END -----*/ // VgClass::constructor cout2 << "Leaving VgClass constructor" << endl; } - //-------------------------------------------------------- /** * method : VgClass::~VgClass() @@ -79,9 +74,9 @@ VgClass::VgClass(string &s):DeviceClass(s) //-------------------------------------------------------- VgClass::~VgClass() { - /*----- PROTECTED REGION ID(Vg::Class::destructor) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::destructor) ENABLED START -----*/ - /*----- PROTECTED REGION END -----*/ // Vg::Class::destructor + /*----- PROTECTED REGION END -----*/ // VgClass::destructor _instance = NULL; } @@ -105,11 +100,11 @@ VgClass *VgClass::init(const char *name) string s(name); _instance = new VgClass(s); } - catch (bad_alloc) + catch (bad_alloc &) { throw; - } - } + } + } return _instance; } @@ -132,7 +127,6 @@ VgClass *VgClass::instance() - //=================================================================== // Command execution method calls //=================================================================== @@ -147,14 +141,13 @@ VgClass *VgClass::instance() * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- -CORBA::Any *OnClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) +CORBA::Any *OnClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) { cout2 << "OnClass::execute(): arrived" << endl; - - ((static_cast<Vg *>(device))->on()); return new CORBA::Any(); } + //-------------------------------------------------------- /** * method : OffClass::execute() @@ -166,28 +159,21 @@ CORBA::Any *OnClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- -CORBA::Any *OffClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any) +CORBA::Any *OffClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) { cout2 << "OffClass::execute(): arrived" << endl; - - ((static_cast<Vg *>(device))->off()); return new CORBA::Any(); } - - //=================================================================== // Properties management //=================================================================== - //-------------------------------------------------------- /** - * method : VgClass::get_class_property - * description : Get the class property for specified name. - * - * @param name The property name + * Method : VgClass::get_class_property() + * Description : Get the class property for specified name. */ //-------------------------------------------------------- Tango::DbDatum VgClass::get_class_property(string &prop_name) @@ -199,10 +185,9 @@ Tango::DbDatum VgClass::get_class_property(string &prop_name) return Tango::DbDatum(prop_name); } - //-------------------------------------------------------- /** - * Method : Vg::VgClass::get_default_device_property()() + * Method : VgClass::get_default_device_property() * Description : Return the default value for device property. */ //-------------------------------------------------------- @@ -215,10 +200,9 @@ Tango::DbDatum VgClass::get_default_device_property(string &prop_name) return Tango::DbDatum(prop_name); } - //-------------------------------------------------------- /** - * Method : Vg::VgClass::get_default_class_property()() + * Method : VgClass::get_default_class_property() * Description : Return the default value for class property. */ //-------------------------------------------------------- @@ -234,22 +218,11 @@ Tango::DbDatum VgClass::get_default_class_property(string &prop_name) //-------------------------------------------------------- /** - * Method : Vg::VgClass::get_class_property() - * Description : // Add your own code to initialize - */ -//-------------------------------------------------------- -void VgClass::get_class_property() -{ -} - - -//-------------------------------------------------------- -/** - * Method : Vg::VgClass::set_default_property() + * Method : VgClass::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. + * 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. */ //-------------------------------------------------------- void VgClass::set_default_property() @@ -258,14 +231,13 @@ void VgClass::set_default_property() string prop_desc; string prop_def; vector<string> vect_data; - - // Set Default Class Properties - // Set Default Device Properties + // Set Default Class Properties + // Set Default device Properties prop_name = "TpgDevice"; prop_desc = ""; - prop_def = "undefined\n"; + prop_def = "undefined"; vect_data.clear(); vect_data.push_back("undefined"); if (prop_def.length()>0) @@ -277,10 +249,9 @@ void VgClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "Channel"; prop_desc = ""; - prop_def = "-1\n"; + prop_def = "-1"; vect_data.clear(); vect_data.push_back("-1"); if (prop_def.length()>0) @@ -292,10 +263,9 @@ void VgClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "Timeout"; prop_desc = ""; - prop_def = "3000\n"; + prop_def = "3000"; vect_data.clear(); vect_data.push_back("3000"); if (prop_def.length()>0) @@ -307,10 +277,9 @@ void VgClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "MaxBackOff"; prop_desc = ""; - prop_def = "60\n"; + prop_def = "60"; vect_data.clear(); vect_data.push_back("60"); if (prop_def.length()>0) @@ -324,49 +293,71 @@ void VgClass::set_default_property() add_wiz_dev_prop(prop_name, prop_desc); } - //-------------------------------------------------------- /** - * Method : Vg::VgClass::write_class_property() + * Method : VgClass::write_class_property() * Description : Set class description fields as property in database */ //-------------------------------------------------------- void VgClass::write_class_property() { // First time, check if database used + if (Tango::Util::_UseDb == false) + return; + + Tango::DbData data; + string classname = get_name(); + string header; + string::size_type start, end; + + // Put title + Tango::DbDatum title("ProjectTitle"); + string str_title("Vg"); + title << str_title; + data.push_back(title); + + // Put Description + Tango::DbDatum description("Description"); + vector<string> str_desc; + str_desc.push_back(""); + description << str_desc; + data.push_back(description); + + // Put inheritance + Tango::DbDatum inher_datum("InheritedFrom"); + vector<string> inheritance; + inheritance.push_back("TANGO_BASE_CLASS"); + inher_datum << inheritance; + data.push_back(inher_datum); + + // Call database and and values + get_db_class()->put_property(data); } - - - //=================================================================== // Factory methods //=================================================================== - //-------------------------------------------------------- /** - * method : VgClass::device_factory - * description : Create the device object(s) - * and store them in the device list - * - * @param *devlist_ptr The device name list + * Method : VgClass::device_factory() + * Description : Create the device object(s) + * and store them in the device list */ //-------------------------------------------------------- void VgClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) { - - /*----- PROTECTED REGION ID(Vg::Class::device_factory_before) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::device_factory_before) ENABLED START -----*/ // Add your own code - /*----- PROTECTED REGION END -----*/ // Vg::Class::device_factory_before + /*----- PROTECTED REGION END -----*/ // VgClass::device_factory_before // 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; - device_list.push_back(new Vg(this, (*devlist_ptr)[i])); + device_list.push_back(new Vg(this, (*devlist_ptr)[i])); } // Manage dynamic attributes if any @@ -386,112 +377,94 @@ void VgClass::device_factory(const Tango::DevVarStringArray *devlist_ptr) export_device(dev, dev->get_name().c_str()); } - /*----- PROTECTED REGION ID(Vg::Class::device_factory_after) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::device_factory_after) ENABLED START -----*/ // Add your own code - /*----- PROTECTED REGION END -----*/ // Vg::Class::device_factory_after - - + /*----- PROTECTED REGION END -----*/ // VgClass::device_factory_after } - - //-------------------------------------------------------- /** - * Method : Vg::VgClass::attribute_factory() + * Method : VgClass::attribute_factory() * Description : Create the attribute object(s) - * and store them in the attribute list + * and store them in the attribute list */ //-------------------------------------------------------- void VgClass::attribute_factory(vector<Tango::Attr *> &att_list) { - /*----- PROTECTED REGION ID(Vg::Class::attribute_factory_before) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::attribute_factory_before) ENABLED START -----*/ // Add your own code - /*----- PROTECTED REGION END -----*/ // Vg::Class::attribute_factory_before - - + /*----- PROTECTED REGION END -----*/ // VgClass::attribute_factory_before // Attribute : Pressure PressureAttrib *pressure = new PressureAttrib(); Tango::UserDefaultAttrProp pressure_prop; - // description not set for Pressure - // label not set for Pressure + // description not set for Pressure + // label not set for Pressure pressure_prop.set_unit("mbar"); pressure_prop.set_standard_unit("mbar"); pressure_prop.set_display_unit("mbar"); - // format not set for Pressure - // max_value not set for Pressure - // min_value not set for Pressure - // max_alarm not set for Pressure - // min_alarm not set for Pressure - // max_warning not set for Pressure - // min_warning not set for Pressure - // delta_t not set for Pressure - // delta_val not set for Pressure + // format not set for Pressure + // max_value not set for Pressure + // min_value not set for Pressure + // max_alarm not set for Pressure + // min_alarm not set for Pressure + // max_warning not set for Pressure + // min_warning not set for Pressure + // delta_t not set for Pressure + // delta_val not set for Pressure + pressure->set_default_properties(pressure_prop); // Not Polled pressure->set_disp_level(Tango::OPERATOR); - // Not memorized - - // Pressure does not fire change event - // Pressure does not fire archive event - // Pressure does not fire data_ready event + // Not Memorized att_list.push_back(pressure); - // Attribute : DeviceState - DeviceStateAttrib *devicestate = new DeviceStateAttrib(); - Tango::UserDefaultAttrProp devicestate_prop; - // description not set for DeviceState - // label not set for DeviceState - // unit not set for DeviceState - // standard_unit not set for DeviceState - // display_unit not set for DeviceState - // format not set for DeviceState - // max_value not set for DeviceState - // min_value not set for DeviceState - // max_alarm not set for DeviceState - // min_alarm not set for DeviceState - // max_warning not set for DeviceState - // min_warning not set for DeviceState - // delta_t not set for DeviceState - // delta_val not set for DeviceState - devicestate->set_default_properties(devicestate_prop); - // Not Polled - devicestate->set_disp_level(Tango::OPERATOR); - devicestate->set_memorized(); - devicestate->set_memorized_init(false); - // DeviceState does not fire change event - // DeviceState does not fire archive event - // DeviceState does not fire data_ready event - att_list.push_back(devicestate); - // Create a list of static attributes create_static_attribute_list(get_class_attr()->get_attr_list()); - - /*----- PROTECTED REGION ID(Vg::Class::attribute_factory_after) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::attribute_factory_after) ENABLED START -----*/ // Add your own code - /*----- PROTECTED REGION END -----*/ // Vg::Class::attribute_factory_after - + /*----- PROTECTED REGION END -----*/ // VgClass::attribute_factory_after +} +//-------------------------------------------------------- +/** + * Method : VgClass::pipe_factory() + * Description : Create the pipe object(s) + * and store them in the pipe list + */ +//-------------------------------------------------------- +void VgClass::pipe_factory() +{ + /*----- PROTECTED REGION ID(VgClass::pipe_factory_before) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // VgClass::pipe_factory_before + /*----- PROTECTED REGION ID(VgClass::pipe_factory_after) ENABLED START -----*/ + + // Add your own code + + /*----- PROTECTED REGION END -----*/ // VgClass::pipe_factory_after } - - //-------------------------------------------------------- /** - * Method : Vg::VgClass::command_factory() + * Method : VgClass::command_factory() * Description : Create the command object(s) - * and store them in the command list + * and store them in the command list */ //-------------------------------------------------------- void VgClass::command_factory() { - /*----- PROTECTED REGION ID(Vg::Class::command_factory_before) ENABLED START -----*/ + /*----- PROTECTED REGION ID(VgClass::command_factory_before) ENABLED START -----*/ + + /*----- PROTECTED REGION END -----*/ // VgClass::command_factory_before - /*----- PROTECTED REGION END -----*/ // Vg::Class::command_factory_before + // Command On OnClass *pOnCmd = new OnClass("On", Tango::DEV_VOID, Tango::DEV_VOID, @@ -499,6 +472,8 @@ void VgClass::command_factory() "", Tango::EXPERT); command_list.push_back(pOnCmd); + + // Command Off OffClass *pOffCmd = new OffClass("Off", Tango::DEV_VOID, Tango::DEV_VOID, @@ -507,26 +482,21 @@ void VgClass::command_factory() Tango::EXPERT); command_list.push_back(pOffCmd); - /*----- PROTECTED REGION ID(Vg::Class::command_factory_after) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::Class::command_factory_after + /*----- PROTECTED REGION ID(VgClass::command_factory_after) ENABLED START -----*/ + /*----- PROTECTED REGION END -----*/ // VgClass::command_factory_after } - - - //=================================================================== // Dynamic attributes related methods //=================================================================== - //-------------------------------------------------------- /** * method : VgClass::create_static_attribute_list * description : Create the a list of static attributes * - * @param att_list the ceated attribute list + * @param att_list the ceated attribute list */ //-------------------------------------------------------- void VgClass::create_static_attribute_list(vector<Tango::Attr *> &att_list) @@ -540,11 +510,9 @@ void VgClass::create_static_attribute_list(vector<Tango::Attr *> &att_list) cout2 << defaultAttList.size() << " attributes in default list" << endl; + /*----- PROTECTED REGION ID(VgClass::create_static_att_list) ENABLED START -----*/ - /*----- PROTECTED REGION ID(Vg::Class::create_static_att_list) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::Class::create_static_att_list - + /*----- PROTECTED REGION END -----*/ // VgClass::create_static_att_list } @@ -562,10 +530,10 @@ void VgClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_p 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()); Vg *dev = static_cast<Vg *> (dev_impl); - + vector<Tango::Attribute *> &dev_att_list = dev->get_device_attr()->get_attribute_list(); vector<Tango::Attribute *>::iterator ite_att; for (ite_att=dev_att_list.begin() ; ite_att != dev_att_list.end() ; ++ite_att) @@ -578,21 +546,34 @@ void VgClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_p { cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << 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); + dev->remove_attribute(att_list[att.get_attr_idx()], true, false); --ite_att; } } } - /*----- PROTECTED REGION ID(Vg::Class::erase_dynamic_attributes) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::Class::erase_dynamic_attributes + /*----- PROTECTED REGION ID(VgClass::erase_dynamic_attributes) ENABLED START -----*/ + /*----- PROTECTED REGION END -----*/ // VgClass::erase_dynamic_attributes } +//-------------------------------------------------------- +/** + * Method : VgClass::get_attr_object_by_name() + * Description : returns Tango::Attr * object found by name + */ +//-------------------------------------------------------- +Tango::Attr *VgClass::get_attr_object_by_name(vector<Tango::Attr *> &att_list, string attname) +{ + vector<Tango::Attr *>::iterator it; + for (it=att_list.begin() ; it<att_list.end() ; ++it) + if ((*it)->get_name()==attname) + return (*it); + // Attr does not exist + return NULL; +} - /*----- PROTECTED REGION ID(Vg::Class::Additional Methods) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::Class::Additional Methods +/*----- PROTECTED REGION ID(VgClass::Additional Methods) ENABLED START -----*/ + /*----- PROTECTED REGION END -----*/ // VgClass::Additional Methods } // namespace diff --git a/src/VgClass.h b/src/VgClass.h index bd7d348aef4d64f0beb9da20ac0462116fd83071..034d4331a3a7e1576c234aee4c7e757ee129b03c 100644 --- a/src/VgClass.h +++ b/src/VgClass.h @@ -23,15 +23,14 @@ #include <tango.h> #include <Vg.h> -/*----- PROTECTED REGION END -----*/ +/*----- PROTECTED REGION END -----*/ // VgClass.h + namespace Vg_ns { - /*----- PROTECTED REGION ID(Vg::classes for dynamic creation) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::classes for dynamic creation - +/*----- PROTECTED REGION ID(VgClass::classes for dynamic creation) ENABLED START -----*/ + /*----- PROTECTED REGION END -----*/ // VgClass::classes for dynamic creation //========================================= // Define classes for attributes @@ -41,34 +40,14 @@ class PressureAttrib: public Tango::Attr { public: PressureAttrib():Attr("Pressure", - Tango::DEV_DOUBLE, Tango::READ) {}; + Tango::DEV_DOUBLE, Tango::READ) {}; ~PressureAttrib() {}; - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<Vg *>(dev))->read_Pressure(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<Vg *>(dev))->is_Pressure_allowed(ty);} }; -// Attribute DeviceState class definition -class DeviceStateAttrib: public Tango::Attr -{ -public: - DeviceStateAttrib():Attr("DeviceState", - Tango::DEV_UCHAR, Tango::READ_WRITE) {}; - ~DeviceStateAttrib() {}; - - virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) - {(static_cast<Vg *>(dev))->read_DeviceState(att);} - virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) - {(static_cast<Vg *>(dev))->write_DeviceState(att);} - virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) - {return (static_cast<Vg *>(dev))->is_DeviceState_allowed(ty);} -}; - - - - //========================================= // Define classes for commands @@ -120,60 +99,54 @@ public: }; - - - /** - * The TemplateDevServClass singleton definition + * The VgClass singleton definition */ -class #ifdef _TG_WINDOWS_ - __declspec(dllexport) +class __declspec(dllexport) VgClass : public Tango::DeviceClass +#else +class VgClass : public Tango::DeviceClass #endif - VgClass : public Tango::DeviceClass { - /*----- PROTECTED REGION ID(Vg::Additionnal DServer data members) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::Additionnal DServer data members - + /*----- PROTECTED REGION ID(VgClass::Additionnal DServer data members) ENABLED START -----*/ + /*----- PROTECTED REGION END -----*/ // VgClass::Additionnal 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 VgClass *init(const char *); - static VgClass *instance(); - ~VgClass(); - Tango::DbDatum get_class_property(string &); - Tango::DbDatum get_default_device_property(string &); - Tango::DbDatum get_default_class_property(string &); + public: + // write class properties data members + Tango::DbData cl_prop; + Tango::DbData cl_def_prop; + Tango::DbData dev_def_prop; -protected: - VgClass(string &); - static VgClass *_instance; - void command_factory(); - void attribute_factory(vector<Tango::Attr *> &); - void write_class_property(); - void set_default_property(); - void get_class_property(); - string get_cvstag(); - 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; - - + // Method prototypes + static VgClass *init(const char *); + static VgClass *instance(); + ~VgClass(); + Tango::DbDatum get_class_property(string &); + Tango::DbDatum get_default_device_property(string &); + Tango::DbDatum get_default_class_property(string &); + + protected: + VgClass(string &); + static VgClass *_instance; + void command_factory(); + void attribute_factory(vector<Tango::Attr *> &); + void pipe_factory(); + void write_class_property(); + void set_default_property(); + void get_class_property(); + string get_cvstag(); + 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); }; -} // namespace - -#endif // VGCLASS_H +} // End of namespace +#endif // Vg_H diff --git a/src/VgStateMachine.cpp b/src/VgStateMachine.cpp index 0f3140c289fc212f52b3a2bfb2ff4e1916ae8a0b..90bbf6ad8a10f33912cb05ee05e3cec0ad9fd587 100644 --- a/src/VgStateMachine.cpp +++ b/src/VgStateMachine.cpp @@ -18,112 +18,72 @@ #include <Vg.h> #include <VgClass.h> -/*----- PROTECTED REGION END -----*/ +/*----- PROTECTED REGION END -----*/ // Vg::VgStateMachine.cpp +//================================================================ +// States | Description +//================================================================ +// ON | +// OFF | +// ALARM | +// DISABLE | +// FAULT | -/* - * Vg states description: - * - * ON : - * OFF : - * ALARM : - * DISABLE : - * FAULT : - */ namespace Vg_ns { - //================================================= // Attributes Allowed Methods //================================================= //-------------------------------------------------------- /** - * Method : Vg::is_PressureState_allowed() - * Description : Execution allowed for Pressure attribute. + * Method : Vg::is_Pressure_allowed() + * Description : Execution allowed for Pressure attribute */ //-------------------------------------------------------- - -bool Vg::is_Pressure_allowed(Tango::AttReqType type) +bool Vg::is_Pressure_allowed(TANGO_UNUSED(Tango::AttReqType type)) { - if ( // Compare device state with not allowed states for READ - get_state() == Tango::OFF || - get_state() == Tango::DISABLE || - get_state() == Tango::FAULT) - { - - /*----- PROTECTED REGION ID(Vg::read_PressureStateAllowed_READ) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::read_PressureStateAllowed_READ - - return false; - } - return true; -} - -//-------------------------------------------------------- -/** - * Method : Vg::is_DeviceStateState_allowed() - * Description : Execution allowed for DeviceState attribute. - */ -//-------------------------------------------------------- -bool Vg::is_DeviceState_allowed(Tango::AttReqType type) -{ - // Check if access type. - if ( type!=Tango::READ_REQ ) + // Check access type. + if ( type==Tango::READ_REQ ) { - // Not any excluded states for DeviceState attribute in WRITE access. + // Compare device state with not allowed states for READ + if (get_state()==Tango::OFF || + get_state()==Tango::DISABLE || + get_state()==Tango::FAULT) + { + /*----- PROTECTED REGION ID(Vg::PressureStateAllowed_READ) ENABLED START -----*/ - /*----- PROTECTED REGION ID(Vg::DeviceStateStateAllowed_WRITE) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::DeviceStateStateAllowed_WRITE - + /*----- PROTECTED REGION END -----*/ // Vg::PressureStateAllowed_READ + return false; + } return true; } - else - // Not any excluded states for DeviceState attribute in READ access. - - /*----- PROTECTED REGION ID(Vg::read_DeviceStateStateAllowed_READ) ENABLED START -----*/ - - /*----- PROTECTED REGION END -----*/ // Vg::read_DeviceStateStateAllowed_READ - return true; } - /*----- PROTECTED REGION ID(Vg::are_dynamic_attributes_allowed) ENABLED START -----*/ - - // Add your code to check if dynamic attributes are alowed - - /*----- PROTECTED REGION END -----*/ // Vg::are_dynamic_attributes_allowed - - //================================================= // Commands Allowed Methods //================================================= - //-------------------------------------------------------- /** - * Method : Vg::is_OnState_allowed() - * Description : Execution allowed for On command. + * Method : Vg::is_On_allowed() + * Description : Execution allowed for On attribute */ //-------------------------------------------------------- - -bool Vg::is_On_allowed(const CORBA::Any &any) +bool Vg::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any)) { - if ( // Compare device state with not allowed states for command - get_state() == Tango::ON || - get_state() == Tango::DISABLE || - get_state() == Tango::FAULT) + // Compare device state with not allowed states. + if (get_state()==Tango::ON || + get_state()==Tango::DISABLE || + get_state()==Tango::FAULT) { - /*----- PROTECTED REGION ID(Vg::OnStateAllowed) ENABLED START -----*/ /*----- PROTECTED REGION END -----*/ // Vg::OnStateAllowed - return false; } return true; @@ -131,33 +91,30 @@ bool Vg::is_On_allowed(const CORBA::Any &any) //-------------------------------------------------------- /** - * Method : Vg::is_OffState_allowed() - * Description : Execution allowed for Off command. + * Method : Vg::is_Off_allowed() + * Description : Execution allowed for Off attribute */ //-------------------------------------------------------- - -bool Vg::is_Off_allowed(const CORBA::Any &any) +bool Vg::is_Off_allowed(TANGO_UNUSED(const CORBA::Any &any)) { - if ( // Compare device state with not allowed states for command - get_state() == Tango::OFF || - get_state() == Tango::DISABLE || - get_state() == Tango::FAULT) + // Compare device state with not allowed states. + if (get_state()==Tango::OFF || + get_state()==Tango::DISABLE || + get_state()==Tango::FAULT) { - /*----- PROTECTED REGION ID(Vg::OffStateAllowed) ENABLED START -----*/ /*----- PROTECTED REGION END -----*/ // Vg::OffStateAllowed - return false; } return true; } - /*----- PROTECTED REGION ID(Vg::are_dynamic_commands_allowed) ENABLED START -----*/ +/*----- PROTECTED REGION ID(Vg::VgStateAllowed.AdditionalMethods) ENABLED START -----*/ - // Add your code to check if dynamic commands are alowed +// Additional Methods - /*----- PROTECTED REGION END -----*/ // Vg::are_dynamic_commands_allowed +/*----- PROTECTED REGION END -----*/ // Vg::VgStateAllowed.AdditionalMethods -} // namespace Vg_ns +} // End of namespace diff --git a/src/main.cpp b/src/main.cpp index ebcc6d5676c4f05f8f378d9f5e8b2ed7f2868fe0..9f63a04e4d88e60a0e8434ce511e6c5fb1c091b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,5 +53,4 @@ int main(int argc,char *argv[]) tg->server_cleanup(); return(0); } -/*PROTECTED REGION END*/ -//======================================================== +/*PROTECTED REGION END*/ // Vg::main.cpp