Changeset 61:df11e62df6a6 in rrlib_logging


Ignore:
Timestamp:
23.08.2011 17:33:01 (9 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Replaced old workaround by proper C++11 mechanism

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • definitions.h

    r60 r61  
    7070extern char *default_log_description; 
    7171 
    72 inline rrlib::logging::tLogDomainSharedPointer GetLogDomain(rrlib::logging::tLogDomainSharedPointer(&default_domain)(), ...) 
     72template <typename ... Types> 
     73inline rrlib::logging::tLogDomainSharedPointer GetLogDomain(rrlib::logging::tLogDomainSharedPointer(&default_domain)(), const Types &...) 
    7374{ 
    7475  return default_domain(); 
  • tLogStream.h

    r53 r61  
    244244  } 
    245245 
    246   // FIXME: with -std=gnu++0x the following set of methods can be replaced by a proper variadic template implementation like this: 
    247 //  template <typename THead, typename ... TRest> 
    248 //  inline tLogStream &Evaluate(const THead &head, TRest... rest) 
    249 //  { 
    250 //    *this << head; 
    251 //    this->Evaluate(rest...); 
    252 //    return *this; 
    253 //  } 
    254 // 
    255 //  template <typename THead, typename ... TRest> 
    256 //  inline tLogStream &Evaluate(tLogDomainSharedPointer (&)(), const THead &head, TRest... rest) 
    257 //  { 
    258 //    return this->Evaluate(head, rest...); 
    259 //  } 
    260 // 
    261 //  template <typename THead> 
    262 //  inline tLogStream &Evaluate(const THead &head) 
    263 //  { 
    264 //    return *this << head; 
    265 //  } 
    266  
    267   template <typename T1> 
    268   inline tLogStream &Evaluate(const T1 &arg1) 
    269   { 
    270     return *this << arg1; 
    271   } 
    272  
    273   template <typename T1> 
    274   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1) 
    275   { 
    276     return *this << arg1; 
    277   } 
    278  
    279   template <typename T1, typename T2> 
    280   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2) 
    281   { 
    282     return *this << arg1 << arg2; 
    283   } 
    284  
    285   template <typename T1, typename T2> 
    286   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2) 
    287   { 
    288     return *this << arg1 << arg2; 
    289   } 
    290  
    291   template <typename T1, typename T2, typename T3> 
    292   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3) 
    293   { 
    294     return *this << arg1 << arg2 << arg3; 
    295   } 
    296  
    297   template <typename T1, typename T2, typename T3> 
    298   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3) 
    299   { 
    300     return *this << arg1 << arg2 << arg3; 
    301   } 
    302  
    303   template <typename T1, typename T2, typename T3, typename T4> 
    304   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4) 
    305   { 
    306     return *this << arg1 << arg2 << arg3 << arg4; 
    307   } 
    308  
    309   template <typename T1, typename T2, typename T3, typename T4> 
    310   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4) 
    311   { 
    312     return *this << arg1 << arg2 << arg3 << arg4; 
    313   } 
    314  
    315   template <typename T1, typename T2, typename T3, typename T4, typename T5> 
    316   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5) 
    317   { 
    318     return *this << arg1 << arg2 << arg3 << arg4 << arg5; 
    319   } 
    320  
    321   template <typename T1, typename T2, typename T3, typename T4, typename T5> 
    322   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5) 
    323   { 
    324     return *this << arg1 << arg2 << arg3 << arg4 << arg5; 
    325   } 
    326  
    327   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> 
    328   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6) 
    329   { 
    330     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6; 
    331   } 
    332  
    333   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> 
    334   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6) 
    335   { 
    336     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6; 
    337   } 
    338  
    339   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> 
    340   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7) 
    341   { 
    342     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7; 
    343   } 
    344  
    345   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> 
    346   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7) 
    347   { 
    348     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7; 
    349   } 
    350  
    351   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> 
    352   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8) 
    353   { 
    354     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8; 
    355   } 
    356  
    357   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> 
    358   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8) 
    359   { 
    360     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8; 
    361   } 
    362  
    363   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
    364   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9) 
    365   { 
    366     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9; 
    367   } 
    368  
    369   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> 
    370   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9) 
    371   { 
    372     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9; 
    373   } 
    374  
    375   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> 
    376   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10) 
    377   { 
    378     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10; 
    379   } 
    380  
    381   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> 
    382   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10) 
    383   { 
    384     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10; 
    385   } 
    386  
    387   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> 
    388   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11) 
    389   { 
    390     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11; 
    391   } 
    392  
    393   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11> 
    394   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11) 
    395   { 
    396     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11; 
    397   } 
    398  
    399   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> 
    400   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12) 
    401   { 
    402     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12; 
    403   } 
    404  
    405   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12> 
    406   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12) 
    407   { 
    408     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12; 
    409   } 
    410  
    411   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> 
    412   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13) 
    413   { 
    414     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13; 
    415   } 
    416  
    417   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> 
    418   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13) 
    419   { 
    420     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13; 
    421   } 
    422  
    423   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> 
    424   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14) 
    425   { 
    426     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14; 
    427   } 
    428  
    429   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> 
    430   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14) 
    431   { 
    432     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14; 
    433   } 
    434  
    435   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> 
    436   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14, const T15 &arg15) 
    437   { 
    438     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14 << arg15; 
    439   } 
    440  
    441   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> 
    442   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14, const T15 &arg15) 
    443   { 
    444     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14 << arg15; 
    445   } 
    446  
    447   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> 
    448   inline tLogStream &Evaluate(const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14, const T15 &arg15, const T16 &arg16) 
    449   { 
    450     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14 << arg15 << arg16; 
    451   } 
    452  
    453   template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, typename T16> 
    454   inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const T2 &arg2, const T3 &arg3, const T4 &arg4, const T5 &arg5, const T6 &arg6, const T7 &arg7, const T8 &arg8, const T9 &arg9, const T10 &arg10, const T11 &arg11, const T12 &arg12, const T13 &arg13, const T14 &arg14, const T15 &arg15, const T16 &arg16) 
    455   { 
    456     return *this << arg1 << arg2 << arg3 << arg4 << arg5 << arg6 << arg7 << arg8 << arg9 << arg10 << arg11 << arg12 << arg13 << arg14 << arg15 << arg16; 
    457   } 
    458  
     246  template <typename T1, typename ... TRest> 
     247  inline tLogStream &Evaluate(const T1 &arg1, const TRest &... args) 
     248  { 
     249    *this << arg1; 
     250    this->Evaluate(args...); 
     251    return *this; 
     252  } 
     253 
     254  template <typename T1, typename ... TRest> 
     255  inline tLogStream &Evaluate(tLogDomainSharedPointer(&)(), const T1 &arg1, const TRest &... args) 
     256  { 
     257    *this << arg1; 
     258    this->Evaluate(args...); 
     259    return *this; 
     260  } 
    459261 
    460262//---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.