Skip to content
Snippets Groups Projects
Commit 9d33e2e2 authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

Add class properties

parent a3498bd8
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="ASCII"?> <?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"> <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="AlarmHandler" pogoRevision="9.4"> <classes name="AlarmHandler" pogoRevision="9.6">
<description description="Elettra alarm handler device server" title="Elettra alarm handler device server" sourcePath="/home/graziano/ws/alarmhandler/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <description description="Elettra alarm handler device server" title="Elettra alarm handler device server" sourcePath="/home/graziano/ws/alarm-handler/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_4Impl" sourcePath=""/> <inheritances classname="Device_4Impl" sourcePath=""/>
<identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="SoftwareSystem" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="" reference=""/> <identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="SoftwareSystem" siteSpecific="" platform="Unix Like" bus="Not Applicable" manufacturer="" reference=""/>
</description> </description>
<classProperties name="GroupNames" description="Labels for Group mask, first is for mask 0x00">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</classProperties>
<classProperties name="SubscribeRetryPeriod" description="Retry subscription period in seconds">
<type xsi:type="pogoDsl:IntType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>30</DefaultPropValue>
</classProperties>
<classProperties name="StatisticsTimeWindow" description="Time window to compute statistics in seconds">
<type xsi:type="pogoDsl:IntVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<DefaultPropValue>60</DefaultPropValue>
</classProperties>
<deviceProperties name="GroupNames" description="Labels for Group mask, first is for mask 0x00"> <deviceProperties name="GroupNames" description="Labels for Group mask, first is for mask 0x00">
<type xsi:type="pogoDsl:StringVectorType"/> <type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
...@@ -281,6 +295,6 @@ ...@@ -281,6 +295,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="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=""/> <properties description="" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</dynamicAttributes> </dynamicAttributes>
<preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.2.5a/share/pogo/preferences"/> <preferences docHome="./doc_html" makefileHome="/usr/local/tango-9.3.3/share/pogo/preferences"/>
</classes> </classes>
</pogoDsl:PogoSystem> </pogoDsl:PogoSystem>
...@@ -80,6 +80,7 @@ AlarmHandlerClass::AlarmHandlerClass(string &s):Tango::DeviceClass(s) ...@@ -80,6 +80,7 @@ AlarmHandlerClass::AlarmHandlerClass(string &s):Tango::DeviceClass(s)
{ {
cout2 << "Entering AlarmHandlerClass constructor" << endl; cout2 << "Entering AlarmHandlerClass constructor" << endl;
set_default_property(); set_default_property();
get_class_property();
write_class_property(); write_class_property();
/*----- PROTECTED REGION ID(AlarmHandlerClass::constructor) ENABLED START -----*/ /*----- PROTECTED REGION ID(AlarmHandlerClass::constructor) ENABLED START -----*/
...@@ -454,6 +455,73 @@ Tango::DbDatum AlarmHandlerClass::get_default_class_property(string &prop_name) ...@@ -454,6 +455,73 @@ Tango::DbDatum AlarmHandlerClass::get_default_class_property(string &prop_name)
return Tango::DbDatum(prop_name); return Tango::DbDatum(prop_name);
} }
//--------------------------------------------------------
/**
* Method : AlarmHandlerClass::get_class_property()
* Description : Read database to initialize class property data members.
*/
//--------------------------------------------------------
void AlarmHandlerClass::get_class_property()
{
/*----- PROTECTED REGION ID(AlarmHandlerClass::get_class_property_before) ENABLED START -----*/
// Initialize class property data members
/*----- PROTECTED REGION END -----*/ // AlarmHandlerClass::get_class_property_before
// Read class properties from database.
cl_prop.push_back(Tango::DbDatum("GroupNames"));
cl_prop.push_back(Tango::DbDatum("SubscribeRetryPeriod"));
cl_prop.push_back(Tango::DbDatum("StatisticsTimeWindow"));
// Call database and extract values
if (Tango::Util::instance()->_UseDb==true)
get_db_class()->get_property(cl_prop);
Tango::DbDatum def_prop;
int i = -1;
// Try to extract GroupNames value
if (cl_prop[++i].is_empty()==false) cl_prop[i] >> groupNames;
else
{
// Check default value for GroupNames
def_prop = get_default_class_property(cl_prop[i].name);
if (def_prop.is_empty()==false)
{
def_prop >> groupNames;
cl_prop[i] << groupNames;
}
}
// Try to extract SubscribeRetryPeriod value
if (cl_prop[++i].is_empty()==false) cl_prop[i] >> subscribeRetryPeriod;
else
{
// Check default value for SubscribeRetryPeriod
def_prop = get_default_class_property(cl_prop[i].name);
if (def_prop.is_empty()==false)
{
def_prop >> subscribeRetryPeriod;
cl_prop[i] << subscribeRetryPeriod;
}
}
// Try to extract StatisticsTimeWindow value
if (cl_prop[++i].is_empty()==false) cl_prop[i] >> statisticsTimeWindow;
else
{
// Check default value for StatisticsTimeWindow
def_prop = get_default_class_property(cl_prop[i].name);
if (def_prop.is_empty()==false)
{
def_prop >> statisticsTimeWindow;
cl_prop[i] << statisticsTimeWindow;
}
}
/*----- PROTECTED REGION ID(AlarmHandlerClass::get_class_property_after) ENABLED START -----*/
// Check class property data members init
/*----- PROTECTED REGION END -----*/ // AlarmHandlerClass::get_class_property_after
}
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
...@@ -472,6 +540,47 @@ void AlarmHandlerClass::set_default_property() ...@@ -472,6 +540,47 @@ void AlarmHandlerClass::set_default_property()
vector<string> vect_data; vector<string> vect_data;
// Set Default Class Properties // Set Default Class Properties
prop_name = "GroupNames";
prop_desc = "Labels for Group mask, first is for mask 0x00";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
cl_def_prop.push_back(data);
add_wiz_class_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_class_prop(prop_name, prop_desc);
prop_name = "SubscribeRetryPeriod";
prop_desc = "Retry subscription period in seconds";
prop_def = "30";
vect_data.clear();
vect_data.push_back("30");
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
cl_def_prop.push_back(data);
add_wiz_class_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_class_prop(prop_name, prop_desc);
prop_name = "StatisticsTimeWindow";
prop_desc = "Time window to compute statistics in seconds";
prop_def = "60";
vect_data.clear();
vect_data.push_back("60");
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
cl_def_prop.push_back(data);
add_wiz_class_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_class_prop(prop_name, prop_desc);
// Set Default device Properties // Set Default device Properties
prop_name = "GroupNames"; prop_name = "GroupNames";
...@@ -1195,7 +1304,7 @@ void AlarmHandlerClass::erase_dynamic_attributes(const Tango::DevVarStringArray ...@@ -1195,7 +1304,7 @@ void AlarmHandlerClass::erase_dynamic_attributes(const Tango::DevVarStringArray
//-------------------------------------------------------- //--------------------------------------------------------
/** /**
* Method : AlarmHandlerClass::get_attr_by_name() * Method : AlarmHandlerClass::get_attr_object_by_name()
* Description : returns Tango::Attr * object found by name * Description : returns Tango::Attr * object found by name
*/ */
//-------------------------------------------------------- //--------------------------------------------------------
......
...@@ -574,6 +574,14 @@ class AlarmHandlerClass : public Tango::DeviceClass ...@@ -574,6 +574,14 @@ class AlarmHandlerClass : public Tango::DeviceClass
/*----- PROTECTED REGION END -----*/ // AlarmHandlerClass::Additionnal DServer data members /*----- PROTECTED REGION END -----*/ // AlarmHandlerClass::Additionnal DServer data members
// Class properties data members
public:
// GroupNames: Labels for Group mask, first is for mask 0x00
vector<string> groupNames;
// SubscribeRetryPeriod: Retry subscription period in seconds
Tango::DevLong subscribeRetryPeriod;
// StatisticsTimeWindow: Time window to compute statistics in seconds
vector<Tango::DevLong> statisticsTimeWindow;
public: public:
// write class properties data members // write class properties data members
Tango::DbData cl_prop; Tango::DbData cl_prop;
......
...@@ -128,7 +128,7 @@ void AlarmHandler::add_AlarmState_dynamic_attribute(string attname) ...@@ -128,7 +128,7 @@ void AlarmHandler::add_AlarmState_dynamic_attribute(string attname)
//-------------------------------------------------------- //--------------------------------------------------------
void AlarmHandler::remove_AlarmState_dynamic_attribute(string attname) void AlarmHandler::remove_AlarmState_dynamic_attribute(string attname)
{ {
remove_attribute(attname, true); remove_attribute(attname, true, Tango::Util::instance()->_UseDb);
map<string,Tango::DevEnum>::iterator ite; map<string,Tango::DevEnum>::iterator ite;
if ((ite=AlarmState_data.find(attname))!=AlarmState_data.end()) if ((ite=AlarmState_data.find(attname))!=AlarmState_data.end())
{ {
...@@ -189,7 +189,7 @@ void AlarmHandler::add_AlarmFormula_dynamic_attribute(string attname) ...@@ -189,7 +189,7 @@ void AlarmHandler::add_AlarmFormula_dynamic_attribute(string attname)
//-------------------------------------------------------- //--------------------------------------------------------
void AlarmHandler::remove_AlarmFormula_dynamic_attribute(string attname) void AlarmHandler::remove_AlarmFormula_dynamic_attribute(string attname)
{ {
remove_attribute(attname, true); remove_attribute(attname, true, Tango::Util::instance()->_UseDb);
map<string,Tango::DevString>::iterator ite; map<string,Tango::DevString>::iterator ite;
if ((ite=AlarmFormula_data.find(attname))!=AlarmFormula_data.end()) if ((ite=AlarmFormula_data.find(attname))!=AlarmFormula_data.end())
{ {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment