/*****************************************************************************
 * $LastChangedDate: 2011-04-22 12:24:45 -0400 (Fri, 22 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Module configuration.  base::Conf isn't a base class.
 *//*
 * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef BASE_CONF_HH
#define BASE_CONF_HH 1

#define BASE_CONF base::GET_CONF()

#include "base/conf_txt.hh"
#include "base/time.hh"

namespace base {

const string& GetDataDir( void );

////////////////////////////////////////////////////////////////////////////////
/// @brief Module configuration.  base::Conf isn't a base class.
///
/// Every module must have a Conf class with an Init() method.
/// But deriving Conf classes isn't appropriate since module configuration may differ.
/// Eg, some modules read a text conf file but others don't.
///
/// Commonality:
/// - Module defines a Conf class.
/// - Module's Conf class defines the method Conf::Init().
/// - Module defines the global variable MODULE::global::gConf.
///   Usually this global should be accessed by the macro MODULE_CONF().
///
/// How modules are configured:
/// - The init module calls module::Init() of every module.
/// - In turn, if necessary, each module calls its Conf::Init().
/// - The filename of the program's .conf file is passed.
///   Most modules parse it but not all do.
///
class Conf
{
#include "base/conf_template_txt.hh"
public:
    string  mProgramName;       ///< determines full pathname of data dir

    // cmd-line:
    int     mArgc;
    char**  mArgv;
    string  mArgv0;
    bool    mArgVerbose;
    bool    mArgQuiet;
#if OS_UNIX
    bool    mTimerUnixGettimeofday;     ///< TimeClock: -time-gettimeofday
#endif

    // .conf:
    bool            mVerbose;
    bool            mQuiet;
    uint            mRandomSeed;
    Milliseconds    mTimeClockSkewMilliseconds;     ///< TimeClock: time delta threshold when calendar-clock is considered skewed
};
#include "base/conf_template_end.hh"

} // namespace base

#endif // BASE_CONF_HH
