/*----- PROTECTED REGION ID(PreProcessor.h) ENABLED START -----*/ //============================================================================= // // file : PreProcessor.h // // description : Include file for the PreProcessor class // // project : PreProcessor // // This file is part of Tango device class. // // Tango is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Tango is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Tango. If not, see . // // $Author: $ // // $Revision: $ // $Date: $ // // $HeadURL: $ // //============================================================================= // This file is generated by POGO // (Program Obviously used to Generate tango Object) //============================================================================= #ifndef PreProcessor_H #define PreProcessor_H #include #include #include #include /*----- PROTECTED REGION END -----*/ // PreProcessor.h /** * PreProcessor class description: * Pre proccesing generic server */ namespace PreProcessor_ns { /*----- PROTECTED REGION ID(PreProcessor::Additional Class Declarations) ENABLED START -----*/ // Additional Class Declarations /*----- PROTECTED REGION END -----*/ // PreProcessor::Additional Class Declarations class PreProcessor : public TANGO_BASE_CLASS { /*----- PROTECTED REGION ID(PreProcessor::Data Members) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Private] Class variables //------------------------------------------------------------------------------ //Configuration shared pointer Configuration::SP m_configuration_sp; //Thread shared pointer EventThread::SP m_eventThread_sp; //Ignored file counter synchronization boost::mutex m_ignoredCounterMutex; //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 = 1; //Max milli second of sleep time allowed static const unsigned long MAX_SLEEP_TIME = 60; //Max milli second of wait time allowed static const unsigned long MAX_WAIT_TIME = 3600; //Max number of worker thread allowed static const unsigned int MAX_WORKER_NUMBER = 100; /*----- PROTECTED REGION END -----*/ // PreProcessor::Data Members // Device property data members public: // WatchPath: string watchPath; // RegularPath: Regulars files destination path string regularPath; // WarningPath: Warnings files destination path string warningPath; // ErrorPath: Error files destination path string errorPath; // ScriptPath: string scriptPath; // EventList: vector eventList; // SleepTime: Tango::DevULong sleepTime; // WaitTime: Tango::DevUShort waitTime; // WorkerNumber: Tango::DevUShort workerNumber; // IgnoreTimeout: Behaviour for missing end of file after timeout case: // true = process those files like regulars files // false = process those files like erroneous files Tango::DevBoolean ignoreTimeout; // AutoStart: Exec On command after init if state is not fault Tango::DevBoolean autoStart; // Attribute data members public: Tango::DevULong *attr_IgnoredFileCounter_read; Tango::DevULong *attr_RegularFileCounter_read; Tango::DevULong *attr_WarningFileCounter_read; Tango::DevULong *attr_ErrorFileCounter_read; // Constructors and destructors public: /** * Constructs a newly device object. * * @param cl Class. * @param s Device Name */ PreProcessor(Tango::DeviceClass *cl,string &s); /** * Constructs a newly device object. * * @param cl Class. * @param s Device Name */ PreProcessor(Tango::DeviceClass *cl,const char *s); /** * Constructs a newly device object. * * @param cl Class. * @param s Device name * @param d Device description. */ PreProcessor(Tango::DeviceClass *cl,const char *s,const char *d); /** * The device object destructor. */ ~PreProcessor() {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(); /* * Always executed method before execution command method. */ virtual void always_executed_hook(); // Attribute methods public: //-------------------------------------------------------- /* * Method : PreProcessor::read_attr_hardware() * Description : Hardware acquisition for attributes. */ //-------------------------------------------------------- virtual void read_attr_hardware(vector &attr_list); /** * Attribute IgnoredFileCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_IgnoredFileCounter(Tango::Attribute &attr); virtual bool is_IgnoredFileCounter_allowed(Tango::AttReqType type); /** * 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); //-------------------------------------------------------- /** * Method : PreProcessor::add_dynamic_attributes() * Description : Add dynamic attributes if any. */ //-------------------------------------------------------- void add_dynamic_attributes(); // Command related methods public: /** * Command On related method * Description: * */ virtual void on(); virtual bool is_On_allowed(const CORBA::Any &any); /** * Command Off related method * Description: * */ 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 incrementIgnoredCounter(); virtual void incrementRegularCounter(); virtual void incrementWarningCounter(); virtual void incrementErrorCounter(); private: //------------------------------------------------------------------------------ // [Private] Utilities methods //------------------------------------------------------------------------------ uint32_t create_inotify_mask(const std::vector&) throw (std::invalid_argument); virtual void checkIfFileExists(std::string) throw(std::invalid_argument); virtual void checkIfDirectoryExists(std::string) throw(std::invalid_argument); /*----- PROTECTED REGION END -----*/ // PreProcessor::Additional Method prototypes }; /*----- PROTECTED REGION ID(PreProcessor::Additional Classes Definitions) ENABLED START -----*/ // Additional Classes Definitions /*----- PROTECTED REGION END -----*/ // PreProcessor::Additional Classes Definitions } // End of namespace #endif // PreProcessor_H