X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fintegration-api%2Fdebug.h;h=309649b0c8d395c1df6622aa23c07fe9dd00d865;hb=0643c768fd100bd7ffb522e3358b88d075bc1d2e;hp=b22a5fe78663aa4aa0cd1ddd1f5e590eeeb1acd5;hpb=911c921c8790ec01f81fbec49e2c7165b9d4ea19;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/integration-api/debug.h b/dali/integration-api/debug.h index b22a5fe..309649b 100644 --- a/dali/integration-api/debug.h +++ b/dali/integration-api/debug.h @@ -2,7 +2,7 @@ #define __DALI_INTEGRATION_DEBUG_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,9 +21,13 @@ // EXTERNAL INCLUDES #include #include +#include #include #include +#include +#include + // INTERNAL INCLUDES #include @@ -41,6 +45,26 @@ class Matrix3; class Matrix; class Quaternion; +#if defined(DEBUG_ENABLED) + +// Less opaque types for debugger +typedef std::vector DebugPropertyValueArray; +typedef std::pair< Property::Index, Property::Value > DebugIndexValuePair; +typedef std::vector DebugStringValueContainer; +typedef std::vector< DebugIndexValuePair > DebugIndexValueContainer; + +struct DebugPropertyValueMap +{ + DebugStringValueContainer stringValues; + DebugIndexValueContainer intValues; +}; + +// Fake globals for gdb typedefs +extern Dali::DebugPropertyValueArray gValueArray; +extern Dali::DebugPropertyValueMap gValueMap; + +#endif + namespace Integration { namespace Log @@ -58,7 +82,7 @@ enum DebugPriority * @param level debug level * @param format string format */ -DALI_IMPORT_API void LogMessage(enum DebugPriority level,const char *format, ...); +DALI_CORE_API void LogMessage(enum DebugPriority level,const char *format, ...); /** * typedef for the logging function. @@ -72,13 +96,13 @@ typedef void (*LogFunction)(DebugPriority priority, std::string& message); * @param logFunction the log function to install * @param logOpts the log options to save in thread */ -DALI_IMPORT_API void InstallLogFunction(const LogFunction& logFunction); +DALI_CORE_API void InstallLogFunction(const LogFunction& logFunction); /** * A log function has to be uninstalled for every thread that wants to use logging. * The log function can be different for each thread. */ -DALI_IMPORT_API void UninstallLogFunction(); +DALI_CORE_API void UninstallLogFunction(); /******************************************************************************** * Error/Warning macros. * @@ -108,6 +132,11 @@ DALI_IMPORT_API void UninstallLogFunction(); */ #define DALI_LOG_RENDER_INFO(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) +/** + * Provides unfiltered logging for release + */ +#define DALI_LOG_RELEASE_INFO(format, args...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, format, ## args) + #ifdef DEBUG_ENABLED /** @@ -151,7 +180,7 @@ enum LogLevel * It provides the ability to turn tracing on or off. * */ -class DALI_IMPORT_API Filter +class DALI_CORE_API Filter { public: typedef std::list FilterList; @@ -285,9 +314,18 @@ public: #define DALI_LOG_INFO(filter, level, format, args...) \ if(filter && filter->IsEnabledFor(level)) { filter->Log(level, format, ## args); } +#define DALI_LOG_STREAM( filter, level, stream ) \ + if(filter && filter->IsEnabledFor(level)) \ + { \ + std::ostringstream o; \ + o << stream << std::endl; \ + filter->Log(level, "%s", o.str().c_str()); \ + } + #else // DEBUG_ENABLED #define DALI_LOG_INFO(filter, level, format, args...) +#define DALI_LOG_STREAM( filter, level, stream ) #endif // DEBUG_ENABLED @@ -303,7 +341,7 @@ public: #ifdef DEBUG_ENABLED -class DALI_IMPORT_API TraceObj +class DALI_CORE_API TraceObj { public: TraceObj(Filter* filter, const char* fmt, ...); @@ -399,94 +437,6 @@ public: \ #endif /******************************************************************************** - * Helper writers * - ********************************************************************************/ - -/** - * Helper method to translate a color to a string. - * @param[in] color - the color to translate - * @return string - the text representation of the color. - */ -DALI_IMPORT_API std::string ColorToString(const Vector4& color); - -/** - * Helper method to translate a vector4 to a string. - * @param[in] v - the vector - * @param[in] precision - the precision to write the float data. - * @param[in] indent - the indent level to use. - * @return string - the text representation of the vector. - */ -DALI_IMPORT_API std::string Vector4ToString(const Vector4& v, size_t precision=3, size_t indent=0); - -/** - * Helper method to translate a vector4 to a string. - * @param[in] v - the vector - * @param[in] precision - the precision to write the float data. - * @param[in] indent - the indent level to use. - * @return string - the text representation of the vector. - */ -DALI_IMPORT_API std::string Vector3ToString(const Vector3& v, size_t precision=3, size_t indent=0); - -/** - * Helper method to translate a quaternion to a string. - * @param[in] q the quaternion - * @param[in] precision - the precision to write the float data. - * @param[in] indent - the indent level to use. - * @return string - the text representation of the quaternion. - */ -DALI_IMPORT_API std::string QuaternionToString(const Quaternion& q, size_t precision=3, size_t indent=0); - -/** - * Helper method to translate a 3x3 matrix to a string. - * @param[in] m - the matrix - * @param[in] precision - the precision to write the float data. - * @param[in] indent - the indent level to use. - * @return string - the text representation of the vector. - */ -DALI_IMPORT_API std::string Matrix3ToString(const Matrix3& m, size_t precision=3, size_t indent=0); - -/** - * Helper method to translate a 4x4 matrix to a string. - * @param[in] m - the matrix - * @param[in] precision - the precision to write the float data. - * @param[in] indent - the indent level to use. - * @return string - the text representation of the vector. - */ -DALI_IMPORT_API std::string MatrixToString(const Matrix& m, size_t precision=3, size_t indent=0); - -#ifdef DEBUG_ENABLED - - -/** - * Filtered write of a matrix - */ -#define DALI_LOG_MATRIX(filter, matrix) DALI_LOG_INFO(filter, Debug::General, MatrixToString(matrix)) - -/** - * Filtered write of a vector - */ -#define DALI_LOG_VECTOR4(filter, vector) DALI_LOG_INFO(filter, Debug::General, Vector4ToString(vector)) - -/** - * Filtered write of a vector - */ -#define DALI_LOG_VECTOR3(filter, vector) DALI_LOG_INFO(filter, Debug::General, Vector3ToString(vector)) - -/** - * Filtered write of a color - */ -#define DALI_LOG_COLOR(filter, color) DALI_LOG_INFO(filter, Debug::General, ColorToString(color)) - -#else - -#define DALI_LOG_MATRIX(filter, matrix) -#define DALI_LOG_VECTOR4(filter,vector) -#define DALI_LOG_VECTOR3(filter,vector) -#define DALI_LOG_COLOR(filter, color) - -#endif - -/******************************************************************************** * Time instrumentation * ********************************************************************************/