Skip to content
Snippets Groups Projects
E2CorrectorClass.h 10.07 KiB
/*----- PROTECTED REGION ID(E2CorrectorClass.h) ENABLED START -----*/
/* clang-format on */
//=============================================================================
//
// file :        E2CorrectorClass.h
//
// description : Include for the E2Corrector root class.
//               This class is the singleton class for
//                the E2Corrector device class.
//               It contains all properties and methods which the
//               E2Corrector requires only once e.g. the commands.
//
// project :     Elettra 2.0 pure corrector magnet device
//
// 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/>.
//
//
// Elettra - Sincrotrone Trieste S.c.p.A.
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#ifndef E2CorrectorClass_H
#define E2CorrectorClass_H

#include <tango/tango.h>
#include "E2Corrector.h"

/* clang-format off */
/*----- PROTECTED REGION END -----*/	//	E2CorrectorClass.h


namespace E2Corrector_ns
{
/*----- PROTECTED REGION ID(E2CorrectorClass::classes for dynamic creation) ENABLED START -----*/
/* clang-format on */

/* clang-format off */
/*----- PROTECTED REGION END -----*/	//	E2CorrectorClass::classes for dynamic creation

//=========================================
//	Define classes for attributes
//=========================================
//	Attribute Strength class definition
class StrengthAttrib: public Tango::Attr
{
public:
	StrengthAttrib():Attr("Strength",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~StrengthAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_Strength(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_Strength(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_Strength_allowed(ty);}
};

//	Attribute CorrectionStrength class definition
class CorrectionStrengthAttrib: public Tango::Attr
{
public:
	CorrectionStrengthAttrib():Attr("CorrectionStrength",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~CorrectionStrengthAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_CorrectionStrength(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_CorrectionStrength(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_CorrectionStrength_allowed(ty);}
};

//	Attribute ResonanceStrength class definition
class ResonanceStrengthAttrib: public Tango::Attr
{
public:
	ResonanceStrengthAttrib():Attr("ResonanceStrength",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~ResonanceStrengthAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_ResonanceStrength(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_ResonanceStrength(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_ResonanceStrength_allowed(ty);}
};

//	Attribute Current class definition
class CurrentAttrib: public Tango::Attr
{
public:
	CurrentAttrib():Attr("Current",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~CurrentAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_Current(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_Current(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_Current_allowed(ty);}
};

//	Attribute BeamEnergy class definition
class BeamEnergyAttrib: public Tango::Attr
{
public:
	BeamEnergyAttrib():Attr("BeamEnergy",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~BeamEnergyAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_BeamEnergy(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_BeamEnergy(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_BeamEnergy_allowed(ty);}
};

//	Attribute DesignStrength class definition
class DesignStrengthAttrib: public Tango::Attr
{
public:
	DesignStrengthAttrib():Attr("DesignStrength",
			Tango::DEV_DOUBLE, Tango::READ_WRITE) {}
	~DesignStrengthAttrib() {}
	virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
		{(static_cast<E2Corrector *>(dev))->read_DesignStrength(att);}
	virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
		{(static_cast<E2Corrector *>(dev))->write_DesignStrength(att);}
	virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
		{return (static_cast<E2Corrector *>(dev))->is_DesignStrength_allowed(ty);}
};


//=========================================
//	Define classes for commands
//=========================================
//	Command Reset class definition
class ResetClass : public Tango::Command
{
public:
	ResetClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out,
				   const char        *in_desc,
				   const char        *out_desc,
				   Tango::DispLevel  level)
	:Command(cmd_name,in,out,in_desc,out_desc, level)	{}

	ResetClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out)
	:Command(cmd_name,in,out)	{}
	~ResetClass() {}

	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<E2Corrector *>(dev))->is_Reset_allowed(any);}
};

//	Command ResetResonanceStrength class definition
class ResetResonanceStrengthClass : public Tango::Command
{
public:
	ResetResonanceStrengthClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out,
				   const char        *in_desc,
				   const char        *out_desc,
				   Tango::DispLevel  level)
	:Command(cmd_name,in,out,in_desc,out_desc, level)	{}

	ResetResonanceStrengthClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out)
	:Command(cmd_name,in,out)	{}
	~ResetResonanceStrengthClass() {}

	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<E2Corrector *>(dev))->is_ResetResonanceStrength_allowed(any);}
};

//	Command ApplyDesignStrength class definition
class ApplyDesignStrengthClass : public Tango::Command
{
public:
	ApplyDesignStrengthClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out,
				   const char        *in_desc,
				   const char        *out_desc,
				   Tango::DispLevel  level)
	:Command(cmd_name,in,out,in_desc,out_desc, level)	{}

	ApplyDesignStrengthClass(const char   *cmd_name,
	               Tango::CmdArgType in,
				   Tango::CmdArgType out)
	:Command(cmd_name,in,out)	{}
	~ApplyDesignStrengthClass() {}

	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<E2Corrector *>(dev))->is_ApplyDesignStrength_allowed(any);}
};


/**
 *	The E2CorrectorClass singleton definition
 */

#ifdef _TG_WINDOWS_
class __declspec(dllexport)  E2CorrectorClass : public Tango::DeviceClass
#else
class E2CorrectorClass : public Tango::DeviceClass
#endif
{
	/*----- PROTECTED REGION ID(E2CorrectorClass::Additional DServer data members) ENABLED START -----*/
	/* clang-format on */
	//	Add your own code
	/* clang-format off */
	/*----- PROTECTED REGION END -----*/	//	E2CorrectorClass::Additional DServer data members

	public:
		//	Class properties data members
		//	BeamEnergy:	default electron beam energy, in GeV.
		//  Use to initialize all magnet istances BeamEnergy attribute.
		Tango::DevDouble	beamEnergy;
		//	CalibrationPath:	path of calibration and parameter files
		std::string	calibrationPath;
		//	write class properties data members
		Tango::DbData	cl_prop;
		Tango::DbData	cl_def_prop;
		Tango::DbData	dev_def_prop;
		//	Method prototypes
		static E2CorrectorClass *init(const char *);
		static E2CorrectorClass *instance();
		~E2CorrectorClass();
		Tango::DbDatum	get_class_property(std::string &);
		Tango::DbDatum	get_default_device_property(std::string &);
		Tango::DbDatum	get_default_class_property(std::string &);

	protected:
		E2CorrectorClass(std::string &);
		static E2CorrectorClass *_instance;
		void command_factory();
		void attribute_factory(std::vector<Tango::Attr *> &);
		void pipe_factory();
		void write_class_property();
		void set_default_property();
		void get_class_property();
		std::string get_cvstag();
		std::string get_cvsroot();

	private:
		void device_factory(TANGO_UNUSED(const Tango::DevVarStringArray *));
		void create_static_attribute_list(std::vector<Tango::Attr *> &);
		void erase_dynamic_attributes(const Tango::DevVarStringArray *,std::vector<Tango::Attr *> &);
		std::vector<std::string>	defaultAttList;
		Tango::Attr *get_attr_object_by_name(std::vector<Tango::Attr *> &att_list, std::string attname);
};

}	//	End of namespace
#endif   //	E2Corrector_H