Loading src/Client.cpp +5 −4 Original line number Diff line number Diff line #include <Client.h> #include <MetadataImporter.h> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> Loading @@ -9,8 +10,8 @@ namespace MetadataImporter_ns //============================================================================== // Client::Client() //============================================================================== Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_sp) : Tango::LogAdapter(deviceImpl_p), m_deviceImpl_p(deviceImpl_p), Client::Client(MetadataImporter* metadataImporter_p, Configuration::SP configuration_sp) : Tango::LogAdapter(metadataImporter_p), m_metadataImporter_p(metadataImporter_p), m_configuration_sp(configuration_sp), m_resolver(m_ioService), m_resetConnectionTimer(m_ioService), m_requestResponseTimer(m_ioService) { Loading @@ -18,7 +19,7 @@ Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ GOOGLE_PROTOBUF_VERIFY_VERSION; m_dBManager_sp = DBManager::create(deviceImpl_p, configuration_sp); m_dBManager_sp = DBManager::create(m_metadataImporter_p, configuration_sp); m_state = Tango::OFF; m_status="Disconnected"; Loading Loading @@ -54,7 +55,7 @@ void Client::start() m_dBManager_sp->connect(); m_protocolManager_sp = ProtocolManager::create(m_deviceImpl_p, m_protocolManager_sp = ProtocolManager::create(m_metadataImporter_p, m_configuration_sp, m_dBManager_sp); m_ioService.reset(); Loading src/Client.h +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ namespace MetadataImporter_ns { class MetadataImporter; class Client : public Tango::LogAdapter { public: Loading @@ -33,7 +35,7 @@ protected: //------------------------------------------------------------------------------ // [Protected] Constructor destructor //------------------------------------------------------------------------------ Client(Tango::DeviceImpl*, Configuration::SP); Client(MetadataImporter*, Configuration::SP); virtual ~Client(); Loading Loading @@ -121,8 +123,8 @@ protected: //------------------------------------------------------------------------------ // [Protected] Class variables //------------------------------------------------------------------------------ //Tango server class pointer Tango::DeviceImpl* m_deviceImpl_p; //MetadataImporter class pointer MetadataImporter* m_metadataImporter_p; //Configuration shared pointer Configuration::SP m_configuration_sp; Loading src/MetadataImporter.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -64,11 +64,13 @@ // State | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: //================================================================ // TupleCounter | Tango::DevULong Scalar //================================================================ namespace MetadataImporter_ns Loading Loading @@ -127,6 +129,7 @@ void MetadataImporter::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // MetadataImporter::delete_device delete[] attr_TupleCounter_read; } //-------------------------------------------------------- Loading @@ -149,9 +152,13 @@ void MetadataImporter::init_device() // Get the device properties from database get_device_property(); attr_TupleCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(MetadataImporter::init_device) ENABLED START -----*/ //Initialize tuple counter *attr_TupleCounter_read = 0; if(get_state() != Tango::FAULT) { try Loading Loading @@ -502,6 +509,26 @@ void MetadataImporter::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // MetadataImporter::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute TupleCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void MetadataImporter::read_TupleCounter(Tango::Attribute &attr) { DEBUG_STREAM << "MetadataImporter::read_TupleCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(MetadataImporter::read_TupleCounter) ENABLED START -----*/ boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); attr.set_value(attr_TupleCounter_read); /*----- PROTECTED REGION END -----*/ // MetadataImporter::read_TupleCounter } //-------------------------------------------------------- /** Loading Loading @@ -584,9 +611,39 @@ void MetadataImporter::off() /*----- PROTECTED REGION END -----*/ // MetadataImporter::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void MetadataImporter::reset_counter() { DEBUG_STREAM << "MetadataImporter::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(MetadataImporter::reset_counter) ENABLED START -----*/ boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); *attr_TupleCounter_read = 0; /*----- PROTECTED REGION END -----*/ // MetadataImporter::reset_counter } /*----- PROTECTED REGION ID(MetadataImporter::namespace_ending) ENABLED START -----*/ //============================================================================== // MetadataImporter::incrementTupleCounter() //============================================================================== void MetadataImporter::incrementTupleCounter(long tupleIncrement) { DEBUG_STREAM << "MetadataImporter::incrementTupleCounter() - " << device_name << endl; boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); *attr_TupleCounter_read += tupleIncrement; } //============================================================================== // MetadataImporter::checkIfFileExists() //============================================================================== Loading src/MetadataImporter.h +34 −3 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class MetadataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Tuple counter synchronization boost::mutex m_tupleCounterMutex; //Max port number allowed value for remote connection static const unsigned int MAX_REMOTE_PORT = 65535; Loading Loading @@ -118,6 +121,9 @@ public: // AutoStart: Exec On command after init if state is not fault Tango::DevBoolean autoStart; // Attribute data members public: Tango::DevULong *attr_TupleCounter_read; // Constructors and destructors public: Loading Loading @@ -179,6 +185,16 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute TupleCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_TupleCounter(Tango::Attribute &attr); virtual bool is_TupleCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -206,10 +222,25 @@ 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(MetadataImporter::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Users methods //------------------------------------------------------------------------------ virtual void incrementTupleCounter(long); private: //------------------------------------------------------------------------------ // [Private] Utilities methods //------------------------------------------------------------------------------ virtual void checkIfFileExists(std::string) throw(std::invalid_argument); Loading src/MetadataImporter.xmi +17 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,23 @@ <excludedStates>OFF</excludedStates> <excludedStates>FAULT</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="TupleCounter" 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="Metadata importer is in ON state (connected to server and ready to import)"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> Loading Loading
src/Client.cpp +5 −4 Original line number Diff line number Diff line #include <Client.h> #include <MetadataImporter.h> #include <boost/lexical_cast.hpp> #include <boost/bind.hpp> Loading @@ -9,8 +10,8 @@ namespace MetadataImporter_ns //============================================================================== // Client::Client() //============================================================================== Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_sp) : Tango::LogAdapter(deviceImpl_p), m_deviceImpl_p(deviceImpl_p), Client::Client(MetadataImporter* metadataImporter_p, Configuration::SP configuration_sp) : Tango::LogAdapter(metadataImporter_p), m_metadataImporter_p(metadataImporter_p), m_configuration_sp(configuration_sp), m_resolver(m_ioService), m_resetConnectionTimer(m_ioService), m_requestResponseTimer(m_ioService) { Loading @@ -18,7 +19,7 @@ Client::Client(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ GOOGLE_PROTOBUF_VERIFY_VERSION; m_dBManager_sp = DBManager::create(deviceImpl_p, configuration_sp); m_dBManager_sp = DBManager::create(m_metadataImporter_p, configuration_sp); m_state = Tango::OFF; m_status="Disconnected"; Loading Loading @@ -54,7 +55,7 @@ void Client::start() m_dBManager_sp->connect(); m_protocolManager_sp = ProtocolManager::create(m_deviceImpl_p, m_protocolManager_sp = ProtocolManager::create(m_metadataImporter_p, m_configuration_sp, m_dBManager_sp); m_ioService.reset(); Loading
src/Client.h +5 −3 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ namespace MetadataImporter_ns { class MetadataImporter; class Client : public Tango::LogAdapter { public: Loading @@ -33,7 +35,7 @@ protected: //------------------------------------------------------------------------------ // [Protected] Constructor destructor //------------------------------------------------------------------------------ Client(Tango::DeviceImpl*, Configuration::SP); Client(MetadataImporter*, Configuration::SP); virtual ~Client(); Loading Loading @@ -121,8 +123,8 @@ protected: //------------------------------------------------------------------------------ // [Protected] Class variables //------------------------------------------------------------------------------ //Tango server class pointer Tango::DeviceImpl* m_deviceImpl_p; //MetadataImporter class pointer MetadataImporter* m_metadataImporter_p; //Configuration shared pointer Configuration::SP m_configuration_sp; Loading
src/MetadataImporter.cpp +57 −0 Original line number Diff line number Diff line Loading @@ -64,11 +64,13 @@ // State | Inherited (no method) // On | on // Off | off // ResetCounter | reset_counter //================================================================ //================================================================ // Attributes managed is: //================================================================ // TupleCounter | Tango::DevULong Scalar //================================================================ namespace MetadataImporter_ns Loading Loading @@ -127,6 +129,7 @@ void MetadataImporter::delete_device() // Delete device allocated objects /*----- PROTECTED REGION END -----*/ // MetadataImporter::delete_device delete[] attr_TupleCounter_read; } //-------------------------------------------------------- Loading @@ -149,9 +152,13 @@ void MetadataImporter::init_device() // Get the device properties from database get_device_property(); attr_TupleCounter_read = new Tango::DevULong[1]; /*----- PROTECTED REGION ID(MetadataImporter::init_device) ENABLED START -----*/ //Initialize tuple counter *attr_TupleCounter_read = 0; if(get_state() != Tango::FAULT) { try Loading Loading @@ -502,6 +509,26 @@ void MetadataImporter::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) /*----- PROTECTED REGION END -----*/ // MetadataImporter::read_attr_hardware } //-------------------------------------------------------- /** * Read attribute TupleCounter related method * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ //-------------------------------------------------------- void MetadataImporter::read_TupleCounter(Tango::Attribute &attr) { DEBUG_STREAM << "MetadataImporter::read_TupleCounter(Tango::Attribute &attr) entering... " << endl; /*----- PROTECTED REGION ID(MetadataImporter::read_TupleCounter) ENABLED START -----*/ boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); attr.set_value(attr_TupleCounter_read); /*----- PROTECTED REGION END -----*/ // MetadataImporter::read_TupleCounter } //-------------------------------------------------------- /** Loading Loading @@ -584,9 +611,39 @@ void MetadataImporter::off() /*----- PROTECTED REGION END -----*/ // MetadataImporter::off } //-------------------------------------------------------- /** * Command ResetCounter related method * Description: * */ //-------------------------------------------------------- void MetadataImporter::reset_counter() { DEBUG_STREAM << "MetadataImporter::ResetCounter() - " << device_name << endl; /*----- PROTECTED REGION ID(MetadataImporter::reset_counter) ENABLED START -----*/ boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); *attr_TupleCounter_read = 0; /*----- PROTECTED REGION END -----*/ // MetadataImporter::reset_counter } /*----- PROTECTED REGION ID(MetadataImporter::namespace_ending) ENABLED START -----*/ //============================================================================== // MetadataImporter::incrementTupleCounter() //============================================================================== void MetadataImporter::incrementTupleCounter(long tupleIncrement) { DEBUG_STREAM << "MetadataImporter::incrementTupleCounter() - " << device_name << endl; boost::mutex::scoped_lock tupleCounterLock(m_tupleCounterMutex); *attr_TupleCounter_read += tupleIncrement; } //============================================================================== // MetadataImporter::checkIfFileExists() //============================================================================== Loading
src/MetadataImporter.h +34 −3 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class MetadataImporter : public TANGO_BASE_CLASS //Client class shared pointer Client::SP m_client_sp; //Tuple counter synchronization boost::mutex m_tupleCounterMutex; //Max port number allowed value for remote connection static const unsigned int MAX_REMOTE_PORT = 65535; Loading Loading @@ -118,6 +121,9 @@ public: // AutoStart: Exec On command after init if state is not fault Tango::DevBoolean autoStart; // Attribute data members public: Tango::DevULong *attr_TupleCounter_read; // Constructors and destructors public: Loading Loading @@ -179,6 +185,16 @@ public: //-------------------------------------------------------- virtual void read_attr_hardware(vector<long> &attr_list); /** * Attribute TupleCounter related methods * Description: * * Data type: Tango::DevULong * Attr type: Scalar */ virtual void read_TupleCounter(Tango::Attribute &attr); virtual bool is_TupleCounter_allowed(Tango::AttReqType type); //-------------------------------------------------------- /** Loading Loading @@ -206,10 +222,25 @@ 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(MetadataImporter::Additional Method prototypes) ENABLED START -----*/ //------------------------------------------------------------------------------ // [Public] Users methods //------------------------------------------------------------------------------ virtual void incrementTupleCounter(long); private: //------------------------------------------------------------------------------ // [Private] Utilities methods //------------------------------------------------------------------------------ virtual void checkIfFileExists(std::string) throw(std::invalid_argument); Loading
src/MetadataImporter.xmi +17 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,23 @@ <excludedStates>OFF</excludedStates> <excludedStates>FAULT</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="TupleCounter" 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="Metadata importer is in ON state (connected to server and ready to import)"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> Loading