Skip to content
Snippets Groups Projects
Commit bcb8cdfc authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Add VG Class

parent 2baca71f
Branches master
Tags 1.0.2
No related merge requests found
[submodule "deps/vg"]
path = deps/vg
url = https://gitlab.elettra.eu/cs/ds/vg.git
Subproject commit 889596b9c313ed2acdad64a064f37e3a5fd41d6f
/*----- PROTECTED REGION ID(Tpg300::ClassFactory.cpp) ENABLED START -----*/
static const char *RcsId = "$Id: ClassFactory.cpp,v 1.4 2012-09-10 08:01:04 mdm Exp $";
//=============================================================================
//
// file : ClassFactory.cpp
// file : MultiClassessFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible for the creation of
// all class singleton for a device server. It is called
// at device server startup.
//
// project : Blzer Tpg 300.
//
// $Author: mdm $
//
// $Revision: 1.4 $
// $Date: 2012-09-10 08:01:04 $
// This file is part of Tango device class.
//
// SVN only:
// $HeadURL: $
// 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/>.
//
// CVS only:
// $Source: /home/cvsadm/cvsroot/fermi/servers/tpg300/src/ClassFactory.cpp,v $
// $Log: ClassFactory.cpp,v $
// Revision 1.4 2012-09-10 08:01:04 mdm
// Bugfix in thread and on off commands
//
//
//=============================================================================
......@@ -31,22 +31,16 @@ static const char *RcsId = "$Id: ClassFactory.cpp,v 1.4 2012-09-10 08:01:04 mdm
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <Tpg300Class.h>
// Add class header files if needed
#include <VgClass.h>
/**
* Create Tpg300 Class singleton and store it in DServer object.
* Create Class singletons and store them in DServer object.
*/
void Tango::DServer::class_factory()
{
// Add method class init if needed
add_class(Tpg300_ns::Tpg300Class::init("Tpg300"));
add_class(Vg_ns::VgClass::init("Vg"));
}
/*----- PROTECTED REGION END -----*/
This diff is collapsed.
......@@ -40,17 +40,27 @@
#include <tango.h>
/*----- PROTECTED REGION END -----*/
/*----- PROTECTED REGION END -----*/ // Tpg300.h
#ifdef TANGO_LOG
// cppTango after c934adea (Merge branch 'remove-cout-definition' into 'main', 2022-05-23)
// nothing to do
#else
// cppTango 9.3-backports and older
#define TANGO_LOG cout
#define TANGO_LOG_INFO cout2
#define TANGO_LOG_DEBUG cout3
#endif // TANGO_LOG
/**
* Tpg300 class Description:
* Total pressure gauge and controller
* Tpg300 class description:
* Total pressure gauge and controller
*/
namespace Tpg300_ns
{
/*----- PROTECTED REGION ID(Tpg300::Additional Class Declarations) ENABLED START -----*/
/*----- PROTECTED REGION ID(Tpg300::Additional Class Declarations) ENABLED START -----*/
class Tpg300Proxy;
class Tpg300Channel;
......@@ -60,13 +70,10 @@ class Tpg300Thread;
/*----- PROTECTED REGION END -----*/ // Tpg300::Additional Class Declarations
class Tpg300 : public TANGO_BASE_CLASS
{
/*----- PROTECTED REGION ID(Tpg300::Data Members) ENABLED START -----*/
/*----- PROTECTED REGION ID(Tpg300::Data Members) ENABLED START -----*/
omni_mutex* stop_mutex;
omni_condition* stop_condition;
......@@ -88,17 +95,16 @@ class Tpg300 : public TANGO_BASE_CLASS
/*----- PROTECTED REGION END -----*/ // Tpg300::Data Members
// Device property data members
public: // SerialDevice:
string serialDevice;
public:
// SerialDevice:
std::string serialDevice;
// Timeout: Milliseconds
Tango::DevULong timeout;
// ThreadSleep: Millisecond
Tango::DevULong threadSleep;
// ProxySleep: Millisecond
Tango::DevULong proxySleep;
// Attribute data members
public:
......@@ -122,26 +128,24 @@ public:
Tango::DevString *attr_DeviceStatus_read;
Tango::DevBoolean *attr_SetPointStatus_read;
// Constructors and destructors
public:
/**
* Constructs a newly allocated Command object.
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
Tpg300(Tango::DeviceClass *cl,string &s);
Tpg300(Tango::DeviceClass *cl,std::string &s);
/**
* Constructs a newly allocated Command object.
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
Tpg300(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly allocated Command object.
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device name
......@@ -149,27 +153,26 @@ public:
*/
Tpg300(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The object destructor.
*/
~Tpg300() {delete_device();};
* The device object destructor.
*/
~Tpg300();
// 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();
/**
void get_device_property();
/*
* Always executed method before execution command method.
*/
virtual void always_executed_hook();
......@@ -177,330 +180,393 @@ public:
// Attribute methods
public:
/**
* Method : Tpg300::read_attr_hardware()
* Description : Hardware acquisition for attributes.
//--------------------------------------------------------
/*
* Method : Tpg300::read_attr_hardware()
* Description: Hardware acquisition for attributes.
*/
virtual void read_attr_hardware(vector<long> &attr_list);
/**
* Pressure_0 attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
//--------------------------------------------------------
virtual void read_attr_hardware(std::vector<long> &attr_list);
//--------------------------------------------------------
/*
* Method : Tpg300::write_attr_hardware()
* Description: Hardware writing for attributes.
*/
//--------------------------------------------------------
virtual void write_attr_hardware(std::vector<long> &attr_list);
/**
* Attribute Pressure_0 related methods
*
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Pressure_0(Tango::Attribute &attr);
virtual bool is_Pressure_0_allowed(Tango::AttReqType type);
/**
* Pressure_1 attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
/**
* Attribute Pressure_1 related methods
*
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Pressure_1(Tango::Attribute &attr);
virtual bool is_Pressure_1_allowed(Tango::AttReqType type);
/**
* Pressure_2 attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
/**
* Attribute Pressure_2 related methods
*
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Pressure_2(Tango::Attribute &attr);
virtual bool is_Pressure_2_allowed(Tango::AttReqType type);
/**
* Pressure_3 attribute related methods.
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
/**
* Attribute Pressure_3 related methods
*
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Pressure_3(Tango::Attribute &attr);
virtual bool is_Pressure_3_allowed(Tango::AttReqType type);
/**
* State_0 attribute related methods.
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
/**
* Attribute State_0 related methods
*
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_State_0(Tango::Attribute &attr);
virtual bool is_State_0_allowed(Tango::AttReqType type);
/**
* State_1 attribute related methods.
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
/**
* Attribute State_1 related methods
*
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_State_1(Tango::Attribute &attr);
virtual bool is_State_1_allowed(Tango::AttReqType type);
/**
* State_2 attribute related methods.
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
/**
* Attribute State_2 related methods
*
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_State_2(Tango::Attribute &attr);
virtual bool is_State_2_allowed(Tango::AttReqType type);
/**
* State_3 attribute related methods.
* Description:
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
/**
* Attribute State_3 related methods
*
*
* Data type: Tango::DevState
* Attr type: Scalar
*/
virtual void read_State_3(Tango::Attribute &attr);
virtual bool is_State_3_allowed(Tango::AttReqType type);
/**
* Status_0 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Status_0 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Status_0(Tango::Attribute &attr);
virtual bool is_Status_0_allowed(Tango::AttReqType type);
/**
* Status_1 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Status_1 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Status_1(Tango::Attribute &attr);
virtual bool is_Status_1_allowed(Tango::AttReqType type);
/**
* Status_2 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Status_2 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Status_2(Tango::Attribute &attr);
virtual bool is_Status_2_allowed(Tango::AttReqType type);
/**
* Status_3 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Status_3 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Status_3(Tango::Attribute &attr);
virtual bool is_Status_3_allowed(Tango::AttReqType type);
/**
* Name_0 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Name_0 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Name_0(Tango::Attribute &attr);
virtual bool is_Name_0_allowed(Tango::AttReqType type);
/**
* Name_1 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Name_1 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Name_1(Tango::Attribute &attr);
virtual bool is_Name_1_allowed(Tango::AttReqType type);
/**
* Name_2 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Name_2 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Name_2(Tango::Attribute &attr);
virtual bool is_Name_2_allowed(Tango::AttReqType type);
/**
* Name_3 attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute Name_3 related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_Name_3(Tango::Attribute &attr);
virtual bool is_Name_3_allowed(Tango::AttReqType type);
/**
* DeviceState attribute related methods.
* Description:
*
* Data type: Tango::DevUChar
* Attr type: Scalar
*/
/**
* Attribute DeviceState related methods
*
*
* Data type: Tango::DevUChar
* Attr type: Scalar
*/
virtual void read_DeviceState(Tango::Attribute &attr);
virtual void write_DeviceState(Tango::WAttribute &attr);
virtual bool is_DeviceState_allowed(Tango::AttReqType type);
/**
* DeviceStatus attribute related methods.
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
/**
* Attribute DeviceStatus related methods
*
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_DeviceStatus(Tango::Attribute &attr);
virtual bool is_DeviceStatus_allowed(Tango::AttReqType type);
/**
* SetPointStatus attribute related methods.
* Description:
*
* Data type: Tango::DevBoolean
* Attr type: Spectrum max = 6
*/
/**
* Attribute SetPointStatus related methods
*
*
* Data type: Tango::DevBoolean
* Attr type: Spectrum max = 6
*/
virtual void read_SetPointStatus(Tango::Attribute &attr);
virtual bool is_SetPointStatus_allowed(Tango::AttReqType type);
//--------------------------------------------------------
/**
* Method : Tpg300::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
* Method : Tpg300::add_dynamic_attributes()
* Description: Add dynamic attributes if any.
*/
void add_dynamic_attributes();
//--------------------------------------------------------
void add_dynamic_attributes();
// Command related methods
public:
// Command related methods
public:
/**
* Command SensorOn related methods.
* Command SensorOn related method
* Description: Start measuring channel n
*
* @param argin Channel
* [0,3]
*/
void sensor_on(Tango::DevShort argin);
virtual void sensor_on(Tango::DevShort argin);
virtual bool is_SensorOn_allowed(const CORBA::Any &any);
/**
* Command SensorOff related methods.
* Command SensorOff related method
* Description: Stop measuring channel n
*
* @param argin Channel
* [0,3]
*/
void sensor_off(Tango::DevShort argin);
virtual void sensor_off(Tango::DevShort argin);
virtual bool is_SensorOff_allowed(const CORBA::Any &any);
/**
* Command WriteLowerThreshold related methods.
*/
void write_lower_threshold(const Tango::DevVarDoubleArray *argin);
* Command WriteLowerThreshold related method
* Description: Set setpoint lower threshold
*
* @param argin Setpoint, Pressure
*
* Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
*
* Pressure
* [1.0E-11, 9.9E+3]
*/
virtual void write_lower_threshold(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteLowerThreshold_allowed(const CORBA::Any &any);
/**
* Command ReadLowerThreshold related methods.
*/
Tango::DevDouble read_lower_threshold(Tango::DevShort argin);
* Command ReadLowerThreshold related method
* Description: Get setpoint lower threshold
*
* @param argin Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
* @returns Pressure
*/
virtual Tango::DevDouble read_lower_threshold(Tango::DevShort argin);
virtual bool is_ReadLowerThreshold_allowed(const CORBA::Any &any);
/**
* Command WriteUpperThreshold related methods.
*/
void write_upper_threshold(const Tango::DevVarDoubleArray *argin);
* Command WriteUpperThreshold related method
* Description: Set setpoint upper threshold
*
* @param argin Setpoint, Pressure
*
* Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
*
* Pressure
* [1.0E-11, 9.9E+3]
*/
virtual void write_upper_threshold(const Tango::DevVarDoubleArray *argin);
virtual bool is_WriteUpperThreshold_allowed(const CORBA::Any &any);
/**
* Command ReadUpperThreshold related methods.
*/
Tango::DevDouble read_upper_threshold(Tango::DevShort argin);
* Command ReadUpperThreshold related method
* Description: Get setpoint upper threshold
*
* @param argin Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
* @returns Pressure
*/
virtual Tango::DevDouble read_upper_threshold(Tango::DevShort argin);
virtual bool is_ReadUpperThreshold_allowed(const CORBA::Any &any);
/**
* Command ReadSensorSource related methods.
*/
Tango::DevShort read_sensor_source(Tango::DevShort argin);
* Command ReadSensorSource related method
* Description: Get setpoint source
*
* @param argin Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
* @returns Source
* 0 -> No assignment
* 1 -> Measuring circuit A1
* 2 -> Measuring circuit A2
* 3 -> Measuring circuit B1
* 4 -> Measuring circuit B2
* 5 -> Measuring circuit A1 (for self monitoring)
* 6 -> Measuring circuit A2 (for self monitoring)
* 7 -> Measuring circuit B1 (for self monitoring)
* 8 -> Measuring circuit B2 (for self monitoring)
*/
virtual Tango::DevShort read_sensor_source(Tango::DevShort argin);
virtual bool is_ReadSensorSource_allowed(const CORBA::Any &any);
/**
* Command WriteSensorSource related methods.
*/
void write_sensor_source(const Tango::DevVarShortArray *argin);
* Command WriteSensorSource related method
* Description: Set setpoint switching function
*
* @param argin Setpoint, Source
*
* Setpoint
* 0 -> Switching function 1
* 1 -> Switching function 2
* 2 -> Switching function 3
* 3 -> Switching function 4
* 4 -> Switching function A
* 5 -> Switching function B
*
* Source:
* 0 -> No assignment
* 1 -> Measuring circuit A1
* 2 -> Measuring circuit A2
* 3 -> Measuring circuit B1
* 4 -> Measuring circuit B2
* 5 -> Measuring circuit A1 (for self monitoring)
* 6 -> Measuring circuit A2 (for self monitoring)
* 7 -> Measuring circuit B1 (for self monitoring)
* 8 -> Measuring circuit B2 (for self monitoring)
*/
virtual void write_sensor_source(const Tango::DevVarShortArray *argin);
virtual bool is_WriteSensorSource_allowed(const CORBA::Any &any);
/**
* Command RegisterName related methods.
*/
void register_name(const Tango::DevVarLongStringArray *argin);
* Command RegisterName related method
* Description: Set channel name
*
* @param argin Channel, Name
*
* Channel
* [0,3]
*
* Name
* max 64 characters
*/
virtual void register_name(const Tango::DevVarLongStringArray *argin);
virtual bool is_RegisterName_allowed(const CORBA::Any &any);
/**
* Command UnregisterName related methods.
* Command UnregisterName related method
* Description: Unregister channel name
*
* @param argin Channel
* [0,3]
*/
void unregister_name(Tango::DevShort argin);
virtual void unregister_name(Tango::DevShort argin);
virtual bool is_UnregisterName_allowed(const CORBA::Any &any);
//--------------------------------------------------------
/**
* Method : Tpg300::add_dynamic_commands()
* Description: Add dynamic commands if any.
*/
//--------------------------------------------------------
void add_dynamic_commands();
/*----- PROTECTED REGION ID(Tpg300::Additional Method prototypes) ENABLED START -----*/
/*----- PROTECTED REGION ID(Tpg300::Additional Method prototypes) ENABLED START -----*/
void update_state();
void update_status();
/*----- PROTECTED REGION END -----*/ // Tpg300::Additional Method prototypes
};
/*----- PROTECTED REGION ID(Tpg300::Additional Classes Definitions) ENABLED START -----*/
/*----- PROTECTED REGION ID(Tpg300::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes definitions
/*----- PROTECTED REGION END -----*/ // Tpg300::Additional Classes Definitions
} // namespace
} // End of namespace
#endif // TPG300_H
#endif // Tpg300_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -53,7 +53,7 @@ int main(int argc,char *argv[])
cout << "Ready to accept request" << endl;
tg->server_run();
}
catch (bad_alloc)
catch (std::bad_alloc &)
{
cout << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl;
......@@ -69,5 +69,4 @@ int main(int argc,char *argv[])
tg->server_cleanup();
return(0);
}
/*PROTECTED REGION END*/
//========================================================
/*PROTECTED REGION END*/ // Tpg300::main.cpp
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
<multiClasses pogoRevision="9.7" name="tpg300" sourcePath="/home/alessio/Sources/git-trees/tpg300/src" description="" filestogenerate="XMI file,Code files,Protected Regions">
<classes classname="Tpg300" sourcePath="./">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
<classes classname="Vg" sourcePath="../deps/vg/src">
<inheritances classname="Device_Impl" sourcePath=""/>
</classes>
<preferences makefileHome="$(TANGO_HOME)"/>
</multiClasses>
</pogoDsl:PogoSystem>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment