intermediate state
This commit is contained in:
parent
dfe26d9424
commit
f840d51f4f
10 changed files with 146 additions and 130 deletions
|
@ -39,90 +39,90 @@ namespace pw {
|
|||
class debug {
|
||||
public:
|
||||
|
||||
enum level {
|
||||
none, //!< nothing will be logged, even no errors
|
||||
error, //!< only errors will be logged
|
||||
warning, //!< log warnings (non-critical errors)
|
||||
message, //!< log messages (something to note but not an error)
|
||||
notification, //!< log some more information
|
||||
info, //!< log verbose information
|
||||
all = 0xFF //!< log absolutely everything
|
||||
};
|
||||
enum level {
|
||||
none, //!< nothing will be logged, even no errors
|
||||
error, //!< only errors will be logged
|
||||
warning, //!< log warnings (non-critical errors)
|
||||
message, //!< log messages (something to note but not an error)
|
||||
notification, //!< log some more information
|
||||
info, //!< log verbose information
|
||||
all = 0xFF //!< log absolutely everything
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief the streaming interface for the logger
|
||||
*/
|
||||
class stream {
|
||||
public:
|
||||
/**
|
||||
* @brief the streaming interface for the logger
|
||||
*/
|
||||
class stream {
|
||||
public:
|
||||
|
||||
|
||||
stream(debug* log = nullptr);
|
||||
~stream();
|
||||
stream(const stream& other);
|
||||
stream(debug* log = nullptr);
|
||||
~stream();
|
||||
stream(const stream& other);
|
||||
|
||||
|
||||
stream &operator << (const bool &value);
|
||||
stream &operator << (const char *value);
|
||||
stream& operator << (const std::string& value); ///! log a string
|
||||
stream &operator << (const bool &value);
|
||||
stream &operator << (const char *value);
|
||||
stream& operator << (const std::string& value); ///! log a string
|
||||
|
||||
stream& operator << (const float &value); ///! log a float value
|
||||
stream& operator << (const double &value); ///! log a double value
|
||||
stream& operator << (const float &value); ///! log a float value
|
||||
stream& operator << (const double &value); ///! log a double value
|
||||
|
||||
stream& operator << (const int &value); ///! log a int value
|
||||
stream& operator << (const unsigned int &value); ///! log a int value
|
||||
stream& operator << (const int &value); ///! log a int value
|
||||
stream& operator << (const unsigned int &value); ///! log a int value
|
||||
|
||||
stream& operator << (const long &value); ///! log a long value
|
||||
stream& operator << (const unsigned long &value); ///! log a int value
|
||||
stream& operator << (const long &value); ///! log a long value
|
||||
stream& operator << (const unsigned long &value); ///! log a int value
|
||||
|
||||
stream& operator << (const void *value); ///! pointer
|
||||
stream& operator << (const void *value); ///! pointer
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
debug* _log;
|
||||
std::string _line;
|
||||
};
|
||||
debug* _log;
|
||||
std::string _line;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** sets the logging level */
|
||||
void set_level(level level) {_level = level;}
|
||||
/** sets the logging level */
|
||||
void set_level(level level) {_level = level;}
|
||||
|
||||
/** gets the logging level */
|
||||
level level() const { return _level; }
|
||||
/** gets the logging level */
|
||||
level level() const { return _level; }
|
||||
|
||||
/**
|
||||
* @brief get the stream interface of the logger
|
||||
* @return return a temporary object that will write and flush the logger
|
||||
*/
|
||||
static stream s(enum level level = info);
|
||||
/**
|
||||
* @brief get the stream interface of the logger
|
||||
* @return return a temporary object that will write and flush the logger
|
||||
*/
|
||||
static stream s(enum level level = info);
|
||||
|
||||
inline static stream d() { return s(debug::info); }
|
||||
inline static stream e() { return s(debug::error); }
|
||||
inline static stream w() { return s(debug::warning); }
|
||||
inline static stream d() { return s(debug::info); }
|
||||
inline static stream e() { return s(debug::error); }
|
||||
inline static stream w() { return s(debug::warning); }
|
||||
|
||||
/**
|
||||
* @brief returns the instance of the logger
|
||||
* @return
|
||||
*/
|
||||
static debug& get();
|
||||
/**
|
||||
* @brief returns the instance of the logger
|
||||
* @return
|
||||
*/
|
||||
static debug& get();
|
||||
|
||||
/**
|
||||
* @brief write a message to the log
|
||||
* @param message string
|
||||
*/
|
||||
void write(const std::string &message);
|
||||
/**
|
||||
* @brief write a message to the log
|
||||
* @param message string
|
||||
*/
|
||||
void write(const std::string &message);
|
||||
|
||||
typedef std::function<void(const char*)> Callback;
|
||||
typedef std::vector<Callback> CallbackList;
|
||||
typedef std::function<void(const char*)> Callback;
|
||||
typedef std::vector<Callback> CallbackList;
|
||||
|
||||
~debug();
|
||||
~debug();
|
||||
|
||||
protected:
|
||||
|
||||
debug();
|
||||
debug();
|
||||
|
||||
CallbackList _callbacks;
|
||||
enum level _level;
|
||||
CallbackList _callbacks;
|
||||
enum level _level;
|
||||
};
|
||||
|
||||
///**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef PW_CORE_POINT_HPP
|
||||
#define PW_CORE_SIZE_HPP
|
||||
#define PW_CORE_POINT_HPP
|
||||
|
||||
#include <pw/core/globals.hpp>
|
||||
|
||||
|
@ -8,13 +8,10 @@ namespace pw {
|
|||
template <typename T_>
|
||||
struct point_ {
|
||||
|
||||
T_ p[2] = { 0, 0 };
|
||||
T_ x, y;
|
||||
|
||||
point_() = default;
|
||||
point_(T_ x,T_ y) : p( {x,y} ) {}
|
||||
|
||||
const T_ x() { return p[0]; }
|
||||
const T_ y() { return p[1]; }
|
||||
point_(T_ x_,T_ y_) : x(x_), y(y_) {}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -33,14 +33,11 @@ namespace pw {
|
|||
template <typename T_>
|
||||
struct size_ {
|
||||
|
||||
T_ dim[2] = { 0, 0 };
|
||||
T_ width,height;
|
||||
|
||||
size_() = default;
|
||||
|
||||
size_(T_ w,T_ h) : dim( { w, h }) {}
|
||||
|
||||
const T_ width() { return dim[0]; }
|
||||
const T_ height() { return dim[1]; }
|
||||
size_(T_ w,T_ h) : width(w), height(h) {}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -192,16 +192,16 @@ typedef vector2_<long> vector2l;
|
|||
|
||||
typedef vector2_<double> vector2d;
|
||||
typedef vector2_<float> vector2f;
|
||||
typedef vector2_<real_t> vector2;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef vector3_<real_t> vector3;
|
||||
typedef vector3_<double> vector3d;
|
||||
typedef vector3_<float> vector3f;
|
||||
typedef vector3_<int> vector3i;
|
||||
typedef vector3_<unsigned int> vector3ui;
|
||||
|
||||
|
||||
typedef vector4_<real_t> vector4;
|
||||
typedef vector4_<double> vector4d;
|
||||
typedef vector4_<float> vector4f;
|
||||
typedef vector4_<int> vector4i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue