Commit f651704b authored by Jean-Luc Pons's avatar Jean-Luc Pons
Browse files

Initial import

parents
.idea/
cmake-build-debug/
bin/
obj/
This diff is collapsed.
/*----- PROTECTED REGION ID(AttributeCombiner.h) ENABLED START -----*/
//=============================================================================
//
// file : AttributeCombiner.h
//
// description : Include file for the AttributeCombiner class
//
// project : AttributeCombiner
//
// 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/>.
//
//
// Copyright (C): 2018
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// France
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef AttributeCombiner_H
#define AttributeCombiner_H
#include <tango.h>
#include <AttributeMap.h>
#define MAXATTRIBUTE 32 // Maximum number of attribute in a definition
#define MAXERROR 5 // Maximum number of error per device
#define MAXVALUELENGTH 100000 // Maximum length of a spectrum attribute
typedef struct {
vector<string> errList;
} ERRITEM;
/*----- PROTECTED REGION END -----*/ // AttributeCombiner.h
/**
* AttributeCombiner class description:
* A class to combine attributes coming from several devices
*/
namespace AttributeCombiner_ns
{
/*----- PROTECTED REGION ID(AttributeCombiner::Additional Class Declarations) ENABLED START -----*/
// Additional Class Declarations
class DynAttribute;
class DynSpectrumAttribute;
class DynImageAttribute;
/*----- PROTECTED REGION END -----*/ // AttributeCombiner::Additional Class Declarations
class AttributeCombiner : public TANGO_BASE_CLASS
{
/*----- PROTECTED REGION ID(AttributeCombiner::Data Members) ENABLED START -----*/
// Add your own data members
public:
AttributeMap attMap;
Tango::Group *deviceGroup;
vector<ERRITEM> errorStack;
Tango::DeviceProxy *self;
template<typename inType>
void READG(Tango::Attribute &attr,inType &value,ATTITEM *item,Tango::GroupAttrReplyList arl[]);
template<typename T>
void WRITEG(Tango::WAttribute &attr,ATTITEM *item,Tango::GroupReplyList arl[]);
template <typename inType,typename outType>
void READSCALAR(Tango::Attribute &attr,ATTITEM *item,Tango::GroupAttrReplyList arl[],outType invalid,outType disableValue);
template <typename inType>
void READSPECTRUM(Tango::Attribute &attr,ATTITEM *item,Tango::GroupAttrReplyList arl[]);
template <typename inType,typename outType>
void WRITES(Tango::WAttribute &attr,ATTITEM *item,Tango::GroupReplyList arl[]);
virtual void read_dyn_attributes(Tango::Attribute &attr,DynAttribute *src);
virtual void write_dyn_attributes(Tango::WAttribute &attr,DynAttribute *src);
virtual void read_dynspec_attributes(Tango::Attribute &attr,DynSpectrumAttribute *src);
virtual void write_dynspec_attributes(Tango::WAttribute &attr,DynSpectrumAttribute *src);
virtual void read_dynimg_attributes(Tango::Attribute &attr,DynImageAttribute *src);
virtual void write_dynimg_attributes(Tango::WAttribute &attr,DynImageAttribute *src);
void split(vector<string> &tokens, const string &text, char sep);
void tolower(string &s);
int ToTangoType(string name,string type);
void addError(int devIndex,Tango::GroupAttrReply &reply);
Tango::WAttribute &getAtt(string name);
bool isNumber(std::string value);
void saveDisabledBLM();
bool isDisalbed(int idx);
/*----- PROTECTED REGION END -----*/ // AttributeCombiner::Data Members
// Device property data members
public:
// AttributeList: List of attribute (9 fields per line)
//
// Name;Attribute list;Type;IsRW;IsSpectrum;IsGrouped;Length;Expert
//
// Name: Attribute Name
// Attribute list: Attribute name list to combine (coma separated)
// Type: Type of Atttribute(s)
// IsRW: Read write flag
// IsSpectrum: true if attribute(s) is(are) a spectrum
// isGrouped: Group all attributes to a single one (scalar only)
// Length: Name of the `ALL` lenght attribute for combined spectrum, `None` otherwise
// Expert: Expert view (true or false)
// Alarm: Set alarm if value are not all equal (true or false) for grouped attribute
vector<string> attributeList;
// AttributeRefList: List of reference attribute
vector<string> attributeRefList;
// DeviceList: List of devices
vector<string> deviceList;
// Attribute data members
public:
Tango::DevString *attr_Errors_read;
// Constructors and destructors
public:
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
AttributeCombiner(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
AttributeCombiner(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
AttributeCombiner(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The device object destructor.
*/
~AttributeCombiner() {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 : AttributeCombiner::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
//--------------------------------------------------------
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Attribute Errors related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Spectrum max = 2048
*/
virtual void read_Errors(Tango::Attribute &attr);
virtual bool is_Errors_allowed(Tango::AttReqType type);
//--------------------------------------------------------
/**
* Method : AttributeCombiner::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
//--------------------------------------------------------
void add_dynamic_attributes();
// Command related methods
public:
/**
* Command ResetError related method
* Description: Reset Error stack
*
*/
virtual void reset_error();
virtual bool is_ResetError_allowed(const CORBA::Any &any);
/**
* Command UpdateSetpoint related method
* Description: Update local setpoints from device setpoints
*
*/
virtual void update_setpoint();
virtual bool is_UpdateSetpoint_allowed(const CORBA::Any &any);
/**
* Command EnableDevice related method
* Description: Enable device
*
* @param argin Enable device #i
*/
virtual void enable_device(Tango::DevShort argin);
virtual bool is_EnableDevice_allowed(const CORBA::Any &any);
/**
* Command DisableDevice related method
* Description: Disable device
*
* @param argin Disable device #i
*/
virtual void disable_device(Tango::DevShort argin);
virtual bool is_DisableDevice_allowed(const CORBA::Any &any);
//--------------------------------------------------------
/**
* Method : AttributeCombiner::add_dynamic_commands()
* Description : Add dynamic commands if any.
*/
//--------------------------------------------------------
void add_dynamic_commands();
/*----- PROTECTED REGION ID(AttributeCombiner::Additional Method prototypes) ENABLED START -----*/
// Additional Method prototypes
/*----- PROTECTED REGION END -----*/ // AttributeCombiner::Additional Method prototypes
};
/*----- PROTECTED REGION ID(AttributeCombiner::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes Definitions
/*----- PROTECTED REGION END -----*/ // AttributeCombiner::Additional Classes Definitions
} // End of namespace
#endif // AttributeCombiner_H
<?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">
<classes name="AttributeCombiner" pogoRevision="9.6">
<description description="A class to combine attributes coming from several devices" title="AttributeCombiner" sourcePath="/mntdirect/_segfs/tango/cppserver/calculcation/AttributeCombiner" language="Cpp" filestogenerate="XMI file,Code files,Makefile,CMakeLists,Protected Regions" license="GPL" copyright="Copyright (C): 2018&#xA; European Synchrotron Radiation Facility&#xA; BP 220, Grenoble 38043&#xA; France" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at esrf.fr - pons" author="pons" emailDomain="esrf.fr" classFamily="Calculation" siteSpecific="" platform="All Platforms" bus="Not Applicable" manufacturer="none" reference=""/>
</description>
<deviceProperties name="AttributeList" description="List of attribute (9 fields per line)&#xA;&#xA;Name;Attribute list;Type;IsRW;IsSpectrum;IsGrouped;Length;Expert&#xA;&#xA;Name: Attribute Name&#xA;Attribute list: Attribute name list to combine (coma separated)&#xA;Type: Type of Atttribute(s)&#xA;IsRW: Read write flag&#xA;IsSpectrum: true if attribute(s) is(are) a spectrum&#xA;isGrouped: Group all attributes to a single one (scalar only)&#xA;Length: Name of the `ALL` lenght attribute for combined spectrum, `None` otherwise&#xA;Expert: Expert view (true or false)&#xA;Alarm: Set alarm if value are not all equal (true or false) for grouped attribute">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="AttributeRefList" description="List of reference attribute">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<deviceProperties name="DeviceList" description="List of devices">
<type xsi:type="pogoDsl:StringVectorType"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</deviceProperties>
<commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device state">
<type xsi:type="pogoDsl:StateType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
<argin description="none">
<type xsi:type="pogoDsl:VoidType"/>
</argin>
<argout description="Device status">
<type xsi:type="pogoDsl:ConstStringType"/>
</argout>
<status abstract="true" inherited="true" concrete="true"/>
</commands>
<commands name="ResetError" description="Reset Error stack" execMethod="reset_error" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<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>
<commands name="UpdateSetpoint" description="Update local setpoints from device setpoints" execMethod="update_setpoint" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<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>
<commands name="EnableDevice" description="Enable device" execMethod="enable_device" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="Enable device #i">
<type xsi:type="pogoDsl:ShortType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<commands name="DisableDevice" description="Disable device" execMethod="disable_device" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false">
<argin description="Disable device #i">
<type xsi:type="pogoDsl:ShortType"/>
</argin>
<argout description="">
<type xsi:type="pogoDsl:VoidType"/>
</argout>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</commands>
<attributes name="Errors" attType="Spectrum" rwType="READ" displayLevel="OPERATOR" polledPeriod="0" maxX="2048" maxY="" allocReadMember="false" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<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>
<preferences docHome="./doc_html" makefileHome="/segfs/tango/cppserver/env"/>
<additionalFiles name="AttributeMap" path="/mntdirect/_segfs/tango/cppserver/calculcation/AttributeCombiner/AttributeMap.cpp"/>
</classes>
</pogoDsl:PogoSystem>
This diff is collapsed.
/*----- PROTECTED REGION ID(AttributeCombinerClass.h) ENABLED START -----*/
//=============================================================================
//
// file : AttributeCombinerClass.h
//
// description : Include for the AttributeCombiner root class.
// This class is the singleton class for
// the AttributeCombiner device class.
// It contains all properties and methods which the
// AttributeCombiner requires only once e.g. the commands.
//
// project : AttributeCombiner
//
// 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/>.
//
//
// Copyright (C): 2018
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// France
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef AttributeCombinerClass_H
#define AttributeCombinerClass_H
#include <tango.h>
#include <AttributeCombiner.h>
/*----- PROTECTED REGION END -----*/ // AttributeCombinerClass.h
namespace AttributeCombiner_ns
{
/*----- PROTECTED REGION ID(AttributeCombinerClass::classes for dynamic creation) ENABLED START -----*/
// Dynamic scalar attribute
class DynAttribute: public Tango::Attr {
public:
//-----------------------------------------------------------------------------
// Constructor
DynAttribute(const char *attName,long data_type,Tango::AttrWriteType rwType,bool expert)
:Attr(attName,data_type,rwType) {
Tango::DispLevel level = (expert)?Tango::DispLevel::EXPERT:Tango::DispLevel::OPERATOR;
set_disp_level(level);
};
~DynAttribute() {
};
//-----------------------------------------------------------------------------
// Write/Read mehod
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {
(static_cast<AttributeCombiner *>(dev))->read_dyn_attributes(att,this);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) {
(static_cast<AttributeCombiner *>(dev))->write_dyn_attributes(att,this);}
};
// Dynamic spectrum attribute
class DynSpectrumAttribute: public Tango::SpectrumAttr {
public:
//-----------------------------------------------------------------------------
// Constructor
DynSpectrumAttribute(const char *attName,long data_type,long max,Tango::AttrWriteType rwType,bool expert)
:SpectrumAttr(attName,data_type,rwType,max) {
Tango::DispLevel level = (expert)?Tango::DispLevel::EXPERT:Tango::DispLevel::OPERATOR;
set_disp_level(level);
};
~DynSpectrumAttribute() {
};
//-----------------------------------------------------------------------------
// Write/Read mehod
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {
(static_cast<AttributeCombiner *>(dev))->read_dynspec_attributes(att,this);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) {
(static_cast<AttributeCombiner *>(dev))->write_dynspec_attributes(att,this);}
};
// Dynamic image attribute
class DynImageAttribute: public Tango::ImageAttr {
public:
//-----------------------------------------------------------------------------
// Constructor
DynImageAttribute(const char *attName,long data_type,long maxx,long maxy,bool expert)
:ImageAttr(attName,data_type,maxx,maxy) {
Tango::DispLevel level = (expert)?Tango::DispLevel::EXPERT:Tango::DispLevel::OPERATOR;
set_disp_level(level);
};
~DynImageAttribute() {
};
//-----------------------------------------------------------------------------
// Write/Read mehod
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att) {
(static_cast<AttributeCombiner *>(dev))->read_dynimg_attributes(att,this);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att) {
(static_cast<AttributeCombiner *>(dev))->write_dynimg_attributes(att,this);}
};
/*----- PROTECTED REGION END -----*/ // AttributeCombinerClass::classes for dynamic creation
//=========================================
// Define classes for attributes
//=========================================
// Attribute Errors class definition
class ErrorsAttrib: public Tango::SpectrumAttr
{
public:
ErrorsAttrib():SpectrumAttr("Errors",
Tango::DEV_STRING, Tango::READ, 2048) {};
~ErrorsAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<AttributeCombiner *>(dev))->read_Errors(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<AttributeCombiner *>(dev))->is_Errors_allowed(ty);}
};
//=========================================
// Define classes for commands
//=========================================
// Command ResetError class definition
class ResetErrorClass : public Tango::Command
{
public:
ResetErrorClass(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) {};
ResetErrorClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ResetErrorClass() {};
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<AttributeCombiner *>(dev))->is_ResetError_allowed(any);}
};
// Command UpdateSetpoint class definition
class UpdateSetpointClass : public Tango::Command
{
public:
UpdateSetpointClass(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) {};
UpdateSetpointClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~UpdateSetpointClass() {};
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<AttributeCombiner *>(dev))->is_UpdateSetpoint_allowed(any);}
};
// Command EnableDevice class definition
class EnableDeviceClass : public Tango::Command
{
public:
EnableDeviceClass(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) {};
EnableDeviceClass(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~EnableDeviceClass() {};
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<AttributeCombiner *>(dev))->is_EnableDevice_allowed(any);}
};
// Command DisableDevice class definition
class DisableDeviceClass : public Tango::Command
{
public:
DisableDeviceClass(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) {};
DisableDeviceClass(const char *name,