     1	#include <tango.h>
     2	
     3	#include <steppermotor.h>
     4	#include <steppermotorclass.h>
     5	
     6	namespace StepperMotor
     7	{
     8	
     9	StepperMotorClass *StepperMotorClass::_instance = NULL;
    10	
    11	StepperMotorClass::StepperMotorClass(string &s):
    12	Tango::DeviceClass(s)
    13	{
    14		cout2 << "Entering StepperMotorClass constructor" << endl;
    15		
    16		cout2 << "Leaving StepperMotorClass constructor" << endl;
    17	}
    18	
    19	
    20	StepperMotorClass *StepperMotorClass::init(const char *name)
    21	{
    22		if (_instance == NULL)
    23		{
    24			try
    25			{
    26				string s(name);
    27				_instance = new StepperMotorClass(s);
    28			}
    29			catch (bad_alloc)
    30			{
    31				throw;
    32			}		
    33		}		
    34		return _instance;
    35	}
    36	
    37	StepperMotorClass *StepperMotorClass::instance()
    38	{
    39		if (_instance == NULL)
    40		{
    41			cerr << "Class is not initialised !!" << endl;
    42			exit(-1);
    43		}
    44		return _instance;
    45	}
