1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
14 /** @brief Collection of logging severities to log.
16 Each log severity which had a corresponding bit in an integer,
17 now has a boolean in an array.
19 @note This class must be a POD type. Because it will be a member of a union,
20 it must not have a constructor or a copy assignment operator.
21 The compiler-generated copy constructor and assignment
22 are fine for this class.
24 \b Warning! This class has no default constructor. An expression like @code
25 Logging_Bits x; @endcode will result in \c x being \b uninitialised.
26 To avoid surprises, initialise Logging_Bits objects as an aggregate: @code
27 Logging_Bits d = { 0,0,........,0 }; @endcode or copy-initialise from
28 one of the predefined constants e.g. @code
29 Logging_Bits d = Logging_Bits::log_nothing; @endcode or call Logging_Bits::clear()
30 immediately after constructing.
35 bool bits[TTCN_Logger::NUMBER_OF_LOGSEVERITIES];
37 static const Logging_Bits log_nothing;
38 static const Logging_Bits log_all;
39 static const Logging_Bits log_everything;
40 static const Logging_Bits default_console_mask;
42 bool operator ==( const Logging_Bits& other ) const;
43 bool operator !=( const Logging_Bits& other ) const
45 return ! operator==( other );
48 /** @brief Sets all bits to false.
50 @post *this == Logging_Bits::log_nothing
54 /** @brief Sets one bit corresponding to a TTCN_Logger::Severity.
58 @pre \p sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES
59 @param sev log severity
60 @post bits[sev] is true
62 @note All other bits remain unchanged. To have set \b only the specified bit,
65 void add_sev ( TTCN_Logger::Severity sev );
67 /** @brief Merge two Logging_Bits objects
69 Bits which are set in \p sev will become set in \p *this. \n
70 Bits which were already set in \p *this remain unchanged. \n
71 Bits which weren't set in either \p *this or \p other remain unset.
73 @param other Logging_Bits
75 void merge ( const Logging_Bits & other );
77 /** @brief Return a string corresponding to the bits set in this object.
79 @return an \c expstring_t containing a textual description.
80 The caller is responsible for calling Free().
81 The returned string is suitable for use in the Titan config file.
84 expstring_t describe() const;