could I have developed a 'custom' C, so that I can display text in the console and in a log file Can print This cout class has been rounded up an integer on initialization, in which the integer representing the verbobuse level of the message is. If the current verbosity level is equal to or equal to the verbosity level of the message, then the message should be printed.
The problem is, I still have to send a message when I have the current verbose level too low. I went ahead and debug it, was hoping to find this problem. Instead, I have met several scenarios where not working as I that expected statements
The statement that (ilralevel_passed & lt; = ilralevel_set) will sometimes increases even further if ilralevel_set low Ilrleval_pass You can see this behavior in the following behavior (apologetic for the use of my twitter). Note that ILRLEVAL_set is equal to zero, and ILL level_Pread is equal to one. However, if the statement has come true and is now moving forward then cout to pass the line.
I have never seen such behavior and I am not completely sure how to debug it. I am not able to separate the behavior - it only happens in parts of my program. I Any suggestions are always appreciated. Examples of
// function are used: // ilra_status & lt; & Lt; Setfill ('0') & lt; & Lt; Setup (2) & lt; & Lt; Send time T_SC & lt; & Lt; Endl; // ilra_warning & lt; & Lt; "Dispat Time (Second):" & lt; & Lt; MKTM (and sending time) & lt; & Lt; Endl; // Here is the 'Custom' Cot Function: #ifndef ILRA_H_ #define ILRA_H_ // System Libraries #include & lt; Iostream & gt; # Include & lt; Ostream & gt; # Include & lt; Sstream & gt; # Include & lt; Iomanip & gt; / Definitions #define ilra_talk ilra (__ function __, 0) #define ilra_update ilra (__ work __, 0) #define ilra_error ilra (__ function __, 1) #define ilra_warning ilra (__ work __, 2) #define ilra_status ilra (__Function__, 3) // static static en ilralevel_set = 0; Static intel ilrleval_pass; // Class Class Iraa {Public: // Constructor / Destructor Illa (Const Stroot :: String and Funkm, In Tusat) {ilralevel_passed = toset; } ~ ILara () {}; // Enable / disable irla functions static zero ilra_verbose_level (int toset) {ilralevel_set = toset; } // Output template & lt; Square T & gt; ILRA and operator & lt; & Lt; (Const T & V) {if (ilralevel_passed & lt; = ilralevel_set) std :: cout & lt; & Lt; V; Return * This; } Illa and Operator & lt; & Lt; (Std :: Ostrym & amp; (* f) (std :: Ostrym & amp;)) {if (Illerlevel_pasd & lt; = Illerlevel_set) std :: Code & lt; & Lt; * F; Return * This; }}; // end of class #endif / * ILRA_H_ * /
When you define are defined in a separate variable for any class out static variables, each source file in which you include header - it does not affect the value of the same name as the variable in another file to change the value of a.
You almost certainly want
int ilralevel_set = 0; Int ilralevel_passed; A file in which you define your object, and: extern int ilralevel_set; Extension int irrelevel_pass; In the header,
Alternatively, it seems that you can transfer it to everyone in the class:
class ilra {int pass_level; Int set_level; Public: Mother (Int Tusat): Pass_ Level (Tuset), Set_Level (0) {} Verbose_Level (Int Tusat) {set_level = toset; } // ...};
Comments
Post a Comment