/*
* $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/iif/Interface/Ltcs/Iif/Station.cc 300 2017-11-21 09:45:39Z depa $
*
*/

/**
* @file
* @since 2017-01-17
* @author R. J. Mathar
*/

#include <Ltcs/Iif/Station.h>

/*!*********************
* Default ctor.
* Initialize the state as bentGregorianBack, which is the most suitable default for Linc-Nirvana.
* @since 2017-01-17
*/
Ltcs::IifStation::IifStation(enum IifFstatio stat) 
	: f(stat)
{
}


/*!*********************
* @brief construct from astring like "blabla right" or "bla both".
* @param fstation A string of the format found in the FOCAL_STATION property in lbcs.iif-dev.cfg
* @since 2017-01-17
*/
Ltcs::IifStation::IifStation(const std::string & fstation)
{
        if ( fstation.find("directGregorian") != std::string::npos )
                f= DIRECT ;
        else if ( fstation.find("GregorianFront") != std::string::npos )
                f= FRONT ;
        else if ( fstation.find("GregorianBack") != std::string::npos )
                f= BACK ;
        else if ( fstation.find("GregorianCenter") != std::string::npos )
                f= CENTER ;
        else
                /* this includes the case where the string Prime is in here
                */
                f=PRIME ;
}


#if 0
/*!************************************
* @brief dtor.
* Does nothing (but what is done by the base class).
* @since 2017-01-17
*/
Ltcs::IifStation::~IifStation()
{
}
#endif

/*!************************************
* @brief Generate a string as used in the ICS initializations.
* @return the standard string representation "bentGregorianFront" etc
* @since 2017-01-17
*/
std::string Ltcs::IifStation::toString() const
{
	switch(f)
	{
	case PRIME:
		return std::string("Prime") ;
	case DIRECT :
		return std::string("directGregorian") ;
	case FRONT :
		return std::string("bentGregorianFront") ;
	case BACK :
		return std::string("bentGregorianBack") ;
	case CENTER :
	default :
		return std::string("bentGregorianCenter") ;
	}
}

