Commit 6cb08d42 authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

Initial import

parent 899c6bc8
.nse_depinfo
bin
obj
# Eclipse
.cproject
.project
.settings
NAME_SRV = sfe-srv
CXXFLAGS =
LDFLAGS =
include ../makefiles/Make-9.3.3.in
/*----- PROTECTED REGION ID(SFE::ClassFactory.cpp) ENABLED START -----*/
//=============================================================================
//
// file : ClassFactory.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 : Scintillator FrontEnd
//
// 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. di interesse nazionale
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34149 Basovizza, Trieste ITALY
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <tango.h>
#include <SFEClass.h>
// Add class header files if needed
/**
* Create SFE Class singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
// Add method class init if needed
add_class(SFE_ns::SFEClass::init("SFE"));
}
/*----- PROTECTED REGION END -----*/ // SFE::ClassFactory.cpp
/*----- PROTECTED REGION ID(SFE.cpp) ENABLED START -----*/
//=============================================================================
//
// file : SFE.cpp
//
// description : C++ source for the SFE class and its commands.
// The class is derived from Device. It represents the
// CORBA servant object which will be accessed from the
// network. All commands which can be executed on the
// SFE are implemented in this file.
//
// project : Scintillator FrontEnd
//
// 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. di interesse nazionale
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34149 Basovizza, Trieste ITALY
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#include <SFE.h>
#include <SFEClass.h>
/*----- PROTECTED REGION END -----*/ // SFE.cpp
/**
* SFE class description:
*
*/
//================================================================
// The following table gives the correspondence
// between command and method names.
//
// Command name | Method name
//================================================================
// State | Inherited (no method)
// Status | Inherited (no method)
//================================================================
//================================================================
// Attributes managed are:
//================================================================
// PMTvoltage | Tango::DevDouble Scalar
// Temperature | Tango::DevDouble Scalar
//================================================================
namespace SFE_ns
{
/*----- PROTECTED REGION ID(SFE::namespace_starting) ENABLED START -----*/
// static initializations
/*----- PROTECTED REGION END -----*/ // SFE::namespace_starting
//--------------------------------------------------------
/**
* Method : SFE::SFE()
* Description : Constructors for a Tango device
* implementing the classSFE
*/
//--------------------------------------------------------
SFE::SFE(Tango::DeviceClass *cl, string &s)
: TANGO_BASE_CLASS(cl, s.c_str())
{
/*----- PROTECTED REGION ID(SFE::constructor_1) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // SFE::constructor_1
}
//--------------------------------------------------------
SFE::SFE(Tango::DeviceClass *cl, const char *s)
: TANGO_BASE_CLASS(cl, s)
{
/*----- PROTECTED REGION ID(SFE::constructor_2) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // SFE::constructor_2
}
//--------------------------------------------------------
SFE::SFE(Tango::DeviceClass *cl, const char *s, const char *d)
: TANGO_BASE_CLASS(cl, s, d)
{
/*----- PROTECTED REGION ID(SFE::constructor_3) ENABLED START -----*/
init_device();
/*----- PROTECTED REGION END -----*/ // SFE::constructor_3
}
//--------------------------------------------------------
/**
* Method : SFE::delete_device()
* Description : will be called at device destruction or at init command
*/
//--------------------------------------------------------
void SFE::delete_device()
{
DEBUG_STREAM << "SFE::delete_device() " << device_name << endl;
/*----- PROTECTED REGION ID(SFE::delete_device) ENABLED START -----*/
// Delete device allocated objects
/*----- PROTECTED REGION END -----*/ // SFE::delete_device
delete[] attr_PMTvoltage_read;
delete[] attr_Temperature_read;
}
//--------------------------------------------------------
/**
* Method : SFE::init_device()
* Description : will be called at device initialization.
*/
//--------------------------------------------------------
void SFE::init_device()
{
DEBUG_STREAM << "SFE::init_device() create device " << device_name << endl;
/*----- PROTECTED REGION ID(SFE::init_device_before) ENABLED START -----*/
// Initialization before get_device_property() call
/*----- PROTECTED REGION END -----*/ // SFE::init_device_before
// Get the device properties from database
get_device_property();
attr_PMTvoltage_read = new Tango::DevDouble[1];
attr_Temperature_read = new Tango::DevDouble[1];
/*----- PROTECTED REGION ID(SFE::init_device) ENABLED START -----*/
// Initialize device
/*----- PROTECTED REGION END -----*/ // SFE::init_device
}
//--------------------------------------------------------
/**
* Method : SFE::get_device_property()
* Description : Read database to initialize property data members.
*/
//--------------------------------------------------------
void SFE::get_device_property()
{
/*----- PROTECTED REGION ID(SFE::get_device_property_before) ENABLED START -----*/
// Initialize property data members
/*----- PROTECTED REGION END -----*/ // SFE::get_device_property_before
// Read device properties from database.
Tango::DbData dev_prop;
dev_prop.push_back(Tango::DbDatum("Device"));
// is there at least one property to be read ?
if (dev_prop.size()>0)
{
// Call database and extract values
if (Tango::Util::instance()->_UseDb==true)
get_db_device()->get_property(dev_prop);
// get instance on SFEClass to get class property
Tango::DbDatum def_prop, cl_prop;
SFEClass *ds_class =
(static_cast<SFEClass *>(get_device_class()));
int i = -1;
// Try to initialize Device from class property
cl_prop = ds_class->get_class_property(dev_prop[++i].name);
if (cl_prop.is_empty()==false) cl_prop >> device;
else {
// Try to initialize Device from default device value
def_prop = ds_class->get_default_device_property(dev_prop[i].name);
if (def_prop.is_empty()==false) def_prop >> device;
}
// And try to extract Device value from database
if (dev_prop[i].is_empty()==false) dev_prop[i] >> device;
}
/*----- PROTECTED REGION ID(SFE::get_device_property_after) ENABLED START -----*/
// Check device property data members init
/*----- PROTECTED REGION END -----*/ // SFE::get_device_property_after
}
//--------------------------------------------------------
/**
* Method : SFE::always_executed_hook()
* Description : method always executed before any command is executed
*/
//--------------------------------------------------------
void SFE::always_executed_hook()
{
DEBUG_STREAM << "SFE::always_executed_hook() " << device_name << endl;
/*----- PROTECTED REGION ID(SFE::always_executed_hook) ENABLED START -----*/
// code always executed before all requests
/*----- PROTECTED REGION END -----*/ // SFE::always_executed_hook
}
//--------------------------------------------------------
/**
* Method : SFE::read_attr_hardware()
* Description : Hardware acquisition for attributes
*/
//--------------------------------------------------------
void SFE::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
DEBUG_STREAM << "SFE::read_attr_hardware(vector<long> &attr_list) entering... " << endl;
/*----- PROTECTED REGION ID(SFE::read_attr_hardware) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // SFE::read_attr_hardware
}
//--------------------------------------------------------
/**
* Method : SFE::write_attr_hardware()
* Description : Hardware writing for attributes
*/
//--------------------------------------------------------
void SFE::write_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
DEBUG_STREAM << "SFE::write_attr_hardware(vector<long> &attr_list) entering... " << endl;
/*----- PROTECTED REGION ID(SFE::write_attr_hardware) ENABLED START -----*/
// Add your own code
/*----- PROTECTED REGION END -----*/ // SFE::write_attr_hardware
}
//--------------------------------------------------------
/**
* Read attribute PMTvoltage related method
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
//--------------------------------------------------------
void SFE::read_PMTvoltage(Tango::Attribute &attr)
{
DEBUG_STREAM << "SFE::read_PMTvoltage(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(SFE::read_PMTvoltage) ENABLED START -----*/
// Set the attribute value
attr.set_value(attr_PMTvoltage_read);
/*----- PROTECTED REGION END -----*/ // SFE::read_PMTvoltage
}
//--------------------------------------------------------
/**
* Write attribute PMTvoltage related method
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
//--------------------------------------------------------
void SFE::write_PMTvoltage(Tango::WAttribute &attr)
{
DEBUG_STREAM << "SFE::write_PMTvoltage(Tango::WAttribute &attr) entering... " << endl;
// Retrieve write value
Tango::DevDouble w_val;
attr.get_write_value(w_val);
/*----- PROTECTED REGION ID(SFE::write_PMTvoltage) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // SFE::write_PMTvoltage
}
//--------------------------------------------------------
/**
* Read attribute Temperature related method
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
//--------------------------------------------------------
void SFE::read_Temperature(Tango::Attribute &attr)
{
DEBUG_STREAM << "SFE::read_Temperature(Tango::Attribute &attr) entering... " << endl;
/*----- PROTECTED REGION ID(SFE::read_Temperature) ENABLED START -----*/
// Set the attribute value
attr.set_value(attr_Temperature_read);
/*----- PROTECTED REGION END -----*/ // SFE::read_Temperature
}
//--------------------------------------------------------
/**
* Method : SFE::add_dynamic_attributes()
* Description : Create the dynamic attributes if any
* for specified device.
*/
//--------------------------------------------------------
void SFE::add_dynamic_attributes()
{
/*----- PROTECTED REGION ID(SFE::add_dynamic_attributes) ENABLED START -----*/
// Add your own code to create and add dynamic attributes if any
/*----- PROTECTED REGION END -----*/ // SFE::add_dynamic_attributes
}
//--------------------------------------------------------
/**
* Method : SFE::add_dynamic_commands()
* Description : Create the dynamic commands if any
* for specified device.
*/
//--------------------------------------------------------
void SFE::add_dynamic_commands()
{
/*----- PROTECTED REGION ID(SFE::add_dynamic_commands) ENABLED START -----*/
// Add your own code to create and add dynamic commands if any
/*----- PROTECTED REGION END -----*/ // SFE::add_dynamic_commands
}
/*----- PROTECTED REGION ID(SFE::namespace_ending) ENABLED START -----*/
// Additional Methods
/*----- PROTECTED REGION END -----*/ // SFE::namespace_ending
} // namespace
/*----- PROTECTED REGION ID(SFE.h) ENABLED START -----*/
//=============================================================================
//
// file : SFE.h
//
// description : Include file for the SFE class
//
// project : Scintillator FrontEnd
//
// 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. di interesse nazionale
// Strada Statale 14 - km 163,5 in AREA Science Park
// 34149 Basovizza, Trieste ITALY
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef SFE_H
#define SFE_H
#include <tango.h>
/*----- PROTECTED REGION END -----*/ // SFE.h
/**
* SFE class description:
*
*/
namespace SFE_ns
{
/*----- PROTECTED REGION ID(SFE::Additional Class Declarations) ENABLED START -----*/
// Additional Class Declarations
/*----- PROTECTED REGION END -----*/ // SFE::Additional Class Declarations
class SFE : public TANGO_BASE_CLASS
{
/*----- PROTECTED REGION ID(SFE::Data Members) ENABLED START -----*/
// Add your own data members
/*----- PROTECTED REGION END -----*/ // SFE::Data Members
// Device property data members
public:
// Device: Socket device name
string device;
// Attribute data members
public:
Tango::DevDouble *attr_PMTvoltage_read;
Tango::DevDouble *attr_Temperature_read;
// Constructors and destructors
public:
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
SFE(Tango::DeviceClass *cl,string &s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
SFE(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
SFE(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The device object destructor.
*/
~SFE() {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 : SFE::read_attr_hardware()
* Description : Hardware acquisition for attributes.
*/
//--------------------------------------------------------
virtual void read_attr_hardware(vector<long> &attr_list);
//--------------------------------------------------------
/*
* Method : SFE::write_attr_hardware()
* Description : Hardware writing for attributes.
*/
//--------------------------------------------------------
virtual void write_attr_hardware(vector<long> &attr_list);
/**
* Attribute PMTvoltage related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_PMTvoltage(Tango::Attribute &attr);
virtual void write_PMTvoltage(Tango::WAttribute &attr);
virtual bool is_PMTvoltage_allowed(Tango::AttReqType type);
/**
* Attribute Temperature related methods
* Description:
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_Temperature(Tango::Attribute &attr);
virtual bool is_Temperature_allowed(Tango::AttReqType type);
//--------------------------------------------------------
/**
* Method : SFE::add_dynamic_attributes()
* Description : Add dynamic attributes if any.
*/
//--------------------------------------------------------
void add_dynamic_attributes();
// Command related methods
public:
//--------------------------------------------------------
/**
* Method : SFE::add_dynamic_commands()
* Description : Add dynamic commands if any.
*/
//--------------------------------------------------------
void add_dynamic_commands();
/*----- PROTECTED REGION ID(SFE::Additional Method prototypes) ENABLED START -----*/
// Additional Method prototypes
/*----- PROTECTED REGION END -----*/ // SFE::Additional Method prototypes
};
/*----- PROTECTED REGION ID(SFE::Additional Classes Definitions) ENABLED START -----*/
// Additional Classes Definitions
/*----- PROTECTED REGION END -----*/ // SFE::Additional Classes Definitions
} // End of namespace
#endif // SFE_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="SFE" pogoRevision="9.6">
<description description="" title="Scintillator FrontEnd" sourcePath="/home/graziano/ws/sfe/src" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale&#xA;Strada Statale 14 - km 163,5 in AREA Science Park&#xA;34149 Basovizza, Trieste ITALY" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false">
<inheritances classname="Device_Impl" sourcePath=""/>
<identification contact="at elettra.eu - graziano.scalamera" author="graziano.scalamera" emailDomain="elettra.eu" classFamily="BeamDiagnostics" siteSpecific="" platform="Unix Like" bus="Ethernet" manufacturer="none" reference=""/>
</description>
<deviceProperties name="Device" description="Socket device name">
<type xsi:type="pogoDsl:StringType"/>
<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"/>