Loading src/PreProcessor.cpp +131 −2 Original line number Diff line number Diff line Loading @@ -59,11 +59,15 @@ // Status | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: // Attributes managed are: //================================================================ // RegularFileCounter | Tango::DevULong Scalar // WarningFileCounter | Tango::DevULong Scalar // ErrorFileCounter | Tango::DevULong Scalar //================================================================ namespace PreProcessor_ns Loading Loading @@ -122,6 +126,9 @@ void PreProcessor::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // PreProcessor::delete_device delete[] attr_RegularFileCounter_read; delete[] attr_WarningFileCounter_read; delete[] attr_ErrorFileCounter_read; } //-------------------------------------------------------- Loading @@ -144,6 +151,9 @@ void PreProcessor::init_device() // Get the device properties from database get_device_property(); attr_RegularFileCounter_read = new Tango::DevULong[1]; attr_WarningFileCounter_read = new Tango::DevULong[1]; attr_ErrorFileCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(PreProcessor::init_device) ENABLED START -----*/ Loading Loading @@ -400,6 +410,60 @@ void PreProcessor::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // PreProcessor::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute RegularFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_RegularFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_RegularFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_RegularFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_RegularFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_RegularFileCounter } //-------------------------------------------------------- /** * Read attribute WarningFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_WarningFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_WarningFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_WarningFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_WarningFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_WarningFileCounter } //-------------------------------------------------------- /** * Read attribute ErrorFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_ErrorFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_ErrorFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_ErrorFileCounter } //-------------------------------------------------------- /** Loading Loading @@ -481,11 +545,76 @@ void PreProcessor::off() /*----- PROTECTED REGION END -----*/ // PreProcessor::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void PreProcessor::reset_counter() { DEBUG_STREAM << "PreProcessor::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(PreProcessor::reset_counter) ENABLED START -----*/ //Reset regular file counter boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); *attr_RegularFileCounter_read = 0; //Reset warning file counter boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex); *attr_WarningFileCounter_read = 0; //Reset error file counter boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex); *attr_ErrorFileCounter_read = 0; /*----- PROTECTED REGION END -----*/ // PreProcessor::reset_counter } //============================================================================== // PreProcessor::incrementRegularCounter() //============================================================================== void PreProcessor::incrementRegularCounter() { DEBUG_STREAM << "FitsImporter::incrementRegularCounter() - " << device_name << endl; boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); ++*attr_RegularFileCounter_read; } //============================================================================== // PreProcessor::incrementWarningCounter() //============================================================================== void PreProcessor::incrementWarningCounter() { DEBUG_STREAM << "FitsImporter::incrementWarningCounter() - " << device_name << endl; boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex); ++*attr_WarningFileCounter_read; } //============================================================================== // PreProcessor::incrementErrorCounter() //============================================================================== void PreProcessor::incrementErrorCounter() { DEBUG_STREAM << "FitsImporter::incrementErrorCounter() - " << device_name << endl; boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex); ++*attr_ErrorFileCounter_read; } /*----- PROTECTED REGION ID(PreProcessor::namespace_ending) ENABLED START -----*/ //============================================================================== // FitsImporter::create_inotify_mask() // PreProcessor::create_inotify_mask() //============================================================================== uint32_t PreProcessor::create_inotify_mask(const std::vector<std::string>& event_list) throw(std::invalid_argument) Loading src/PreProcessor.h +59 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <tango.h> #include <boost/thread.hpp> /*----- PROTECTED REGION END -----*/ // PreProcessor.h Loading Loading @@ -73,6 +74,15 @@ class PreProcessor : public TANGO_BASE_CLASS //Thread shared pointer EventThread::SP m_eventThread_sp; //Regular file counter synchronization boost::mutex m_regularCounterMutex; //Warning file counter synchronization boost::mutex m_warningCounterMutex; //Error file counter synchronization boost::mutex m_errorCounterMutex; //Min milli second of sleep time allowed static const unsigned long MIN_SLEEP_TIME = 100; Loading Loading @@ -106,6 +116,11 @@ public: // AutoStart: Exec On command after init if state is not fault Tango::DevBoolean autoStart; // Attribute data members public: Tango::DevULong *attr_RegularFileCounter_read; Tango::DevULong *attr_WarningFileCounter_read; Tango::DevULong *attr_ErrorFileCounter_read; // Constructors and destructors public: Loading Loading @@ -167,6 +182,34 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute RegularFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_RegularFileCounter(Tango::Attribute &attr); virtual bool is_RegularFileCounter_allowed(Tango::AttReqType type); /** * Attribute WarningFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_WarningFileCounter(Tango::Attribute &attr); virtual bool is_WarningFileCounter_allowed(Tango::AttReqType type); /** * Attribute ErrorFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_ErrorFileCounter(Tango::Attribute &attr); virtual bool is_ErrorFileCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -194,10 +237,26 @@ public: */ virtual void off(); virtual bool is_Off_allowed(const CORBA::Any &any); /** * Command ResetCounter related method * Description: * */ virtual void reset_counter(); virtual bool is_ResetCounter_allowed(const CORBA::Any &any); /*----- PROTECTED REGION ID(PreProcessor::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Users methods //------------------------------------------------------------------------------ virtual void incrementRegularCounter(); virtual void incrementWarningCounter(); virtual void incrementErrorCounter(); private: //------------------------------------------------------------------------------ // [Private] Utilities methods Loading src/PreProcessor.xmi +33 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,39 @@ <excludedStates>FAULT</excludedStates> <excludedStates>ALARM</excludedStates> </commands> <commands name="ResetCounter" description="" execMethod="reset_counter" displayLevel="OPERATOR" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> <type xsi:type="pogoDsl:VoidType"/> </argout> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </commands> <attributes name="RegularFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> <attributes name="WarningFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> <attributes name="ErrorFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> Loading src/PreProcessorClass.cpp +112 −13 Original line number Diff line number Diff line Loading @@ -193,6 +193,24 @@ CORBA::Any *OffClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORB return new CORBA::Any(); } //-------------------------------------------------------- /** * method : ResetCounterClass::execute() * description : method to trigger the execution of the command. * * @param device The device on which the command must be executed * @param in_any The command input data * * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- CORBA::Any *ResetCounterClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) { cout2 << "ResetCounterClass::execute(): arrived" << endl; ((static_cast<PreProcessor *>(device))->reset_counter()); return new CORBA::Any(); } //=================================================================== // Properties management Loading Loading @@ -571,6 +589,78 @@ void PreProcessorClass::attribute_factory(vector<Tango::Attr *> &att_list) // Add your own code /*----- PROTECTED REGION END -----*/ // PreProcessorClass::attribute_factory_before // Attribute : RegularFileCounter RegularFileCounterAttrib *regularfilecounter = new RegularFileCounterAttrib(); Tango::UserDefaultAttrProp regularfilecounter_prop; // description not set for RegularFileCounter // label not set for RegularFileCounter // unit not set for RegularFileCounter // standard_unit not set for RegularFileCounter // display_unit not set for RegularFileCounter // format not set for RegularFileCounter // max_value not set for RegularFileCounter // min_value not set for RegularFileCounter // max_alarm not set for RegularFileCounter // min_alarm not set for RegularFileCounter // max_warning not set for RegularFileCounter // min_warning not set for RegularFileCounter // delta_t not set for RegularFileCounter // delta_val not set for RegularFileCounter regularfilecounter->set_default_properties(regularfilecounter_prop); // Not Polled regularfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(regularfilecounter); // Attribute : WarningFileCounter WarningFileCounterAttrib *warningfilecounter = new WarningFileCounterAttrib(); Tango::UserDefaultAttrProp warningfilecounter_prop; // description not set for WarningFileCounter // label not set for WarningFileCounter // unit not set for WarningFileCounter // standard_unit not set for WarningFileCounter // display_unit not set for WarningFileCounter // format not set for WarningFileCounter // max_value not set for WarningFileCounter // min_value not set for WarningFileCounter // max_alarm not set for WarningFileCounter // min_alarm not set for WarningFileCounter // max_warning not set for WarningFileCounter // min_warning not set for WarningFileCounter // delta_t not set for WarningFileCounter // delta_val not set for WarningFileCounter warningfilecounter->set_default_properties(warningfilecounter_prop); // Not Polled warningfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(warningfilecounter); // Attribute : ErrorFileCounter ErrorFileCounterAttrib *errorfilecounter = new ErrorFileCounterAttrib(); Tango::UserDefaultAttrProp errorfilecounter_prop; // description not set for ErrorFileCounter // label not set for ErrorFileCounter // unit not set for ErrorFileCounter // standard_unit not set for ErrorFileCounter // display_unit not set for ErrorFileCounter // format not set for ErrorFileCounter // max_value not set for ErrorFileCounter // min_value not set for ErrorFileCounter // max_alarm not set for ErrorFileCounter // min_alarm not set for ErrorFileCounter // max_warning not set for ErrorFileCounter // min_warning not set for ErrorFileCounter // delta_t not set for ErrorFileCounter // delta_val not set for ErrorFileCounter errorfilecounter->set_default_properties(errorfilecounter_prop); // Not Polled errorfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(errorfilecounter); // Create a list of static attributes create_static_attribute_list(get_class_attr()->get_attr_list()); /*----- PROTECTED REGION ID(PreProcessorClass::attribute_factory_after) ENABLED START -----*/ Loading Loading @@ -613,6 +703,15 @@ void PreProcessorClass::command_factory() Tango::OPERATOR); command_list.push_back(pOffCmd); // Command ResetCounter ResetCounterClass *pResetCounterCmd = new ResetCounterClass("ResetCounter", Tango::DEV_VOID, Tango::DEV_VOID, "", "", Tango::OPERATOR); command_list.push_back(pResetCounterCmd); /*----- PROTECTED REGION ID(PreProcessorClass::command_factory_after) ENABLED START -----*/ // Add your own code Loading src/PreProcessorClass.h +71 −5 Original line number Diff line number Diff line Loading @@ -56,6 +56,49 @@ namespace PreProcessor_ns /*----- PROTECTED REGION END -----*/ // PreProcessorClass::classes for dynamic creation //========================================= // Define classes for attributes //========================================= // Attribute RegularFileCounter class definition class RegularFileCounterAttrib: public Tango::Attr { public: RegularFileCounterAttrib():Attr("RegularFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~RegularFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_RegularFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_RegularFileCounter_allowed(ty);} }; // Attribute WarningFileCounter class definition class WarningFileCounterAttrib: public Tango::Attr { public: WarningFileCounterAttrib():Attr("WarningFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~WarningFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_WarningFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_WarningFileCounter_allowed(ty);} }; // Attribute ErrorFileCounter class definition class ErrorFileCounterAttrib: public Tango::Attr { public: ErrorFileCounterAttrib():Attr("ErrorFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~ErrorFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_ErrorFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_ErrorFileCounter_allowed(ty);} }; //========================================= // Define classes for commands //========================================= Loading Loading @@ -105,6 +148,29 @@ public: {return (static_cast<PreProcessor *>(dev))->is_Off_allowed(any);} }; // Command ResetCounter class definition class ResetCounterClass : public Tango::Command { public: ResetCounterClass(const char *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) {}; ResetCounterClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out) :Command(name,in,out) {}; ~ResetCounterClass() {}; 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<PreProcessor *>(dev))->is_ResetCounter_allowed(any);} }; /** * The PreProcessorClass singleton definition Loading Loading
src/PreProcessor.cpp +131 −2 Original line number Diff line number Diff line Loading @@ -59,11 +59,15 @@ // Status | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: // Attributes managed are: //================================================================ // RegularFileCounter | Tango::DevULong Scalar // WarningFileCounter | Tango::DevULong Scalar // ErrorFileCounter | Tango::DevULong Scalar //================================================================ namespace PreProcessor_ns Loading Loading @@ -122,6 +126,9 @@ void PreProcessor::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // PreProcessor::delete_device delete[] attr_RegularFileCounter_read; delete[] attr_WarningFileCounter_read; delete[] attr_ErrorFileCounter_read; } //-------------------------------------------------------- Loading @@ -144,6 +151,9 @@ void PreProcessor::init_device() // Get the device properties from database get_device_property(); attr_RegularFileCounter_read = new Tango::DevULong[1]; attr_WarningFileCounter_read = new Tango::DevULong[1]; attr_ErrorFileCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(PreProcessor::init_device) ENABLED START -----*/ Loading Loading @@ -400,6 +410,60 @@ void PreProcessor::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // PreProcessor::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute RegularFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_RegularFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_RegularFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_RegularFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_RegularFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_RegularFileCounter } //-------------------------------------------------------- /** * Read attribute WarningFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_WarningFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_WarningFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_WarningFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_WarningFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_WarningFileCounter } //-------------------------------------------------------- /** * Read attribute ErrorFileCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr) { DEBUG_STREAM << "PreProcessor::read_ErrorFileCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(PreProcessor::read_ErrorFileCounter) ENABLED START -----*/ // Set the attribute value attr.set_value(attr_ErrorFileCounter_read); /*----- PROTECTED REGION END -----*/ // PreProcessor::read_ErrorFileCounter } //-------------------------------------------------------- /** Loading Loading @@ -481,11 +545,76 @@ void PreProcessor::off() /*----- PROTECTED REGION END -----*/ // PreProcessor::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void PreProcessor::reset_counter() { DEBUG_STREAM << "PreProcessor::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(PreProcessor::reset_counter) ENABLED START -----*/ //Reset regular file counter boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); *attr_RegularFileCounter_read = 0; //Reset warning file counter boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex); *attr_WarningFileCounter_read = 0; //Reset error file counter boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex); *attr_ErrorFileCounter_read = 0; /*----- PROTECTED REGION END -----*/ // PreProcessor::reset_counter } //============================================================================== // PreProcessor::incrementRegularCounter() //============================================================================== void PreProcessor::incrementRegularCounter() { DEBUG_STREAM << "FitsImporter::incrementRegularCounter() - " << device_name << endl; boost::mutex::scoped_lock regularCounterLock(m_regularCounterMutex); ++*attr_RegularFileCounter_read; } //============================================================================== // PreProcessor::incrementWarningCounter() //============================================================================== void PreProcessor::incrementWarningCounter() { DEBUG_STREAM << "FitsImporter::incrementWarningCounter() - " << device_name << endl; boost::mutex::scoped_lock warningCounterLock(m_warningCounterMutex); ++*attr_WarningFileCounter_read; } //============================================================================== // PreProcessor::incrementErrorCounter() //============================================================================== void PreProcessor::incrementErrorCounter() { DEBUG_STREAM << "FitsImporter::incrementErrorCounter() - " << device_name << endl; boost::mutex::scoped_lock errorCounterLock(m_errorCounterMutex); ++*attr_ErrorFileCounter_read; } /*----- PROTECTED REGION ID(PreProcessor::namespace_ending) ENABLED START -----*/ //============================================================================== // FitsImporter::create_inotify_mask() // PreProcessor::create_inotify_mask() //============================================================================== uint32_t PreProcessor::create_inotify_mask(const std::vector<std::string>& event_list) throw(std::invalid_argument) Loading
src/PreProcessor.h +59 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ #include <tango.h> #include <boost/thread.hpp> /*----- PROTECTED REGION END -----*/ // PreProcessor.h Loading Loading @@ -73,6 +74,15 @@ class PreProcessor : public TANGO_BASE_CLASS //Thread shared pointer EventThread::SP m_eventThread_sp; //Regular file counter synchronization boost::mutex m_regularCounterMutex; //Warning file counter synchronization boost::mutex m_warningCounterMutex; //Error file counter synchronization boost::mutex m_errorCounterMutex; //Min milli second of sleep time allowed static const unsigned long MIN_SLEEP_TIME = 100; Loading Loading @@ -106,6 +116,11 @@ public: // AutoStart: Exec On command after init if state is not fault Tango::DevBoolean autoStart; // Attribute data members public: Tango::DevULong *attr_RegularFileCounter_read; Tango::DevULong *attr_WarningFileCounter_read; Tango::DevULong *attr_ErrorFileCounter_read; // Constructors and destructors public: Loading Loading @@ -167,6 +182,34 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute RegularFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_RegularFileCounter(Tango::Attribute &attr); virtual bool is_RegularFileCounter_allowed(Tango::AttReqType type); /** * Attribute WarningFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_WarningFileCounter(Tango::Attribute &attr); virtual bool is_WarningFileCounter_allowed(Tango::AttReqType type); /** * Attribute ErrorFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_ErrorFileCounter(Tango::Attribute &attr); virtual bool is_ErrorFileCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -194,10 +237,26 @@ public: */ virtual void off(); virtual bool is_Off_allowed(const CORBA::Any &any); /** * Command ResetCounter related method * Description: * */ virtual void reset_counter(); virtual bool is_ResetCounter_allowed(const CORBA::Any &any); /*----- PROTECTED REGION ID(PreProcessor::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Users methods //------------------------------------------------------------------------------ virtual void incrementRegularCounter(); virtual void incrementWarningCounter(); virtual void incrementErrorCounter(); private: //------------------------------------------------------------------------------ // [Private] Utilities methods Loading
src/PreProcessor.xmi +33 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,39 @@ <excludedStates>FAULT</excludedStates> <excludedStates>ALARM</excludedStates> </commands> <commands name="ResetCounter" description="" execMethod="reset_counter" displayLevel="OPERATOR" polledPeriod="0"> <argin description=""> <type xsi:type="pogoDsl:VoidType"/> </argin> <argout description=""> <type xsi:type="pogoDsl:VoidType"/> </argout> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </commands> <attributes name="RegularFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> <attributes name="WarningFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> <attributes name="ErrorFileCounter" attType="Scalar" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" allocReadMember="true" isDynamic="false"> <dataType xsi:type="pogoDsl:UIntType"/> <changeEvent fire="false" libCheckCriteria="false"/> <archiveEvent fire="false" libCheckCriteria="false"/> <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> Loading
src/PreProcessorClass.cpp +112 −13 Original line number Diff line number Diff line Loading @@ -193,6 +193,24 @@ CORBA::Any *OffClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORB return new CORBA::Any(); } //-------------------------------------------------------- /** * method : ResetCounterClass::execute() * description : method to trigger the execution of the command. * * @param device The device on which the command must be executed * @param in_any The command input data * * returns The command output data (packed in the Any object) */ //-------------------------------------------------------- CORBA::Any *ResetCounterClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any)) { cout2 << "ResetCounterClass::execute(): arrived" << endl; ((static_cast<PreProcessor *>(device))->reset_counter()); return new CORBA::Any(); } //=================================================================== // Properties management Loading Loading @@ -571,6 +589,78 @@ void PreProcessorClass::attribute_factory(vector<Tango::Attr *> &att_list) // Add your own code /*----- PROTECTED REGION END -----*/ // PreProcessorClass::attribute_factory_before // Attribute : RegularFileCounter RegularFileCounterAttrib *regularfilecounter = new RegularFileCounterAttrib(); Tango::UserDefaultAttrProp regularfilecounter_prop; // description not set for RegularFileCounter // label not set for RegularFileCounter // unit not set for RegularFileCounter // standard_unit not set for RegularFileCounter // display_unit not set for RegularFileCounter // format not set for RegularFileCounter // max_value not set for RegularFileCounter // min_value not set for RegularFileCounter // max_alarm not set for RegularFileCounter // min_alarm not set for RegularFileCounter // max_warning not set for RegularFileCounter // min_warning not set for RegularFileCounter // delta_t not set for RegularFileCounter // delta_val not set for RegularFileCounter regularfilecounter->set_default_properties(regularfilecounter_prop); // Not Polled regularfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(regularfilecounter); // Attribute : WarningFileCounter WarningFileCounterAttrib *warningfilecounter = new WarningFileCounterAttrib(); Tango::UserDefaultAttrProp warningfilecounter_prop; // description not set for WarningFileCounter // label not set for WarningFileCounter // unit not set for WarningFileCounter // standard_unit not set for WarningFileCounter // display_unit not set for WarningFileCounter // format not set for WarningFileCounter // max_value not set for WarningFileCounter // min_value not set for WarningFileCounter // max_alarm not set for WarningFileCounter // min_alarm not set for WarningFileCounter // max_warning not set for WarningFileCounter // min_warning not set for WarningFileCounter // delta_t not set for WarningFileCounter // delta_val not set for WarningFileCounter warningfilecounter->set_default_properties(warningfilecounter_prop); // Not Polled warningfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(warningfilecounter); // Attribute : ErrorFileCounter ErrorFileCounterAttrib *errorfilecounter = new ErrorFileCounterAttrib(); Tango::UserDefaultAttrProp errorfilecounter_prop; // description not set for ErrorFileCounter // label not set for ErrorFileCounter // unit not set for ErrorFileCounter // standard_unit not set for ErrorFileCounter // display_unit not set for ErrorFileCounter // format not set for ErrorFileCounter // max_value not set for ErrorFileCounter // min_value not set for ErrorFileCounter // max_alarm not set for ErrorFileCounter // min_alarm not set for ErrorFileCounter // max_warning not set for ErrorFileCounter // min_warning not set for ErrorFileCounter // delta_t not set for ErrorFileCounter // delta_val not set for ErrorFileCounter errorfilecounter->set_default_properties(errorfilecounter_prop); // Not Polled errorfilecounter->set_disp_level(Tango::OPERATOR); // Not Memorized att_list.push_back(errorfilecounter); // Create a list of static attributes create_static_attribute_list(get_class_attr()->get_attr_list()); /*----- PROTECTED REGION ID(PreProcessorClass::attribute_factory_after) ENABLED START -----*/ Loading Loading @@ -613,6 +703,15 @@ void PreProcessorClass::command_factory() Tango::OPERATOR); command_list.push_back(pOffCmd); // Command ResetCounter ResetCounterClass *pResetCounterCmd = new ResetCounterClass("ResetCounter", Tango::DEV_VOID, Tango::DEV_VOID, "", "", Tango::OPERATOR); command_list.push_back(pResetCounterCmd); /*----- PROTECTED REGION ID(PreProcessorClass::command_factory_after) ENABLED START -----*/ // Add your own code Loading
src/PreProcessorClass.h +71 −5 Original line number Diff line number Diff line Loading @@ -56,6 +56,49 @@ namespace PreProcessor_ns /*----- PROTECTED REGION END -----*/ // PreProcessorClass::classes for dynamic creation //========================================= // Define classes for attributes //========================================= // Attribute RegularFileCounter class definition class RegularFileCounterAttrib: public Tango::Attr { public: RegularFileCounterAttrib():Attr("RegularFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~RegularFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_RegularFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_RegularFileCounter_allowed(ty);} }; // Attribute WarningFileCounter class definition class WarningFileCounterAttrib: public Tango::Attr { public: WarningFileCounterAttrib():Attr("WarningFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~WarningFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_WarningFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_WarningFileCounter_allowed(ty);} }; // Attribute ErrorFileCounter class definition class ErrorFileCounterAttrib: public Tango::Attr { public: ErrorFileCounterAttrib():Attr("ErrorFileCounter", Tango::DEV_ULONG, Tango::READ) {}; ~ErrorFileCounterAttrib() {}; virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {(static_cast<PreProcessor *>(dev))->read_ErrorFileCounter(att);} virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty) {return (static_cast<PreProcessor *>(dev))->is_ErrorFileCounter_allowed(ty);} }; //========================================= // Define classes for commands //========================================= Loading Loading @@ -105,6 +148,29 @@ public: {return (static_cast<PreProcessor *>(dev))->is_Off_allowed(any);} }; // Command ResetCounter class definition class ResetCounterClass : public Tango::Command { public: ResetCounterClass(const char *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) {}; ResetCounterClass(const char *name, Tango::CmdArgType in, Tango::CmdArgType out) :Command(name,in,out) {}; ~ResetCounterClass() {}; 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<PreProcessor *>(dev))->is_ResetCounter_allowed(any);} }; /** * The PreProcessorClass singleton definition Loading