/*PROTECTED REGION ID(TestDevice::main.cpp) ENABLED START*/

//=============================================================================
//
// file :        TestDevice.cpp
//
// description : C++ source for the TestDevice device server main.
//               The main rule is to initialise (and create) the Tango
//               system and to create the DServerClass singleton.
//                The main should be the same for every Tango device server.
//
// $Author: graziano $
//
//
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================

#include <tango/tango.h>

#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
#ifndef TANGO_LOG_INFO
#define TANGO_LOG_INFO cout2
#endif
#ifndef TANGO_LOG_DEBUG
#define TANGO_LOG_DEBUG cout4
#endif

int main(int argc,char *argv[])
{
    using namespace std;
	Tango::Util *tg = NULL;
	try
	{
		// Initialise the device server
		//----------------------------------------
		tg = Tango::Util::init(argc,argv);

		// Create the device server singleton 
		//	which will create everything
		//----------------------------------------
		tg->server_init(false);

		// Run the endless loop
		//----------------------------------------
		TANGO_LOG << "Ready to accept request" << endl;
		tg->server_run();
	}
	catch (bad_alloc)
	{
		TANGO_LOG << "Can't allocate memory to store device object !!!" << endl;
		TANGO_LOG << "Exiting" << endl;
	}
	catch (CORBA::Exception &e)
	{
		Tango::Except::print_exception(e);
		
		TANGO_LOG << "Received a CORBA_Exception" << endl;
		TANGO_LOG << "Exiting" << endl;
	}
	if (tg!=NULL)
		tg->server_cleanup();
	return(0);
}
/*PROTECTED REGION END*/
//========================================================