- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/Programmation/Sources/Tensor2/Utils/include/frost_utilsmanager.h

Go to the documentation of this file.

    00001 /* ###################################### */
    00002 /* ###     Frost Engine, by Kalith    ### */
    00003 /* ###################################### */
    00004 /*               XXX header               */
    00005 /*                                        */
    00006 /*                                        */
    00007
    00008
    00009 #ifndef FROST_UTILSMANAGER_H
    00010 #define FROST_UTILSMANAGER_H
    00011
    00012 #include "frost_utils_types.h"
    00013 #include "frost_utils_manager.h"
    00014
    00015 namespace Frost
    00016 {
    00017     /// Manages base functions (log...).
    00018     class UtilsManager : public Manager<UtilsManager>
    00019     {
    00020     friend class Manager<UtilsManager>;
    00021     public :
    00022
    00023         typedef void (*LogFunction)(const s_str&, const s_bool&, const s_uint&);
    00024
    00025         /// Initializes this manager.
    00026         /** \note Calls srand().
    00027         */
    00028         void Initialize();
    00029
    00030         /// Sets the log function to use.
    00031         /** \param pFunc The log function
    00032         *   \note This function will be used by Frost::Log(), Frost::Warning()
    00033         *         and Frost::Error().<br>
    00034         *         Its signature must be :<br>
    00035         *         &nsbp&nsbp&nsbpvoid Func(const s_str&, const s_bool&);<br>
    00036         *         See UtilsManager::Log() for more infos about these params.
    00037         */
    00038         void SetLogFunction(LogFunction pFunc);
    00039
    00040         /// Shortcut to the user specified log function.
    00041         /** \param sMessage    The message to log
    00042         *   \param bTimeStamps 'true' to display time stamps
    00043         *   \param uiOffset    The line jump offset
    00044         */
    00045         void Log(const s_str& sMessage, const s_bool& bTimeStamps, const s_uint& uiOffset);
    00046
    00047         /// Sets the highest log level allowed for all following messages.
    00048         /** \param uiLevel The new highest level
    00049         *   \note When using Log<5>("blabla"), you specify that this message
    00050         *         has a log level of 5. By default, the highest level allowed
    00051         *         is 0 : if you want your message to be printed on the log file,
    00052         *         you must call SetLogLevel(5) or higher.
    00053         *         This allows quick selection of which log messages to print.
    00054         *         The admitted convention is that higher level messages are
    00055         *         less important or extremely precise, so you may not want them
    00056         *         to be printed all the time.
    00057         */
    00058         void SetLogLevel(const s_uint& uiLevel);
    00059
    00060         /// Returns the current highest log level allowed.
    00061         /** \return The current highest log level allowed
    00062         *   \note See SetLogLevel.
    00063         */
    00064         const s_uint& GetLogLevel() const;
    00065
    00066         static const s_str CLASS_NAME;
    00067
    00068     protected :
    00069
    00070         /// Default constructor
    00071         /** \note This is a singleton class. That means that there can
    00072         *         only be a single instance at the same time. That's why
    00073         *         the constructor is not in public scope.<br>
    00074         *         If you need to get a pointer to that unique instance,
    00075         *         call UtilsManager::GetSingleton().<br>
    00076         *         Note that, if GetSingleton() has been called at least once,
    00077         *         you'll have to delete the returned pointer when you close
    00078         *         your program by calling UtilsManager::Delete() (this is
    00079         *         automatically done by Engine).
    00080         */
    00081         UtilsManager();
    00082
    00083         /// Destructor
    00084         /** \note If GetSingleton() has been called at least once,
    00085         *         you'll have to delete the returned pointer when
    00086         *         you close your program by calling Delete() (this is
    00087         *         automatically done by Engine).
    00088         */
    00089         virtual ~UtilsManager();
    00090
    00091         /// Copy constructor
    00092         UtilsManager(const UtilsManager& mMgr);
    00093
    00094         /// Assignment operator
    00095         UtilsManager& operator = (const UtilsManager& mMgr);
    00096
    00097     private :
    00098
    00099         LogFunction pLogFunction_;
    00100         s_uint      uiLogLevel_;
    00101
    00102     };
    00103 }
    00104
    00105 #endif