Skip to content
DataImporterClass.cpp 37.7 KiB
Newer Older
Marco De Marco's avatar
Marco De Marco committed
/*----- PROTECTED REGION ID(DataImporterClass.cpp) ENABLED START -----*/
static const char *TagName    = "$Name:  $";
static const char *CvsPath    = "$Source:  $";
static const char *SvnPath    = "$HeadURL:  $";
static const char *HttpServer = "http://www.esrf.eu/computing/cs/tango/tango_doc/ds_doc/";
//=============================================================================
//
// file :        DataImporterClass.cpp
//
// description : C++ source for the DataImporterClass.
//               A singleton class derived from DeviceClass.
//               It implements the command and attribute list
//               and all properties and methods required
//               by the DataImporter once per process.
//
// project :     Data importer
//
// This file is part of Tango device class.
Marco De Marco's avatar
Marco De Marco committed
// 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.
Marco De Marco's avatar
Marco De Marco committed
// 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.
Marco De Marco's avatar
Marco De Marco committed
// You should have received a copy of the GNU General Public License
// along with Tango.  If not, see <http://www.gnu.org/licenses/>.
Marco De Marco's avatar
Marco De Marco committed
// $Author:  $
//
// $Revision:  $
// $Date:  $
//
// $HeadURL:  $
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#include <DataImporterClass.h>

/*----- PROTECTED REGION END -----*/	//	DataImporterClass.cpp

//-------------------------------------------------------------------
/**
 *	Create DataImporterClass singleton and
 *	return it in a C function for Python usage
 */
//-------------------------------------------------------------------
extern "C" {
#ifdef _TG_WINDOWS_

__declspec(dllexport)

#endif

	Tango::DeviceClass *_create_DataImporter_class(const char *name) {
		return DataImporter_ns::DataImporterClass::init(name);
	}
}

namespace DataImporter_ns
{
//===================================================================
//	Initialize pointer for singleton pattern
//===================================================================
DataImporterClass *DataImporterClass::_instance = NULL;

//--------------------------------------------------------
/**
 * method : 		DataImporterClass::DataImporterClass(string &s)
 * description : 	constructor for the DataImporterClass
 *
 * @param s	The class name
 */
//--------------------------------------------------------
DataImporterClass::DataImporterClass(string &s):Tango::DeviceClass(s)
{
	cout2 << "Entering DataImporterClass constructor" << endl;
	set_default_property();
	get_class_property();
Marco De Marco's avatar
Marco De Marco committed
	write_class_property();

	/*----- PROTECTED REGION ID(DataImporterClass::constructor) ENABLED START -----*/
Marco De Marco's avatar
Marco De Marco committed
	/*----- PROTECTED REGION END -----*/	//	DataImporterClass::constructor

	cout2 << "Leaving DataImporterClass constructor" << endl;
}

//--------------------------------------------------------
/**
 * method : 		DataImporterClass::~DataImporterClass()
 * description : 	destructor for the DataImporterClass
 */
//--------------------------------------------------------
DataImporterClass::~DataImporterClass()
{
	/*----- PROTECTED REGION ID(DataImporterClass::destructor) ENABLED START -----*/
Marco De Marco's avatar
Marco De Marco committed
	/*----- PROTECTED REGION END -----*/	//	DataImporterClass::destructor

	_instance = NULL;
}


//--------------------------------------------------------
/**
 * method : 		DataImporterClass::init
 * description : 	Create the object if not already done.
 *                  Otherwise, just return a pointer to the object
 *
 * @param	name	The class name
 */
//--------------------------------------------------------
DataImporterClass *DataImporterClass::init(const char *name)
{
	if (_instance == NULL)
	{
		try
		{
			string s(name);
			_instance = new DataImporterClass(s);
		}
		catch (bad_alloc &)
		{
			throw;
Marco De Marco's avatar
Marco De Marco committed
	return _instance;
}

//--------------------------------------------------------
/**
 * method : 		DataImporterClass::instance
 * description : 	Check if object already created,
 *                  and return a pointer to the object
 */
//--------------------------------------------------------
DataImporterClass *DataImporterClass::instance()
{
	if (_instance == NULL)
	{
		cerr << "Class is not initialised !!" << endl;
		exit(-1);
	}
	return _instance;
}



//===================================================================
//	Command execution method calls
//===================================================================
//--------------------------------------------------------
/**
 * method : 		OnClass::execute()
 * description : 	method to trigger the execution of the command.
 *
 * @param	device	The device on which the command must be executed
 * @param	in_any	The command input data
 *
 *	returns The command output data (packed in the Any object)
 */
//--------------------------------------------------------
CORBA::Any *OnClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
	cout2 << "OnClass::execute(): arrived" << endl;
	((static_cast<DataImporter *>(device))->on());
	return new CORBA::Any();
}

//--------------------------------------------------------
/**
 * method : 		OffClass::execute()
 * description : 	method to trigger the execution of the command.
 *
 * @param	device	The device on which the command must be executed
 * @param	in_any	The command input data
 *
 *	returns The command output data (packed in the Any object)
 */
//--------------------------------------------------------
CORBA::Any *OffClass::execute(Tango::DeviceImpl *device, TANGO_UNUSED(const CORBA::Any &in_any))
{
	cout2 << "OffClass::execute(): arrived" << endl;
	((static_cast<DataImporter *>(device))->off());
	return new CORBA::Any();
}

//--------------------------------------------------------
/**
 * method : 		ResetCounterClass::execute()
 * description : 	method to trigger the execution of the command.
Loading full blame...