Skip to content
Snippets Groups Projects
Commit b966264a authored by Sonia Minolli's avatar Sonia Minolli
Browse files

delete .old files

parent 6668d98a
Branches
Tags
No related merge requests found
static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Vacuum/CryoCooler/src/HeaterVesselClass.cpp.old,v 1.1 2009-03-09 17:16:18 stephle Exp $";
static const char *TagName = "$Name: not supported by cvs2svn $";
static const char *HttpServer= "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/";
//+=============================================================================
//
// file : HeaterVesselClass.cpp
//
// description : C++ source for the HeaterVesselClass. A singleton
// class derived from DeviceClass. It implements the
// command list and all properties and methods required
// by the HeaterVessel once per process.
//
// project : TANGO Device Server
//
// $Author: stephle $
//
// $Revision: 1.1 $
//
// $Log: not supported by cvs2svn $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
#include <HeaterVessel.h>
#include <HeaterVesselClass.h>
//+----------------------------------------------------------------------------
/**
* Create HeaterVesselClass singleton and return it in a C function for Python usage
*/
//+----------------------------------------------------------------------------
extern "C" {
#ifdef WIN32
__declspec(dllexport)
#endif
Tango::DeviceClass *_create_HeaterVessel_class(const char *name) {
return HeaterVessel_ns::HeaterVesselClass::init(name);
}
}
namespace HeaterVessel_ns
{
//+----------------------------------------------------------------------------
//
// method : ModeManuCmd::execute()
//
// description : method to trigger the execution of the command.
// PLEASE DO NOT MODIFY this method core without pogo
//
// in : - device : The device on which the command must be excuted
// - in_any : The command input data
//
// returns : The command output data (packed in the Any object)
//
//-----------------------------------------------------------------------------
CORBA::Any *ModeManuCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any)
{
cout2 << "ModeManuCmd::execute(): arrived" << endl;
((static_cast<HeaterVessel *>(device))->mode_manu());
return new CORBA::Any();
}
//+----------------------------------------------------------------------------
//
// method : ModeAutoCmd::execute()
//
// description : method to trigger the execution of the command.
// PLEASE DO NOT MODIFY this method core without pogo
//
// in : - device : The device on which the command must be excuted
// - in_any : The command input data
//
// returns : The command output data (packed in the Any object)
//
//-----------------------------------------------------------------------------
CORBA::Any *ModeAutoCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any)
{
cout2 << "ModeAutoCmd::execute(): arrived" << endl;
((static_cast<HeaterVessel *>(device))->mode_auto());
return new CORBA::Any();
}
//+----------------------------------------------------------------------------
//
// method : ManuCmd::execute()
//
// description : method to trigger the execution of the command.
// PLEASE DO NOT MODIFY this method core without pogo
//
// in : - device : The device on which the command must be excuted
// - in_any : The command input data
//
// returns : The command output data (packed in the Any object)
//
//-----------------------------------------------------------------------------
CORBA::Any *ManuCmd::execute(Tango::DeviceImpl *device,const CORBA::Any &in_any)
{
cout2 << "ManuCmd::execute(): arrived" << endl;
((static_cast<HeaterVessel *>(device))->manu());
return new CORBA::Any();
}
//
//----------------------------------------------------------------
// Initialize pointer for singleton pattern
//----------------------------------------------------------------
//
HeaterVesselClass *HeaterVesselClass::_instance = NULL;
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::HeaterVesselClass(string &s)
//
// description : constructor for the HeaterVesselClass
//
// in : - s : The class name
//
//-----------------------------------------------------------------------------
HeaterVesselClass::HeaterVesselClass(string &s):DeviceClass(s)
{
cout2 << "Entering HeaterVesselClass constructor" << endl;
set_default_property();
get_class_property();
write_class_property();
cout2 << "Leaving HeaterVesselClass constructor" << endl;
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::~HeaterVesselClass()
//
// description : destructor for the HeaterVesselClass
//
//-----------------------------------------------------------------------------
HeaterVesselClass::~HeaterVesselClass()
{
_instance = NULL;
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::instance
//
// description : Create the object if not already done. Otherwise, just
// return a pointer to the object
//
// in : - name : The class name
//
//-----------------------------------------------------------------------------
HeaterVesselClass *HeaterVesselClass::init(const char *name)
{
if (_instance == NULL)
{
try
{
string s(name);
_instance = new HeaterVesselClass(s);
}
catch (bad_alloc)
{
throw;
}
}
return _instance;
}
HeaterVesselClass *HeaterVesselClass::instance()
{
if (_instance == NULL)
{
cerr << "Class is not initialised !!" << endl;
exit(-1);
}
return _instance;
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::command_factory
//
// description : Create the command object(s) and store them in the
// command list
//
//-----------------------------------------------------------------------------
void HeaterVesselClass::command_factory()
{
command_list.push_back(new ModeAutoCmd("ModeAuto",
Tango::DEV_VOID, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR));
command_list.push_back(new ModeManuCmd("ModeManu",
Tango::DEV_VOID, Tango::DEV_VOID,
"",
"",
Tango::OPERATOR));
// add polling if any
for (unsigned int i=0 ; i<command_list.size(); i++)
{
}
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::get_class_property
//
// description : Get the class property for specified name.
//
// in : string name : The property name
//
//+----------------------------------------------------------------------------
Tango::DbDatum HeaterVesselClass::get_class_property(string &prop_name)
{
for (unsigned int i=0 ; i<cl_prop.size() ; i++)
if (cl_prop[i].name == prop_name)
return cl_prop[i];
// if not found, return an empty DbDatum
return Tango::DbDatum(prop_name);
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::get_default_device_property()
//
// description : Return the default value for device property.
//
//-----------------------------------------------------------------------------
Tango::DbDatum HeaterVesselClass::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)
return dev_def_prop[i];
// if not found, return an empty DbDatum
return Tango::DbDatum(prop_name);
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::get_default_class_property()
//
// description : Return the default value for class property.
//
//-----------------------------------------------------------------------------
Tango::DbDatum HeaterVesselClass::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)
return cl_def_prop[i];
// if not found, return an empty DbDatum
return Tango::DbDatum(prop_name);
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::device_factory
//
// description : Create the device object(s) and store them in the
// device list
//
// in : Tango::DevVarStringArray *devlist_ptr : The device name list
//
//-----------------------------------------------------------------------------
void HeaterVesselClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
{
// Create all devices.(Automatic code generation)
//-------------------------------------------------------------
for (unsigned long i=0 ; i < devlist_ptr->length() ; i++)
{
cout4 << "Device name : " << (*devlist_ptr)[i].in() << endl;
// Create devices and add it into the device list
//----------------------------------------------------
device_list.push_back(new HeaterVessel(this, (*devlist_ptr)[i]));
// Export device to the outside world
// Check before if database used.
//---------------------------------------------
if ((Tango::Util::_UseDb == true) && (Tango::Util::_FileDb == false))
export_device(device_list.back());
else
export_device(device_list.back(), (*devlist_ptr)[i]);
}
// End of Automatic code generation
//-------------------------------------------------------------
}
//+----------------------------------------------------------------------------
// Method: HeaterVesselClass::attribute_factory(vector<Tango::Attr *> &att_list)
//-----------------------------------------------------------------------------
void HeaterVesselClass::attribute_factory(vector<Tango::Attr *> &att_list)
{
// Attribute : pressure
pressureAttrib *pressure = new pressureAttrib();
att_list.push_back(pressure);
// Attribute : automatic
automaticAttrib *automatic = new automaticAttrib();
Tango::UserDefaultAttrProp automatic_prop;
automatic_prop.set_label("automatic mode");
automatic->set_default_properties(automatic_prop);
att_list.push_back(automatic);
// End of Automatic code generation
//-------------------------------------------------------------
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::get_class_property()
//
// description : Read the class properties from database.
//
//-----------------------------------------------------------------------------
void HeaterVesselClass::get_class_property()
{
// Initialize your default values here (if not done with POGO).
//------------------------------------------------------------------
// Read class properties from database.(Automatic code generation)
//------------------------------------------------------------------
// Call database and extract values
//--------------------------------------------
if (Tango::Util::instance()->_UseDb==true)
get_db_class()->get_property(cl_prop);
Tango::DbDatum def_prop;
int i = -1;
// End of Automatic code generation
//------------------------------------------------------------------
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::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.
//
//-----------------------------------------------------------------------------
void HeaterVesselClass::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 = "SetpointOffset";
prop_desc = "offset in bytes of the C_CTRL_SP_INT in the DB";
prop_def = "";
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 = "AutoByteOffset";
prop_desc = "offset byte of the bit C_CTRL_AUT";
prop_def = "";
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 = "AutoBitOffset";
prop_desc = "bit offset in the byte of bit C_CTRL_AUT";
prop_def = "";
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);
}
//+----------------------------------------------------------------------------
//
// method : HeaterVesselClass::write_class_property
//
// description : Set class description as property in database
//
//-----------------------------------------------------------------------------
void HeaterVesselClass::write_class_property()
{
// First time, check if database used
//--------------------------------------------
if (Tango::Util::_UseDb == false)
return;
Tango::DbData data;
string classname = get_name();
string header;
string::size_type start, end;
// Put title
Tango::DbDatum title("ProjectTitle");
string str_title("Cryo Cooler");
title << str_title;
data.push_back(title);
// Put Description
Tango::DbDatum description("Description");
vector<string> str_desc;
str_desc.push_back("handles the Heater Vessel control :");
str_desc.push_back("pressure setpoint and readback,");
str_desc.push_back("automatic/manu mode");
description << str_desc;
data.push_back(description);
// put cvs location
string rcsId(RcsId);
string filename(classname);
start = rcsId.find("/");
if (start!=string::npos)
{
filename += "Class.cpp";
end = rcsId.find(filename);
if (end>start)
{
string strloc = rcsId.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);
}
}
// Get CVS tag revision
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);
}
// 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("Device_3Impl");
inher_datum << inheritance;
data.push_back(inher_datum);
// Call database and and values
//--------------------------------------------
get_db_class()->put_property(data);
}
} // namespace
//=============================================================================
//
// file : HeaterVesselClass.h
//
// description : Include for the HeaterVesselClass root class.
// This class is represents the singleton class for
// the HeaterVessel device class.
// It contains all properties and methods which the
// HeaterVessel requires only once e.g. the commands.
//
// project : TANGO Device Server
//
// $Author: stephle $
//
// $Revision: 1.1 $
//
// $Log: not supported by cvs2svn $
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#ifndef _HEATERVESSELCLASS_H
#define _HEATERVESSELCLASS_H
#include <tango.h>
#include <HeaterVessel.h>
namespace HeaterVessel_ns
{//=====================================
// Define classes for attributes
//=====================================
class automaticAttrib: public Tango::Attr
{
public:
automaticAttrib():Attr("automatic", Tango::DEV_BOOLEAN, Tango::READ) {};
~automaticAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<HeaterVessel *>(dev))->read_automatic(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<HeaterVessel *>(dev))->is_automatic_allowed(ty);}
};
class pressureAttrib: public Tango::Attr
{
public:
pressureAttrib():Attr("pressure", Tango::DEV_DOUBLE, Tango::READ_WRITE) {};
~pressureAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<HeaterVessel *>(dev))->read_pressure(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<HeaterVessel *>(dev))->write_pressure(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<HeaterVessel *>(dev))->is_pressure_allowed(ty);}
};
//=========================================
// Define classes for commands
//=========================================
class ModeManuCmd : public Tango::Command
{
public:
ModeManuCmd(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) {};
ModeManuCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ModeManuCmd() {};
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<HeaterVessel *>(dev))->is_ModeManu_allowed(any);}
};
class ModeAutoCmd : public Tango::Command
{
public:
ModeAutoCmd(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) {};
ModeAutoCmd(const char *name,
Tango::CmdArgType in,
Tango::CmdArgType out)
:Command(name,in,out) {};
~ModeAutoCmd() {};
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<HeaterVessel *>(dev))->is_ModeAuto_allowed(any);}
};
//
// The HeaterVesselClass singleton definition
//
class HeaterVesselClass : public Tango::DeviceClass
{
public:
// properties member data
// add your own data members here
//------------------------------------
public:
Tango::DbData cl_prop;
Tango::DbData cl_def_prop;
Tango::DbData dev_def_prop;
// Method prototypes
static HeaterVesselClass *init(const char *);
static HeaterVesselClass *instance();
~HeaterVesselClass();
Tango::DbDatum get_class_property(string &);
Tango::DbDatum get_default_device_property(string &);
Tango::DbDatum get_default_class_property(string &);
protected:
HeaterVesselClass(string &);
static HeaterVesselClass *_instance;
void command_factory();
void get_class_property();
void attribute_factory(vector<Tango::Attr *> &);
void write_class_property();
void set_default_property();
private:
void device_factory(const Tango::DevVarStringArray *);
};
} // namespace HeaterVessel_ns
#endif // _HEATERVESSELCLASS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment