/*****************************************************************************
 * $LastChangedDate: 2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Main header file.
 * @namespace base
 * @brief Library of base code.
 * @namespace base::RESTRICT
 * @brief Internal.
 * @remarks
 * -----------------------------------------------------------------------------
 * Coding convention for modules:
 * - module.hh is the main header files that includes often-used header files.
 * - Init() initializes the module (if applicable).
 * - Start() starts the execution of a module (if applicable).
 * -----------------------------------------------------------------------------
 *//*
 * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef BASE_MODULE_HH
#define BASE_MODULE_HH 1

#include <string>
using std::string;

namespace base {

////////////////////////////////////////////////////////////////////////////////
/// @brief InitArgs struct is passed to Init() of every module.
///
struct InitArgs
{
    InitArgs( int argc, char** argv, const string& programName )
    : mArgc(argc), mArgv(argv), mProgramName(programName)
    {
    }
    int     mArgc;
    char**  mArgv;
    string  mProgramName;
};

/*******************************************************************************
 * Initialize module.
 *******************************************************************************/
void Init( const InitArgs& initArgs );

/*******************************************************************************
 * Start module.
 *******************************************************************************/
void Start( void );

/*******************************************************************************
 * Exit to MSDOS.
 * EXIT() is used instead of exit() in case cleanup should be done.
 *******************************************************************************/
void EXIT( int exitCode );

} // namespace base

//------------------------------------------------------------------------------

// To declare globals in header files.
#if BASE_MODULE_CC
#define BASE_GLOBAL  // instantiate when .cc is compiled
#else
#define BASE_GLOBAL extern
#endif

// Include only usual headers.
#include "base/sys.hh"
#include "base/cc.hh"
#include "base/types.hh"
#if DEBUG
#include "base/typesig_defs.hh"
#endif
#include "base/typesig.hh"
#include "base/macros.hh"
#include "base/exception.hh"
#include "base/assert.hh"
#include "base/defs.hh"   // general
#include "base/defs2.hh"  // specific
#include "base/debug.hh"
#include "base/funcs.hh"
#include "base/safe_ptr.hh"
#include "base/shptr.hh"
#if COMPILE_OSG
#include "base/ref_ptr.hh"
#endif

#endif // BASE_MODULE_HH
