J
Jarek Blakarz
I need a class that gathers information about what lines in the code were
executed. I want it not to generate a lot of data on the screen. Perfectly it
would keep this information in a variable and print it on demand.
In other woerds I want it to be printed only when specific conditions hold.
The best solution seems to be bit field where a specific bit is set when a
specific line of the code has been reached.
I wrote the following template class.
Please improve this class when you see some weak points of it.
I desire especially the design improvements.
I decided to use template since when I want to trace only a few lines the short
variable seems to be sufficent that consumes less memory.
thanks for help
template <typename T>
struct SLT {
SLT(void) : m_flag(0) {}
void set(unsigned int shift) { m_flag |= 1 << shift; }
void clear(void) { m_flag = 0; }
T get(void) const { return m_flag; }
private:
T m_flag;
};
executed. I want it not to generate a lot of data on the screen. Perfectly it
would keep this information in a variable and print it on demand.
In other woerds I want it to be printed only when specific conditions hold.
The best solution seems to be bit field where a specific bit is set when a
specific line of the code has been reached.
I wrote the following template class.
Please improve this class when you see some weak points of it.
I desire especially the design improvements.
I decided to use template since when I want to trace only a few lines the short
variable seems to be sufficent that consumes less memory.
thanks for help
template <typename T>
struct SLT {
SLT(void) : m_flag(0) {}
void set(unsigned int shift) { m_flag |= 1 << shift; }
void clear(void) { m_flag = 0; }
T get(void) const { return m_flag; }
private:
T m_flag;
};