/*****************************************************************************
 * $LastChangedDate: 2011-04-09 21:58:06 -0400 (Sat, 09 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Simulated time.
 *//*
 * LEGAL:   COPYRIGHT (C) 2008 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef GLUE_SIM_TIME_HH
#define GLUE_SIM_TIME_HH 1

#define GET_SIM_TIME() (SimTime::GetInstance())
#define ASSERT_HOUR(hour) ASSERT( FP_GE((hour),0.0f) and FP_LE((hour),24.0f) );

#include "base/singleton.hh"

namespace glue {

namespace defs { const fp DEFAULT_HOUR = 8.0f; }

////////////////////////////////////////////////////////////////////////////////
/// @brief Simulated time.
///
class SimTime
{
PREVENT_COPYING(SimTime)
private:
    SimTime( void );
    ~SimTime();

public:
    typedef fp Hour;  ///< fractional hours are possible

public:
                        DEFINE_GetInstance( SimTime )  // Singleton
    void                SetHour( const Hour hour );
    Hour                GetHour( void ) const { return mHour; }
    bool                IfDayTime( void ) const;
    CLASS_METHOD bool   IfDayTime( const Hour hour );
    bool                IfMorningTime( void ) const;
    CLASS_METHOD bool   IfMorningTime( const Hour hour );
    bool                IfEveningTime( void ) const;
    CLASS_METHOD bool   IfEveningTime( const Hour hour );
    bool                IfNightTime( void ) const;
    CLASS_METHOD bool   IfNightTime( const Hour hour );

private:
    CLASS_VAR SimTime*  msInstance;
    Hour                mHour;          ///< time-of-day (fp, not int)
};

} // namespace glue

#endif // GLUE_SIM_TIME_HH
