|
|
|||
File indexing completed on 2026-08-06 09:38:31
0001 // -*- C++ -*- 0002 #ifndef ThePEG_DebugItem_H 0003 #define ThePEG_DebugItem_H 0004 // 0005 // This is the declaration of the DebugItem class. 0006 // 0007 0008 #include "ThePEG/Config/ThePEG.h" 0009 0010 namespace ThePEG { 0011 0012 /** 0013 * The DebugItem class can be used to efficiently handle detailed 0014 * debug options. The actual objects are used anywhere in a function 0015 * where optional debugging should be done. At that point a static 0016 * object of DebugItem should be constructed giving a name to be used 0017 * (it should be static to ensure that the initialization is only done 0018 * once). After that the object is automatically cast to a bool 0019 * indicating whether or not debugging has been requested for this 0020 * item. 0021 */ 0022 class DebugItem { 0023 0024 public: 0025 0026 /** @name Standard constructors and destructors. */ 0027 //@{ 0028 /** 0029 * The only relevant constructor. The string should typically be on 0030 * the form "namspace::class::function". If the Debug::level is 0031 * larger than or equal to the given \a level this DebugItem will be 0032 * turned on. 0033 */ 0034 DebugItem(string itemname, int level = 100); 0035 //@} 0036 0037 public: 0038 0039 /** 0040 * Switch on all DebugItem objects matching the given string. If \a 0041 * after is positive delay the DebugItem until that number of 0042 * tics. If the string is on the form "<name>=<int>" the integer 0043 * will be taken as the delay. 0044 */ 0045 static void setDebugItem(string itemname, long after = 0); 0046 0047 /** 0048 * Advance one tic, opssibly switching on more debug items. 0049 */ 0050 static void tic(); 0051 0052 /** 0053 * Cheap way of testing if debugging should be done. 0054 */ 0055 operator bool () const { 0056 #ifndef ThePEG_NO_DEBUG 0057 return debug; 0058 #else 0059 return false; 0060 #endif 0061 } 0062 0063 private: 0064 0065 /** 0066 * Set to true if debugging requested. 0067 */ 0068 bool debug; 0069 0070 /** 0071 * Counter for number of tics. 0072 */ 0073 static long & ticker(); 0074 0075 /** 0076 * The DebugItem objects registered, indexed by their name. 0077 */ 0078 static multimap<string,DebugItem*> & items(); 0079 0080 /** 0081 * The DebugItem objects registered, indexed by the tic at which 0082 * they should be turned on.. 0083 */ 0084 static multimap<long,DebugItem*> & itemtics(); 0085 0086 /** 0087 * The DebugItem names registered together with the tic at which it 0088 * should be turned on. 0089 */ 0090 static map<string,long> & nametics(); 0091 0092 private: 0093 0094 /** 0095 * The assignment operator is private and must never be called. 0096 * In fact, it should not even be implemented. 0097 */ 0098 DebugItem & operator=(const DebugItem &) = delete; 0099 0100 }; 0101 0102 } 0103 0104 #endif /* ThePEG_DebugItem_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|