FunctionTrace.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_LOGGING_FUNCTIONTRACE_H_
36 #define _BLAZE_UTIL_LOGGING_FUNCTIONTRACE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <new>
44 #include <string>
45 #include <blaze/system/Logging.h>
46 #include <blaze/system/Signature.h>
47 #include <blaze/util/NonCopyable.h>
48 
49 
50 namespace blaze {
51 
52 namespace logging {
53 
54 //=================================================================================================
55 //
56 // CLASS DEFINITION
57 //
58 //=================================================================================================
59 
60 //*************************************************************************************************
68 class FunctionTrace : private NonCopyable
69 {
70  public:
71  //**Constructors********************************************************************************
74  FunctionTrace( const std::string& file, const std::string& function );
76  //**********************************************************************************************
77 
78  //**Destructor**********************************************************************************
83  //**********************************************************************************************
84 
85  private:
86  //**Member variables****************************************************************************
89  std::string file_;
90  std::string function_;
91 
92  //**********************************************************************************************
93 
94  //**Forbidden operations************************************************************************
97  void* operator new ( std::size_t ) /*throw( std::bad_alloc )*/;
98  void* operator new[]( std::size_t ) /*throw( std::bad_alloc )*/;
99  void* operator new ( std::size_t, const std::nothrow_t& ) /*throw()*/;
100  void* operator new[]( std::size_t, const std::nothrow_t& ) /*throw()*/;
101 
102  void operator delete ( void* ) /*throw()*/;
103  void operator delete[]( void* ) /*throw()*/;
104  void operator delete ( void*, const std::nothrow_t& ) /*throw()*/;
105  void operator delete[]( void*, const std::nothrow_t& ) /*throw()*/;
107  //**********************************************************************************************
108 };
109 //*************************************************************************************************
110 
111 
112 
113 
114 //=================================================================================================
115 //
116 // BLAZE_FUNCTION_TRACE MACRO
117 //
118 //=================================================================================================
119 
120 //*************************************************************************************************
153 #if BLAZE_USE_FUNCTION_TRACES
154 # define BLAZE_FUNCTION_TRACE \
155  blaze::logging::FunctionTrace BLAZE_FUNCTION_TRACE_OBJECT( __FILE__, BLAZE_SIGNATURE )
156 #else
157 # define BLAZE_FUNCTION_TRACE
158 #endif
159 //*************************************************************************************************
160 
161 } // namespace logging
162 
163 } // namespace blaze
164 
165 #endif
System settings for the logging functionality.
RAII object for function tracing.The FunctionTrace class is an auxiliary helper class for the tracing...
Definition: FunctionTrace.h:68
Header file for a compiler independent type/function signature macro.
Base class for non-copyable class instances.
std::string file_
The file name the traced function is contained in.
Definition: FunctionTrace.h:89
FunctionTrace(const std::string &file, const std::string &function)
Constructor for the FunctionTrace class.
Definition: FunctionTrace.cpp:70
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Base class for non-copyable class instances.The NonCopyable class is intended to work as a base class...
Definition: NonCopyable.h:63
~FunctionTrace()
Destructor for the FunctionTrace class.
Definition: FunctionTrace.cpp:106
std::string function_
The name of the traced function.
Definition: FunctionTrace.h:90