Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/alarm-handler
  • francesco.tripaldi/alarm-handler
2 results
Show changes
/*----- PROTECTED REGION ID(TestDevice.h) ENABLED START -----*/
//=============================================================================
//
// file : TestDevice.h
//
// description : Include for the TestDevice class.
//
// $Author: graziano $
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef TestDevice_H
#define TestDevice_H
#include <tango/tango.h>
#define MAX_ATTR_SIZE 3000
#define MAX_SPECTRUM_SIZE 100
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
#ifndef TANGO_LOG_INFO
#define TANGO_LOG_INFO cout2
#endif
#ifndef TANGO_LOG_DEBUG
#define TANGO_LOG_DEBUG cout4
#endif
/*----- PROTECTED REGION END -----*/
/**
* TestDevice class Description:
*
*/
namespace TestDevice_ns
{
/*----- PROTECTED REGION ID(TestDevice::Additional Class Declarations) ENABLED START -----*/
using namespace std;
// Additional Class Declarations
typedef struct {
void *value; //pointer to values
unsigned int size1; //actual size of dimension 1
unsigned int size2; //actual size of dimension 2
unsigned int max1; //max size of dimension 1
unsigned int max2; //max size of dimension 2
long type; //data type
unsigned char cmd_attr_type; //if data for attribute or for command
struct timeval ts;
} map_data_t;
enum { typeDouble, typeLong, typeBool, typeString, typeUchar};
/*----- PROTECTED REGION END -----*/ // TestDevice::Additional Class Declarations
class TestDevice : public TANGO_BASE_CLASS
{
friend class CmdClass;
/*----- PROTECTED REGION ID(TestDevice::Data Members) ENABLED START -----*/
// Add your own data members
protected:
map<std::string,map_data_t> attr_data_map;
void string_explode(string, string, vector<string>*);
void save_configuration();
void create_dynamic_attribute(vector<string> config);
long create_dynamic_command(const char* cmd_name, Tango::CmdArgType type_in, Tango::CmdArgType type_out, long size_in, long size_out);
template <typename Attr_type> void set_write_value(Attr_type *value, string attrname, long x = 1);
void set_write_value(Tango::DevString value, string attrname);
timeval last_read;
int numAttr;
char ref_array[1024][256];
double dlastDB;
bool waitingDB;
//Tango::DevString ref_ptr[1024];
/*----- PROTECTED REGION END -----*/ // TestDevice::Data Members
// Device property data members
public:
// Attr_config:
vector<string> attr_config;
// MinSaveDBPeriod:
Tango::DevLong minSaveDBPeriod;
// Attribute data members
public:
Tango::DevString *attr_ScalarDyn_read;
Tango::DevString attr_ScalarDyn_write;
Tango::DevDouble *attr_Ref_read;
Tango::DevString *attr_Values_read;
// Constructors and destructors
public:
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
TestDevice(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device Name
*/
TestDevice(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
TestDevice(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The object destructor.
*/
~TestDevice() {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 : TestDevice::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* ScalarDyn attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_ScalarDyn(Tango::Attribute &attr);
virtual void write_ScalarDyn(Tango::WAttribute &attr);
virtual bool is_ScalarDyn_allowed(Tango::AttReqType type);
/**
* SpectrumDyn attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum
*/
virtual void read_SpectrumDyn(Tango::Attribute &attr);
virtual void write_SpectrumDyn(Tango::WAttribute &attr);
virtual bool is_SpectrumDyn_allowed(Tango::AttReqType type);
/**
* Ref attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Spectrum
*/
virtual void read_Ref(Tango::Attribute &attr);
virtual void write_Ref(Tango::WAttribute &attr);
virtual bool is_Ref_allowed(Tango::AttReqType type);
/**
* Values attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum
*/
virtual void read_Values(Tango::Attribute &attr);
virtual void write_Values(Tango::WAttribute &attr);
virtual bool is_Values_allowed(Tango::AttReqType type);
/**
* Method : TestDevice::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
void add_dynamic_attributes();
// Command related methods
public:
/**
* Command WriteAttrname related methods.
*/
void write_attrname(const Tango::DevVarDoubleStringArray *);
virtual bool is_WriteAttrname_allowed(const CORBA::Any &any);
/**
* Command ReadAttrname related methods.
*/
Tango::DevVarDoubleArray *read_attrname(const Tango::DevVarStringArray *);
virtual bool is_ReadAttrname_allowed(const CORBA::Any &any);
/**
* Command Config related methods.
*/
void config(const Tango::DevVarStringArray *);
virtual bool is_Config_allowed(const CORBA::Any &any);
/**
* Command Add related methods.
*/
void add(const Tango::DevVarStringArray *);
virtual bool is_Add_allowed(const CORBA::Any &any);
/**
* Command AddDouble related methods.
*/
void add_double(const Tango::DevVarStringArray *);
virtual bool is_AddDouble_allowed(const CORBA::Any &any);
/**
* Command AddLong related methods.
*/
void add_long(const Tango::DevVarStringArray *);
virtual bool is_AddLong_allowed(const CORBA::Any &any);
/**
* Command AddBool related methods.
*/
void add_bool(const Tango::DevVarStringArray *);
virtual bool is_AddBool_allowed(const CORBA::Any &any);
/**
* Command AddString related methods.
*/
void add_string(const Tango::DevVarStringArray *);
virtual bool is_AddString_allowed(const CORBA::Any &any);
/**
* Command Remove related methods.
*/
void remove(const Tango::DevVarStringArray *);
virtual bool is_Remove_allowed(const CORBA::Any &any);
/*----- PROTECTED REGION ID(TestDevice::Additional Method prototypes) ENABLED START -----*/
// Additional Method prototypes
/*----- PROTECTED REGION END -----*/ // TestDevice::Additional Method prototypes
};
/*----- PROTECTED REGION ID(TestDevice::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes definitions
class CmdClass : public Tango::Command
{
public:
CmdClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
const char *out_desc,
Tango::DispLevel level,
int size_in,
Tango::DeviceImpl *dev)
:Command(name,in,out,in_desc,out_desc, level) {_max_in=size_in; mydevice=(TestDevice *)dev;};
CmdClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
int size_in,
Tango::DeviceImpl *dev)
:Command(name,in,out) {_max_in=size_in; mydevice=(TestDevice *)dev;};
~CmdClass() {};
virtual CORBA::Any *execute (Tango::DeviceImpl *dev, const CORBA::Any &any);
virtual bool is_allowed (Tango::DeviceImpl *dev, const CORBA::Any &any)
{return true/*(static_cast<TangoLib *>(dev))->is_Cmd_allowed(any)*/;}
int _max_in;
TestDevice *mydevice;
};
/*----- PROTECTED REGION END -----*/ // TestDevice::Additional Classes Definitions
} // namespace
#endif // TestDevice_H
/*----- PROTECTED REGION ID(AlarmClass.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: $";
static const char *TagName = "$Name: $";
static const char *CvsPath = "$Source: $";
static const char *SvnPath = "$HeadURL: $";
static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/";
/*----- PROTECTED REGION ID(TestDeviceClass.cpp) ENABLED START -----*/
//=============================================================================
//
// file : AlarmClass.cpp
// file : TestDeviceClass.cpp
//
// description : C++ source for the AlarmClass.
// A singleton class derived from DeviceClass.
// It implements the command and attribute list
// and all properties and methods required
// by the Alarm once per process.
// description : C++ source for the TestDeviceClass. A singleton
// class derived from DeviceClass. It implements the
// command list and all properties and methods required
// by the �name� once per process.
//
// project : alarm
// $Author: graziano $
//
// 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 <http://www.gnu.org/licenses/>.
//
// $Author: $
//
// $Revision: $
// $Date: $
//
// $HeadURL: $
//
//=============================================================================
// This file is generated by POGO
......@@ -44,15 +18,13 @@ static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc
//=============================================================================
#include <tango.h>
#include <Alarm.h>
#include <AlarmClass.h>
#include <TestDeviceClass.h>
/*----- PROTECTED REGION END -----*/ // AlarmClass.cpp
/*----- PROTECTED REGION END -----*/
//-------------------------------------------------------------------
/**
* Create AlarmClass singleton and
* Create TestDeviceClass singleton and
* return it in a C function for Python usage
*/
//-------------------------------------------------------------------
......@@ -63,50 +35,55 @@ __declspec(dllexport)
#endif
Tango::DeviceClass *_create_Alarm_class(const char *name) {
return Alarm_ns::AlarmClass::init(name);
Tango::DeviceClass *_create_TestDevice_class(const char *name) {
return TestDevice_ns::TestDeviceClass::init(name);
}
}
namespace Alarm_ns
namespace TestDevice_ns
{
//===================================================================
// Initialize pointer for singleton pattern
//===================================================================
AlarmClass *AlarmClass::_instance = NULL;
TestDeviceClass *TestDeviceClass::_instance = NULL;
//--------------------------------------------------------
/**
* method : AlarmClass::AlarmClass(string &s)
* description : constructor for the AlarmClass
* method : TestDeviceClass::TestDeviceClass(string &s)
* description : constructor for the TestDeviceClass
*
* @param s The class name
*/
//--------------------------------------------------------
AlarmClass::AlarmClass(string &s):Tango::DeviceClass(s)
TestDeviceClass::TestDeviceClass(string &s):DeviceClass(s)
{
cout2 << "Entering AlarmClass constructor" << endl;
TANGO_LOG_INFO << "Entering TestDeviceClass constructor" << endl;
set_default_property();
get_class_property();
write_class_property();
/*----- PROTECTED REGION ID(AlarmClass::constructor) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::constructor
/*----- PROTECTED REGION ID(TestDevice::Class::constructor) ENABLED START -----*/
cout2 << "Leaving AlarmClass constructor" << endl;
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::constructor
TANGO_LOG_INFO << "Leaving TestDeviceClass constructor" << endl;
}
//--------------------------------------------------------
/**
* method : AlarmClass::~AlarmClass()
* description : destructor for the AlarmClass
* method : TestDeviceClass::~TestDeviceClass()
* description : destructor for the TestDeviceClass
*/
//--------------------------------------------------------
AlarmClass::~AlarmClass()
TestDeviceClass::~TestDeviceClass()
{
/*----- PROTECTED REGION ID(AlarmClass::destructor) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::destructor
/*----- PROTECTED REGION ID(TestDevice::Class::destructor) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::destructor
_instance = NULL;
}
......@@ -114,38 +91,38 @@ AlarmClass::~AlarmClass()
//--------------------------------------------------------
/**
* method : AlarmClass::init
* method : TestDeviceClass::init
* description : Create the object if not already done.
* Otherwise, just return a pointer to the object
*
* @param name The class name
*/
//--------------------------------------------------------
AlarmClass *AlarmClass::init(const char *name)
TestDeviceClass *TestDeviceClass::init(const char *name)
{
if (_instance == NULL)
{
try
{
string s(name);
_instance = new AlarmClass(s);
_instance = new TestDeviceClass(s);
}
catch (bad_alloc &)
catch (bad_alloc)
{
throw;
}
}
}
}
return _instance;
}
//--------------------------------------------------------
/**
* method : AlarmClass::instance
* method : TestDeviceClass::instance
* description : Check if object already created,
* and return a pointer to the object
*/
//--------------------------------------------------------
AlarmClass *AlarmClass::instance()
TestDeviceClass *TestDeviceClass::instance()
{
if (_instance == NULL)
{
......@@ -157,12 +134,13 @@ AlarmClass *AlarmClass::instance()
//===================================================================
// Command execution method calls
//===================================================================
//--------------------------------------------------------
/**
* method : AckClass::execute()
* method : WriteAttrnameClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -171,18 +149,39 @@ AlarmClass *AlarmClass::instance()
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *AckClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *WriteAttrnameClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "AckClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
TANGO_LOG_INFO << "WriteAttrnameClass::execute(): arrived" << endl;
const Tango::DevVarDoubleStringArray *argin;
extract(in_any, argin);
((static_cast<Alarm *>(device))->ack(argin));
((static_cast<TestDevice *>(device))->write_attrname(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : ReadAttrnameClass::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 *ReadAttrnameClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
TANGO_LOG_INFO << "ReadAttrnameClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
return insert((static_cast<TestDevice *>(device))->read_attrname(argin));
}
//--------------------------------------------------------
/**
* method : LoadClass::execute()
* method : ConfigClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -191,18 +190,19 @@ CORBA::Any *AckClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_an
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *LoadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *ConfigClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "LoadClass::execute(): arrived" << endl;
Tango::DevString argin;
TANGO_LOG_INFO << "ConfigClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<Alarm *>(device))->load(argin));
((static_cast<TestDevice *>(device))->config(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : RemoveClass::execute()
* method : AddClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -211,18 +211,19 @@ CORBA::Any *LoadClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_a
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *RemoveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *AddClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "RemoveClass::execute(): arrived" << endl;
Tango::DevString argin;
TANGO_LOG_INFO << "AddClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<Alarm *>(device))->remove(argin));
((static_cast<TestDevice *>(device))->add(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : ConfiguredClass::execute()
* method : AddDoubleClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -231,17 +232,19 @@ CORBA::Any *RemoveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *ConfiguredClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *AddDoubleClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "ConfiguredClass::execute(): arrived" << endl;
Tango::DevString argin;
TANGO_LOG_INFO << "AddDoubleClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
return insert((static_cast<Alarm *>(device))->configured(argin));
}
((static_cast<TestDevice *>(device))->add_double(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : StopNewClass::execute()
* method : AddLongClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -250,16 +253,19 @@ CORBA::Any *ConfiguredClass::execute(Tango::DeviceImpl *device, const CORBA::Any
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *StopNewClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
CORBA::Any *AddLongClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "StopNewClass::execute(): arrived" << endl;
((static_cast<Alarm *>(device))->stop_new());
TANGO_LOG_INFO << "AddLongClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<TestDevice *>(device))->add_long(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : SilenceClass::execute()
* method : AddBoolClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -268,18 +274,40 @@ CORBA::Any *StopNewClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *SilenceClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *AddBoolClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "SilenceClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
TANGO_LOG_INFO << "AddBoolClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<Alarm *>(device))->silence(argin));
((static_cast<TestDevice *>(device))->add_bool(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : AddStringClass::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 *AddStringClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
TANGO_LOG_INFO << "AddStringClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<TestDevice *>(device))->add_string(argin));
return new CORBA::Any();
}
//--------------------------------------------------------
/**
* method : ModifyClass::execute()
* method : RemoveClass::execute()
* description : method to trigger the execution of the command.
*
* @param device The device on which the command must be executed
......@@ -288,26 +316,32 @@ CORBA::Any *SilenceClass::execute(Tango::DeviceImpl *device, const CORBA::Any &i
* returns The command output data (packed in the Any object)
*/
//--------------------------------------------------------
CORBA::Any *ModifyClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
CORBA::Any *RemoveClass::execute(Tango::DeviceImpl *device, const CORBA::Any &in_any)
{
cout2 << "ModifyClass::execute(): arrived" << endl;
Tango::DevString argin;
TANGO_LOG_INFO << "RemoveClass::execute(): arrived" << endl;
const Tango::DevVarStringArray *argin;
extract(in_any, argin);
((static_cast<Alarm *>(device))->modify(argin));
((static_cast<TestDevice *>(device))->remove(argin));
return new CORBA::Any();
}
//===================================================================
// Properties management
//===================================================================
//--------------------------------------------------------
/**
* Method : AlarmClass::get_class_property()
* Description : Get the class property for specified name.
* method : TestDeviceClass::get_class_property
* description : Get the class property for specified name.
*
* @param name The property name
*/
//--------------------------------------------------------
Tango::DbDatum AlarmClass::get_class_property(string &prop_name)
Tango::DbDatum TestDeviceClass::get_class_property(string &prop_name)
{
for (unsigned int i=0 ; i<cl_prop.size() ; i++)
if (cl_prop[i].name == prop_name)
......@@ -316,13 +350,14 @@ Tango::DbDatum AlarmClass::get_class_property(string &prop_name)
return Tango::DbDatum(prop_name);
}
//--------------------------------------------------------
/**
* Method : AlarmClass::get_default_device_property()
* Method : TestDevice::TestDeviceClass::get_default_device_property()()
* Description : Return the default value for device property.
*/
//--------------------------------------------------------
Tango::DbDatum AlarmClass::get_default_device_property(string &prop_name)
Tango::DbDatum TestDeviceClass::get_default_device_property(string &prop_name)
{
for (unsigned int i=0 ; i<dev_def_prop.size() ; i++)
if (dev_def_prop[i].name == prop_name)
......@@ -331,13 +366,14 @@ Tango::DbDatum AlarmClass::get_default_device_property(string &prop_name)
return Tango::DbDatum(prop_name);
}
//--------------------------------------------------------
/**
* Method : AlarmClass::get_default_class_property()
* Method : TestDevice::TestDeviceClass::get_default_class_property()()
* Description : Return the default value for class property.
*/
//--------------------------------------------------------
Tango::DbDatum AlarmClass::get_default_class_property(string &prop_name)
Tango::DbDatum TestDeviceClass::get_default_class_property(string &prop_name)
{
for (unsigned int i=0 ; i<cl_def_prop.size() ; i++)
if (cl_def_prop[i].name == prop_name)
......@@ -349,129 +385,37 @@ Tango::DbDatum AlarmClass::get_default_class_property(string &prop_name)
//--------------------------------------------------------
/**
* Method : AlarmClass::set_default_property()
* Method : TestDevice::TestDeviceClass::get_class_property()
* Description : // Add your own code to initialize
*/
//--------------------------------------------------------
void TestDeviceClass::get_class_property()
{
}
//--------------------------------------------------------
/**
* Method : TestDevice::TestDeviceClass::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 AlarmClass::set_default_property()
void TestDeviceClass::set_default_property()
{
string prop_name;
string prop_desc;
string prop_def;
vector<string> vect_data;
// Set Default Class Properties
// Set Default device Properties
prop_name = "AlarmStatus";
prop_desc = "Persistent storage of the alarms status";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
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 ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "ErrThreshold";
prop_desc = "Threshold for Tango error for being internal alarms";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DbHost";
prop_desc = "Host of the MySQL db";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DbUser";
prop_desc = "Username for the MySQL db";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DbPasswd";
prop_desc = "Password for the MySQL db";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DbName";
prop_desc = "Db name for the MySQL db";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "DbPort";
prop_desc = "Port of the MySQL db";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
{
Tango::DbDatum data(prop_name);
data << vect_data ;
dev_def_prop.push_back(data);
add_wiz_dev_prop(prop_name, prop_desc, prop_def);
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "InstanceName";
prop_desc = "Name used to associate configured alarm rules to this instance";
// Set Default Device Properties
prop_name = "Attr_config";
prop_desc = "";
prop_def = "";
vect_data.clear();
if (prop_def.length()>0)
......@@ -483,9 +427,10 @@ void AlarmClass::set_default_property()
}
else
add_wiz_dev_prop(prop_name, prop_desc);
prop_name = "SubscribeRetryPeriod";
prop_desc = "retry period in seconds";
prop_def = "";
prop_name = "MinSaveDBPeriod";
prop_desc = "";
prop_def = "10";
vect_data.clear();
if (prop_def.length()>0)
{
......@@ -498,13 +443,14 @@ void AlarmClass::set_default_property()
add_wiz_dev_prop(prop_name, prop_desc);
}
//--------------------------------------------------------
/**
* Method : AlarmClass::write_class_property()
* Method : TestDevice::TestDeviceClass::write_class_property()
* Description : Set class description fields as property in database
*/
//--------------------------------------------------------
void AlarmClass::write_class_property()
void TestDeviceClass::write_class_property()
{
// First time, check if database used
if (Tango::Util::_UseDb == false)
......@@ -517,119 +463,21 @@ void AlarmClass::write_class_property()
// Put title
Tango::DbDatum title("ProjectTitle");
string str_title("Elettra alarm device server");
string str_title("Storage Ring Access");
title << str_title;
data.push_back(title);
// Put Description
Tango::DbDatum description("Description");
vector<string> str_desc;
str_desc.push_back("Elettra alarm device server");
str_desc.push_back("");
description << str_desc;
data.push_back(description);
// put cvs or svn location
string filename("Alarm");
filename += "Class.cpp";
// check for cvs information
string src_path(CvsPath);
start = src_path.find("/");
if (start!=string::npos)
{
end = src_path.find(filename);
if (end>start)
{
string strloc = src_path.substr(start, end-start);
// Check if specific repository
start = strloc.find("/cvsroot/");
if (start!=string::npos && start>0)
{
string repository = strloc.substr(0, start);
if (repository.find("/segfs/")!=string::npos)
strloc = "ESRF:" + strloc.substr(start, strloc.length()-start);
}
Tango::DbDatum cvs_loc("cvs_location");
cvs_loc << strloc;
data.push_back(cvs_loc);
}
}
// check for svn information
else
{
string src_path(SvnPath);
start = src_path.find("://");
if (start!=string::npos)
{
end = src_path.find(filename);
if (end>start)
{
header = "$HeadURL: ";
start = header.length();
string strloc = src_path.substr(start, (end-start));
Tango::DbDatum svn_loc("svn_location");
svn_loc << strloc;
data.push_back(svn_loc);
}
}
}
// Get CVS or SVN revision tag
// CVS tag
string tagname(TagName);
header = "$Name: ";
start = header.length();
string endstr(" $");
end = tagname.find(endstr);
if (end!=string::npos && end>start)
{
string strtag = tagname.substr(start, end-start);
Tango::DbDatum cvs_tag("cvs_tag");
cvs_tag << strtag;
data.push_back(cvs_tag);
}
// SVN tag
string svnpath(SvnPath);
header = "$HeadURL: ";
start = header.length();
end = svnpath.find(endstr);
if (end!=string::npos && end>start)
{
string strloc = svnpath.substr(start, end-start);
string tagstr ("/tags/");
start = strloc.find(tagstr);
if ( start!=string::npos )
{
start = start + tagstr.length();
end = strloc.find(filename);
string strtag = strloc.substr(start, end-start-1);
Tango::DbDatum svn_tag("svn_tag");
svn_tag << strtag;
data.push_back(svn_tag);
}
}
// Get URL location
string httpServ(HttpServer);
if (httpServ.length()>0)
{
Tango::DbDatum db_doc_url("doc_url");
db_doc_url << httpServ;
data.push_back(db_doc_url);
}
// Put inheritance
Tango::DbDatum inher_datum("InheritedFrom");
vector<string> inheritance;
inheritance.push_back("TANGO_BASE_CLASS");
inheritance.push_back("Device_Impl");
inher_datum << inheritance;
data.push_back(inher_datum);
......@@ -637,30 +485,37 @@ void AlarmClass::write_class_property()
get_db_class()->put_property(data);
}
//===================================================================
// Factory methods
//===================================================================
//--------------------------------------------------------
/**
* Method : AlarmClass::device_factory()
* Description : Create the device object(s)
* and store them in the device list
* method : TestDeviceClass::device_factory
* description : Create the device object(s)
* and store them in the device list
*
* @param *devlist_ptr The device name list
*/
//--------------------------------------------------------
void AlarmClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
void TestDeviceClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
{
/*----- PROTECTED REGION ID(AlarmClass::device_factory_before) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDevice::Class::device_factory_before) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::device_factory_before
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::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 Alarm(this, (*devlist_ptr)[i]));
TANGO_LOG_DEBUG << "Device name : " << (*devlist_ptr)[i].in() << endl;
device_list.push_back(new TestDevice(this, (*devlist_ptr)[i]));
}
// Manage dynamic attributes if any
......@@ -670,7 +525,7 @@ void AlarmClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
for (unsigned long i=1 ; i<=devlist_ptr->length() ; i++)
{
// Add dynamic attributes if any
Alarm *dev = static_cast<Alarm *>(device_list[device_list.size()-i]);
TestDevice *dev = static_cast<TestDevice *>(device_list[device_list.size()-i]);
dev->add_dynamic_attributes();
// Check before if database used.
......@@ -680,178 +535,158 @@ void AlarmClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
export_device(dev, dev->get_name().c_str());
}
/*----- PROTECTED REGION ID(AlarmClass::device_factory_after) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDevice::Class::device_factory_after) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::device_factory_after
/*----- PROTECTED REGION END -----*/ // AlarmClass::device_factory_after
}
//--------------------------------------------------------
/**
* Method : AlarmClass::attribute_factory()
* Method : TestDevice::TestDeviceClass::attribute_factory()
* Description : Create the attribute object(s)
* and store them in the attribute list
* and store them in the attribute list
*/
//--------------------------------------------------------
void AlarmClass::attribute_factory(vector<Tango::Attr *> &att_list)
void TestDeviceClass::attribute_factory(vector<Tango::Attr *> &att_list)
{
/*----- PROTECTED REGION ID(AlarmClass::attribute_factory_before) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDevice::Class::attribute_factory_before) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::attribute_factory_before
// Attribute : alarm
alarmAttrib *alarm = new alarmAttrib();
Tango::UserDefaultAttrProp alarm_prop;
// description not set for alarm
// label not set for alarm
// unit not set for alarm
// standard_unit not set for alarm
// display_unit not set for alarm
// format not set for alarm
// max_value not set for alarm
// min_value not set for alarm
// max_alarm not set for alarm
// min_alarm not set for alarm
// max_warning not set for alarm
// min_warning not set for alarm
// delta_t not set for alarm
// delta_val not set for alarm
alarm->set_default_properties(alarm_prop);
// Not Polled
alarm->set_disp_level(Tango::OPERATOR);
// Not Memorized
att_list.push_back(alarm);
// Attribute : Ref
RefAttrib *ref = new RefAttrib();
att_list.push_back(ref);
// Attribute : Values
ValuesAttrib *values = new ValuesAttrib();
att_list.push_back(values);
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::attribute_factory_before
// Create a list of static attributes
create_static_attribute_list(get_class_attr()->get_attr_list());
/*----- PROTECTED REGION ID(AlarmClass::attribute_factory_after) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::attribute_factory_after
}
//--------------------------------------------------------
/**
* Method : AlarmClass::pipe_factory()
* Description : Create the pipe object(s)
* and store them in the pipe list
*/
//--------------------------------------------------------
void AlarmClass::pipe_factory()
{
/*----- PROTECTED REGION ID(AlarmClass::pipe_factory_before) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::pipe_factory_before
/*----- PROTECTED REGION ID(AlarmClass::pipe_factory_after) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDevice::Class::attribute_factory_after) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::pipe_factory_after
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::attribute_factory_after
}
//--------------------------------------------------------
/**
* Method : AlarmClass::command_factory()
* Method : TestDevice::TestDeviceClass::command_factory()
* Description : Create the command object(s)
* and store them in the command list
* and store them in the command list
*/
//--------------------------------------------------------
void AlarmClass::command_factory()
void TestDeviceClass::command_factory()
{
/*----- PROTECTED REGION ID(AlarmClass::command_factory_before) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::command_factory_before
/*----- PROTECTED REGION ID(TestDevice::Class::command_factory_before) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::command_factory_before
// Command Ack
AckClass *pAckCmd =
new AckClass("Ack",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"String array containing the alarms to be acknowledged",
ConfigClass *pConfigCmd =
new ConfigClass("Config",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of attribute names (double) to be created removing everything else",
"",
Tango::OPERATOR);
command_list.push_back(pAckCmd);
command_list.push_back(pConfigCmd);
// Command Load
LoadClass *pLoadCmd =
new LoadClass("Load",
Tango::DEV_STRING, Tango::DEV_VOID,
"Alarm entry",
AddClass *pAddCmd =
new AddClass("Add",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of attribute to be added.\nSyntax= name:type:value:timestamp.\ntype=double, long, bool, string.\ntimestamp=0 means now.",
"",
Tango::OPERATOR);
command_list.push_back(pLoadCmd);
command_list.push_back(pAddCmd);
// Command Remove
RemoveClass *pRemoveCmd =
new RemoveClass("Remove",
Tango::DEV_STRING, Tango::DEV_VOID,
"Alarm name",
AddDoubleClass *pAddDoubleCmd =
new AddDoubleClass("AddDouble",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of double attribute to be added.",
"",
Tango::OPERATOR);
command_list.push_back(pRemoveCmd);
command_list.push_back(pAddDoubleCmd);
// Command Configured
ConfiguredClass *pConfiguredCmd =
new ConfiguredClass("Configured",
Tango::DEV_STRING, Tango::DEVVAR_STRINGARRAY,
"String containing a filter for output, if empty return all alarms",
"Alarms configured",
AddLongClass *pAddLongCmd =
new AddLongClass("AddLong",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of long attribute to be added.",
"",
Tango::OPERATOR);
command_list.push_back(pConfiguredCmd);
command_list.push_back(pAddLongCmd);
// Command StopNew
StopNewClass *pStopNewCmd =
new StopNewClass("StopNew",
Tango::DEV_VOID, Tango::DEV_VOID,
AddBoolClass *pAddBoolCmd =
new AddBoolClass("AddBool",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of boolean attribute to be added.",
"",
Tango::OPERATOR);
command_list.push_back(pAddBoolCmd);
AddStringClass *pAddStringCmd =
new AddStringClass("AddString",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of string attribute to be added.",
"",
Tango::OPERATOR);
command_list.push_back(pStopNewCmd);
command_list.push_back(pAddStringCmd);
// Command Silence
SilenceClass *pSilenceCmd =
new SilenceClass("Silence",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"String array containing the alarms to be silenced",
RemoveClass *pRemoveCmd =
new RemoveClass("Remove",
Tango::DEVVAR_STRINGARRAY, Tango::DEV_VOID,
"Array of attribute names to be removed",
"",
Tango::OPERATOR);
command_list.push_back(pSilenceCmd);
command_list.push_back(pRemoveCmd);
// Command Modify
ModifyClass *pModifyCmd =
new ModifyClass("Modify",
Tango::DEV_STRING, Tango::DEV_VOID,
"Alarm entry",
WriteAttrnameClass *pWriteAttrnameCmd =
new WriteAttrnameClass("WriteAttrname",
Tango::DEVVAR_DOUBLESTRINGARRAY, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR);
command_list.push_back(pModifyCmd);
command_list.push_back(pWriteAttrnameCmd);
ReadAttrnameClass *pReadAttrnameCmd =
new ReadAttrnameClass("ReadAttrname",
Tango::DEVVAR_STRINGARRAY, Tango::DEVVAR_DOUBLEARRAY,
"",
"",
Tango::OPERATOR);
command_list.push_back(pReadAttrnameCmd);
/*----- PROTECTED REGION ID(TestDevice::Class::command_factory_after) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::command_factory_after
/*----- PROTECTED REGION ID(AlarmClass::command_factory_after) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // AlarmClass::command_factory_after
}
//===================================================================
// Dynamic attributes related methods
//===================================================================
//--------------------------------------------------------
/**
* method : AlarmClass::create_static_attribute_list
* method : TestDeviceClass::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 AlarmClass::create_static_attribute_list(vector<Tango::Attr *> &att_list)
void TestDeviceClass::create_static_attribute_list(vector<Tango::Attr *> &att_list)
{
for (unsigned long i=0 ; i<att_list.size() ; i++)
{
......@@ -860,72 +695,61 @@ void AlarmClass::create_static_attribute_list(vector<Tango::Attr *> &att_list)
defaultAttList.push_back(att_name);
}
cout2 << defaultAttList.size() << " attributes in default list" << endl;
TANGO_LOG_INFO << defaultAttList.size() << " attributes in default list" << endl;
/*----- PROTECTED REGION ID(TestDevice::Class::create_static_att_list) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::create_static_att_list
/*----- PROTECTED REGION ID(AlarmClass::create_static_att_list) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::create_static_att_list
}
//--------------------------------------------------------
/**
* method : AlarmClass::erase_dynamic_attributes
* method : TestDeviceClass::erase_dynamic_attributes
* description : delete the dynamic attributes if any.
*
* @param devlist_ptr the device list pointer
* @param list of all attributes
*/
//--------------------------------------------------------
void AlarmClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list)
void TestDeviceClass::erase_dynamic_attributes(const Tango::DevVarStringArray *devlist_ptr, vector<Tango::Attr *> &att_list)
{
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());
Alarm *dev = static_cast<Alarm *> (dev_impl);
TestDevice *dev = static_cast<TestDevice *> (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)
{
string att_name((*ite_att)->get_name_lower());
if ((att_name == "state") || (att_name == "status"))
if ((att_name == "state") || (att_name == "status") || (att_name == "ref"))
continue;
vector<string>::iterator ite_str = find(defaultAttList.begin(), defaultAttList.end(), att_name);
if (ite_str == defaultAttList.end())
{
cout2 << att_name << " is a UNWANTED dynamic attribute for device " << (*devlist_ptr)[i] << endl;
TANGO_LOG_INFO << 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, false);
dev->remove_attribute(att_list[att.get_attr_idx()],true);
--ite_att;
}
}
}
/*----- PROTECTED REGION ID(AlarmClass::erase_dynamic_attributes) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::erase_dynamic_attributes
}
/*----- PROTECTED REGION ID(TestDevice::Class::erase_dynamic_attributes) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::erase_dynamic_attributes
//--------------------------------------------------------
/**
* Method : AlarmClass::get_attr_by_name()
* Description : returns Tango::Attr * object found by name
*/
//--------------------------------------------------------
Tango::Attr *AlarmClass::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(AlarmClass::Additional Methods) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::Additional Methods
/*----- PROTECTED REGION ID(TestDevice::Class::Additional Methods) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::Class::Additional Methods
} // namespace
/*----- PROTECTED REGION ID(AlarmClass.h) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDeviceClass.h) ENABLED START -----*/
//=============================================================================
//
// file : AlarmClass.h
// file : TestDeviceClass.h
//
// description : Include for the Alarm root class.
// This class is the singleton class for
// the Alarm device class.
// It contains all properties and methods which the
// Alarm requires only once e.g. the commands.
// description : Include for the TestDeviceClass root class.
// This class is the singleton class for.
// the TestDevice device class..
// It contains all properties and methods which the .
// TestDevice requires only once e.g. the commands.
//
// project : alarm
// $Author: graziano $
//
// 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 <http://www.gnu.org/licenses/>.
//
// $Author: $
//
// $Revision: $
// $Date: $
//
// $HeadURL: $
//
//=============================================================================
// This file is generated by POGO
......@@ -39,64 +19,111 @@
//=============================================================================
#ifndef AlarmClass_H
#define AlarmClass_H
#ifndef TestDeviceCLASS_H
#define TestDeviceCLASS_H
#include <tango.h>
#include <Alarm.h>
#include <tango/tango.h>
#include <TestDevice.h>
/*----- PROTECTED REGION END -----*/ // AlarmClass.h
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
#ifndef TANGO_LOG_INFO
#define TANGO_LOG_INFO cout2
#endif
#ifndef TANGO_LOG_DEBUG
#define TANGO_LOG_DEBUG cout4
#endif
/*----- PROTECTED REGION END -----*/
namespace Alarm_ns
namespace TestDevice_ns
{
/*----- PROTECTED REGION ID(AlarmClass::classes for dynamic creation) ENABLED START -----*/
/*----- PROTECTED REGION ID(TestDevice::classes for dynamic creation) ENABLED START -----*/
using namespace std;
/*----- PROTECTED REGION END -----*/ // TestDevice::classes for dynamic creation
/*----- PROTECTED REGION END -----*/ // AlarmClass::classes for dynamic creation
//=========================================
// Define classes for attributes
//=========================================
// Attribute alarm class definition
class alarmAttrib: public Tango::SpectrumAttr
class SpectrumDynAttrib: public Tango::SpectrumAttr
{
public:
alarmAttrib():SpectrumAttr("alarm",
Tango::DEV_STRING, Tango::READ, 1024) {};
~alarmAttrib() {};
SpectrumDynAttrib():SpectrumAttr("SpectrumDyn",
Tango::DEV_DOUBLE, Tango::READ_WRITE, MAX_SPECTRUM_SIZE) {};
~SpectrumDynAttrib() {};
SpectrumDynAttrib(const string &att_name, long data_type, long s_size):SpectrumAttr(att_name.c_str(),
data_type, Tango::READ_WRITE, s_size) {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<Alarm *>(dev))->read_alarm(att);}
{(static_cast<TestDevice *>(dev))->read_SpectrumDyn(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TestDevice *>(dev))->write_SpectrumDyn(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<Alarm *>(dev))->is_alarm_allowed(ty);}
{return (static_cast<TestDevice *>(dev))->is_SpectrumDyn_allowed(ty);}
};
class ScalarDynAttrib: public Tango::Attr
{
public:
ScalarDynAttrib():Attr("ScalarDyn",
Tango::DEV_STRING, Tango::READ_WRITE) {};
~ScalarDynAttrib() {};
//=========================================
// Define classes for dynamic attributes
//=========================================
// Attribute AlarmState class definition
class AlarmStateAttrib: public Tango::Attr
ScalarDynAttrib(const string &att_name, long data_type):Attr(att_name.c_str(),
data_type, Tango::READ_WRITE) {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<TestDevice *>(dev))->read_ScalarDyn(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TestDevice *>(dev))->write_ScalarDyn(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<TestDevice *>(dev))->is_ScalarDyn_allowed(ty);}
};
class RefAttrib: public Tango::SpectrumAttr
{
public:
RefAttrib():SpectrumAttr("Ref", Tango::DEV_DOUBLE, Tango::READ_WRITE, 1024) {};
~RefAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<TestDevice *>(dev))->read_Ref(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TestDevice *>(dev))->write_Ref(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<TestDevice *>(dev))->is_Ref_allowed(ty);}
};
class ValuesAttrib: public Tango::SpectrumAttr
{
public:
AlarmStateAttrib(const string &att_name):Attr(att_name.c_str(),
Tango::DEV_BOOLEAN, Tango::READ) {};
~AlarmStateAttrib() {};
ValuesAttrib():SpectrumAttr("Values", Tango::DEV_STRING, Tango::READ_WRITE, 1024) {};
~ValuesAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<Alarm *>(dev))->read_AlarmState(att);}
{(static_cast<TestDevice *>(dev))->read_Values(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TestDevice *>(dev))->write_Values(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<Alarm *>(dev))->is_AlarmState_allowed(ty);}
{return (static_cast<TestDevice *>(dev))->is_Values_allowed(ty);}
};
//=========================================
// Define classes for commands
//=========================================
// Command Ack class definition
class AckClass : public Tango::Command
class WriteAttrnameClass : public Tango::Command
{
public:
AckClass(const char *name,
WriteAttrnameClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -104,22 +131,20 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
AckClass(const char *name,
WriteAttrnameClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~AckClass() {};
~WriteAttrnameClass() {};
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<Alarm *>(dev))->is_Ack_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_WriteAttrname_allowed(any);}
};
// Command Load class definition
class LoadClass : public Tango::Command
class ReadAttrnameClass : public Tango::Command
{
public:
LoadClass(const char *name,
ReadAttrnameClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -127,22 +152,20 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
LoadClass(const char *name,
ReadAttrnameClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~LoadClass() {};
~ReadAttrnameClass() {};
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<Alarm *>(dev))->is_Load_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_ReadAttrname_allowed(any);}
};
// Command Remove class definition
class RemoveClass : public Tango::Command
class ConfigClass : public Tango::Command
{
public:
RemoveClass(const char *name,
ConfigClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -150,22 +173,20 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
RemoveClass(const char *name,
ConfigClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~RemoveClass() {};
~ConfigClass() {};
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<Alarm *>(dev))->is_Remove_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_Config_allowed(any);}
};
// Command Configured class definition
class ConfiguredClass : public Tango::Command
class AddClass : public Tango::Command
{
public:
ConfiguredClass(const char *name,
AddClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -173,22 +194,20 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
ConfiguredClass(const char *name,
AddClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ConfiguredClass() {};
~AddClass() {};
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<Alarm *>(dev))->is_Configured_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_Add_allowed(any);}
};
// Command StopNew class definition
class StopNewClass : public Tango::Command
class AddDoubleClass : public Tango::Command
{
public:
StopNewClass(const char *name,
AddDoubleClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -196,22 +215,41 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
StopNewClass(const char *name,
AddDoubleClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~StopNewClass() {};
~AddDoubleClass() {};
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<Alarm *>(dev))->is_StopNew_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_AddDouble_allowed(any);}
};
class AddLongClass : public Tango::Command
{
public:
AddLongClass(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) {};
AddLongClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~AddLongClass() {};
// Command Silence class definition
class SilenceClass : public Tango::Command
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<TestDevice *>(dev))->is_AddLong_allowed(any);}
};
class AddBoolClass : public Tango::Command
{
public:
SilenceClass(const char *name,
AddBoolClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -219,22 +257,41 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
SilenceClass(const char *name,
AddBoolClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~SilenceClass() {};
~AddBoolClass() {};
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<Alarm *>(dev))->is_Silence_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_AddBool_allowed(any);}
};
class AddStringClass : public Tango::Command
{
public:
AddStringClass(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) {};
// Command Modify class definition
class ModifyClass : public Tango::Command
AddStringClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~AddStringClass() {};
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<TestDevice *>(dev))->is_AddString_allowed(any);}
};
class RemoveClass : public Tango::Command
{
public:
ModifyClass(const char *name,
RemoveClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out,
const char *in_desc,
......@@ -242,67 +299,70 @@ public:
Tango::DispLevel level)
:Command(name,in,out,in_desc,out_desc, level) {};
ModifyClass(const char *name,
RemoveClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ModifyClass() {};
~RemoveClass() {};
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<Alarm *>(dev))->is_Modify_allowed(any);}
{return (static_cast<TestDevice *>(dev))->is_Remove_allowed(any);}
};
/**
* The AlarmClass singleton definition
* The TemplateDevServClass singleton definition
*/
class
#ifdef _TG_WINDOWS_
class __declspec(dllexport) AlarmClass : public Tango::DeviceClass
#else
class AlarmClass : public Tango::DeviceClass
__declspec(dllexport)
#endif
TestDeviceClass : public Tango::DeviceClass
{
/*----- PROTECTED REGION ID(AlarmClass::Additionnal DServer data members) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // AlarmClass::Additionnal DServer data members
/*----- PROTECTED REGION ID(TestDevice::Additionnal DServer data members) ENABLED START -----*/
public:
// write class properties data members
Tango::DbData cl_prop;
Tango::DbData cl_def_prop;
Tango::DbData dev_def_prop;
// Method prototypes
static AlarmClass *init(const char *);
static AlarmClass *instance();
~AlarmClass();
Tango::DbDatum get_class_property(string &);
Tango::DbDatum get_default_device_property(string &);
Tango::DbDatum get_default_class_property(string &);
protected:
AlarmClass(string &);
static AlarmClass *_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();
/*----- PROTECTED REGION END -----*/ // TestDevice::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 TestDeviceClass *init(const char *);
static TestDeviceClass *instance();
~TestDeviceClass();
Tango::DbDatum get_class_property(string &);
Tango::DbDatum get_default_device_property(string &);
Tango::DbDatum get_default_class_property(string &);
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);
protected:
TestDeviceClass(string &);
static TestDeviceClass *_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;
};
} // End of namespace
} // namespace
#endif // TestDeviceCLASS_H
#endif // Alarm_H
/*----- PROTECTED REGION ID(TestDeviceStateMachine.cpp) ENABLED START -----*/
//=============================================================================
//
// file : TestDeviceStateMachine.cpp
//
// description : C++ source for the �name� and its alowed
// methods for commands and attributes
//
// $Author: graziano $
//
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <TestDevice.h>
#include <TestDeviceClass.h>
/*----- PROTECTED REGION END -----*/
/*
* TestDevice states description:
*
*/
namespace TestDevice_ns
{
//=================================================
// Attributes Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : TestDevice::is_ScalarDynState_allowed()
* Description : Execution allowed for ScalarDyn attribute.
*/
//--------------------------------------------------------
bool TestDevice::is_ScalarDyn_allowed(Tango::AttReqType type)
{
// Not any excluded states for ScalarDyn attribute in READ access.
/*----- PROTECTED REGION ID(TestDevice::is_ScalarDyn_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::is_ScalarDyn_allowed
return true;
}
bool TestDevice::is_SpectrumDyn_allowed(Tango::AttReqType type)
{
// Not any excluded states for SpectrumDyn attribute in READ access.
/*----- PROTECTED REGION ID(TestDevice::is_SpectrumDyn_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::is_SpectrumDyn_allowed
return true;
}
bool TestDevice::is_Ref_allowed(Tango::AttReqType type)
{
// Not any excluded states for Ref attribute in READ access.
/*----- PROTECTED REGION ID(TestDevice::is_Ref_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::is_Ref_allowed
return true;
}
bool TestDevice::is_Values_allowed(Tango::AttReqType type)
{
// Not any excluded states for Values attribute in READ access.
/*----- PROTECTED REGION ID(TestDevice::is_Values_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TestDevice::is_Values_allowed
return true;
}
/*----- PROTECTED REGION ID(TestDevice::are_dynamic_attributes_allowed) ENABLED START -----*/
// Add your code to check if dynamic attributes are alowed
/*----- PROTECTED REGION END -----*/ // TestDevice::are_dynamic_attributes_allowed
//=================================================
// Commands Allowed Methods
//=================================================
//--------------------------------------------------------
/**
* Method : TestDevice::is_WriteAttrname_allowed()
* Description : Execution allowed for WriteAttrname command.
*/
//--------------------------------------------------------
bool TestDevice::is_WriteAttrname_allowed(const CORBA::Any &any)
{
// Not any excluded states for WriteAttrname command.
/*----- PROTECTED REGION ID(XPI::is_WriteAttrname_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_WriteAttrname_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_ReadAttrname_allowed()
* Description : Execution allowed for ReadAttrname command.
*/
//--------------------------------------------------------
bool TestDevice::is_ReadAttrname_allowed(const CORBA::Any &any)
{
// Not any excluded states for ReadAttrname command.
/*----- PROTECTED REGION ID(XPI::is_ReadAttrname_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_ReadAttrname_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_Config_allowed()
* Description : Execution allowed for Config command.
*/
//--------------------------------------------------------
bool TestDevice::is_Config_allowed(const CORBA::Any &any)
{
// Not any excluded states for Config command.
/*----- PROTECTED REGION ID(XPI::is_Config_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_Config_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_Add_allowed()
* Description : Execution allowed for Add command.
*/
//--------------------------------------------------------
bool TestDevice::is_Add_allowed(const CORBA::Any &any)
{
// Not any excluded states for Add command.
/*----- PROTECTED REGION ID(XPI::is_Add_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_Add_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_AddDouble_allowed()
* Description : Execution allowed for AddDouble command.
*/
//--------------------------------------------------------
bool TestDevice::is_AddDouble_allowed(const CORBA::Any &any)
{
// Not any excluded states for AddDouble command.
/*----- PROTECTED REGION ID(XPI::is_AddDouble_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_AddDouble_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_AddLong_allowed()
* Description : Execution allowed for AddLong command.
*/
//--------------------------------------------------------
bool TestDevice::is_AddLong_allowed(const CORBA::Any &any)
{
// Not any excluded states for AddLong command.
/*----- PROTECTED REGION ID(XPI::is_AddLong_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_AddLong_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_AddBool_allowed()
* Description : Execution allowed for AddBool command.
*/
//--------------------------------------------------------
bool TestDevice::is_AddBool_allowed(const CORBA::Any &any)
{
// Not any excluded states for AddBool command.
/*----- PROTECTED REGION ID(XPI::is_AddBool_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_AddBool_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_AddString_allowed()
* Description : Execution allowed for AddString command.
*/
//--------------------------------------------------------
bool TestDevice::is_AddString_allowed(const CORBA::Any &any)
{
// Not any excluded states for AddString command.
/*----- PROTECTED REGION ID(XPI::is_AddString_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_AddString_allowed
return true;
}
//--------------------------------------------------------
/**
* Method : TestDevice::is_Remove_allowed()
* Description : Execution allowed for Remove command.
*/
//--------------------------------------------------------
bool TestDevice::is_Remove_allowed(const CORBA::Any &any)
{
// Not any excluded states for Remove command.
/*----- PROTECTED REGION ID(XPI::is_Remove_allowed) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // XPI::is_Remove_allowed
return true;
}
/*----- PROTECTED REGION ID(TestDevice::are_dynamic_commands_allowed) ENABLED START -----*/
// Add your code to check if dynamic commands are alowed
/*----- PROTECTED REGION END -----*/ // TestDevice::are_dynamic_commands_allowed
} // namespace TestDevice_ns
/*PROTECTED REGION ID(TestDevice::main.cpp) ENABLED START*/
//=============================================================================
//
// file : TestDevice.cpp
//
// description : C++ source for the TestDevice device server main.
// The main rule is to initialise (and create) the Tango
// system and to create the DServerClass singleton.
// The main should be the same for every Tango device server.
//
// $Author: graziano $
//
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango/tango.h>
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
#ifndef TANGO_LOG_INFO
#define TANGO_LOG_INFO cout2
#endif
#ifndef TANGO_LOG_DEBUG
#define TANGO_LOG_DEBUG cout4
#endif
int main(int argc,char *argv[])
{
using namespace std;
Tango::Util *tg = NULL;
try
{
// Initialise the device server
//----------------------------------------
tg = Tango::Util::init(argc,argv);
// Create the device server singleton
// which will create everything
//----------------------------------------
tg->server_init(false);
// Run the endless loop
//----------------------------------------
TANGO_LOG << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc)
{
TANGO_LOG << "Can't allocate memory to store device object !!!" << endl;
TANGO_LOG << "Exiting" << endl;
}
catch (CORBA::Exception &e)
{
Tango::Except::print_exception(e);
TANGO_LOG << "Received a CORBA_Exception" << endl;
TANGO_LOG << "Exiting" << endl;
}
if (tg!=NULL)
tg->server_cleanup();
return(0);
}
/*PROTECTED REGION END*/
//========================================================