Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

at_trace.h

Go to the documentation of this file.
00001 //
00002 // The Austria library is copyright (c) Gianni Mariani 2004.
00003 // 
00004 // Grant Of License.  Grants to LICENSEE the non-exclusive right to use the Austria
00005 // library subject to the terms of the LGPL.
00006 // 
00007 // A copy of the license is available in this directory or one may be found at this URL:
00008 //      http://www.gnu.org/copyleft/lesser.txt
00009 // 
00016 #ifndef x_at_trace_h_x
00017 #define x_at_trace_h_x 1
00018 
00019 #include "at_thread.h"
00020 
00021 // Austria namespace
00022 namespace at
00023 {
00024 
00025 
00026 // ======== Trace =====================================================
00035 template <
00036     typename w_TR,
00037     typename w_T1,
00038     typename w_T2,
00039     typename w_T3,
00040     typename w_T4,
00041     typename w_Tp1,
00042     typename w_Tp2,
00043     typename w_Tp3,
00044     typename w_Tp4,
00045     int w_N
00046 >
00047 inline w_TR Trace(
00048     w_TR ( * i_func )( w_T1, w_T2, w_T3, w_T4 ),
00049     const char ( & i_str )[w_N],
00050     int                     i_line,
00051     w_Tp1                   i_v1,
00052     w_Tp2                   i_v2,
00053     w_Tp3                   i_v3,
00054     w_Tp4                   i_v4
00055 )
00056 {
00057     if ( g_tracing )
00058     {
00059         std::ostringstream l_strm;
00060         l_strm << "- " << Task::GetSelfId() << " " << i_str << "( "
00061             << i_v1 << ", "
00062             << i_v2 << ", "
00063             << i_v3 << ", "
00064             << i_v4 << " ):"
00065         << i_line << std::endl;
00066         std::cerr << l_strm.str();
00067     }
00068     
00069     w_TR l_result = ( * i_func )( i_v1, i_v2, i_v3, i_v4 );
00070     
00071     if ( g_tracing )
00072     {
00073         std::ostringstream l_strm;
00074         l_strm << "+ " << Task::GetSelfId() << " " << i_str << "( "
00075             << i_v1 << ", "
00076             << i_v2 << ", "
00077             << i_v3 << ", "
00078             << i_v4 << " ):"
00079         << i_line << " = " << l_result << std::endl;
00080         std::cerr << l_strm.str();
00081     }
00082     
00083     return l_result;
00084 }
00085 
00086 
00087 template <
00088     typename w_TR,
00089     typename w_T1,
00090     typename w_T2,
00091     typename w_T3,
00092     typename w_Tp1,
00093     typename w_Tp2,
00094     typename w_Tp3,
00095     int w_N
00096 >
00097 inline w_TR Trace(
00098     w_TR ( * i_func )( w_T1, w_T2, w_T3 ),
00099     const char ( & i_str )[w_N],
00100     int                     i_line,
00101     w_Tp1                   i_v1,
00102     w_Tp2                   i_v2,
00103     w_Tp3                   i_v3
00104 )
00105 {
00106     if ( g_tracing )
00107     {
00108         std::ostringstream l_strm;
00109         l_strm << "- " << Task::GetSelfId() << " " << i_str << "( "
00110             << i_v1 << ", "
00111             << i_v2 << ", "
00112             << i_v3 << " ):"
00113         << i_line << std::endl;
00114         std::cerr << l_strm.str();
00115     }
00116     
00117     w_TR l_result = ( * i_func )( i_v1, i_v2, i_v3 );
00118     
00119     if ( g_tracing )
00120     {
00121         std::ostringstream l_strm;
00122         l_strm << "+ " << Task::GetSelfId() << " " << i_str << "( "
00123             << i_v1 << ", "
00124             << i_v2 << ", "
00125             << i_v3 << " ):"
00126         << i_line << " = " << l_result << std::endl;
00127         std::cerr << l_strm.str();
00128     }
00129     
00130     return l_result;
00131 }
00132 
00133 template <
00134     typename w_TR,
00135     typename w_T1,
00136     typename w_T2,
00137     typename w_Tp1,
00138     typename w_Tp2,
00139     int w_N
00140 >
00141 inline w_TR Trace(
00142     w_TR ( * i_func )( w_T1, w_T2 ),
00143     const char ( & i_str )[w_N],
00144     int                     i_line,
00145     w_Tp1                   i_v1,
00146     w_Tp2                   i_v2
00147 )
00148 {
00149     if ( g_tracing )
00150     {
00151         std::ostringstream l_strm;
00152         l_strm << "- " << Task::GetSelfId() << " " << i_str << "( "
00153             << i_v1 << ", "
00154             << i_v2 << " ):"
00155         << i_line << std::endl;
00156         std::cerr << l_strm.str();
00157     }
00158     
00159     w_TR l_result = ( * i_func )( i_v1, i_v2 );
00160     
00161     if ( g_tracing )
00162     {
00163         std::ostringstream l_strm;
00164         l_strm << "+ " << Task::GetSelfId() << " " << i_str << "( "
00165             << i_v1 << ", "
00166             << i_v2 << " ):"
00167         << i_line << " = " << l_result << std::endl;
00168         std::cerr << l_strm.str();
00169     }
00170     
00171     return l_result;
00172 }
00173 
00174 template <
00175     typename w_TR,
00176     typename w_T1,
00177     typename w_Tp1,
00178     int w_N
00179 >
00180 inline w_TR Trace(
00181     w_TR ( * i_func )( w_T1 ),
00182     const char ( & i_str )[w_N],
00183     int                     i_line,
00184     w_Tp1                   i_v1
00185 )
00186 {
00187     if ( g_tracing )
00188     {
00189         std::ostringstream l_strm;
00190         l_strm << "- " << Task::GetSelfId() << " " << i_str << "( "
00191             << i_v1 << " ):"
00192         << i_line << std::endl;
00193         std::cerr << l_strm.str();
00194     }
00195     
00196     w_TR l_result = ( * i_func )( i_v1 );
00197     
00198     if ( g_tracing )
00199     {
00200         std::ostringstream l_strm;
00201         l_strm << "+ " << Task::GetSelfId() << " " << i_str << "( "
00202             << i_v1 << " ):"
00203         << i_line << " = " << l_result << std::endl;
00204         std::cerr << l_strm.str();
00205     }
00206     
00207     return l_result;
00208 }
00209 
00210 }; // namespace
00211 
00212 #endif // x_at_trace_x
00213 

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004