1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
12 ******************************************************************************/
19 /** @brief Collection of logging severities to log.
21 Each log severity which had a corresponding bit in an integer,
22 now has a boolean in an array.
24 @note This class must be a POD type. Because it will be a member of a union,
25 it must not have a constructor or a copy assignment operator.
26 The compiler-generated copy constructor and assignment
27 are fine for this class.
29 \b Warning! This class has no default constructor. An expression like @code
30 Logging_Bits x; @endcode will result in \c x being \b uninitialised.
31 To avoid surprises, initialise Logging_Bits objects as an aggregate: @code
32 Logging_Bits d = { 0,0,........,0 }; @endcode or copy-initialise from
33 one of the predefined constants e.g. @code
34 Logging_Bits d = Logging_Bits::log_nothing; @endcode or call Logging_Bits::clear()
35 immediately after constructing.
40 bool bits[TTCN_Logger::NUMBER_OF_LOGSEVERITIES];
42 static const Logging_Bits log_nothing;
43 static const Logging_Bits log_all;
44 static const Logging_Bits log_everything;
45 static const Logging_Bits default_console_mask;
47 bool operator ==( const Logging_Bits& other ) const;
48 bool operator !=( const Logging_Bits& other ) const
50 return ! operator==( other );
53 /** @brief Sets all bits to false.
55 @post *this == Logging_Bits::log_nothing
59 /** @brief Sets one bit corresponding to a TTCN_Logger::Severity.
63 @pre \p sev < TTCN_Logger::NUMBER_OF_LOGSEVERITIES
64 @param sev log severity
65 @post bits[sev] is true
67 @note All other bits remain unchanged. To have set \b only the specified bit,
70 void add_sev ( TTCN_Logger::Severity sev );
72 /** @brief Merge two Logging_Bits objects
74 Bits which are set in \p sev will become set in \p *this. \n
75 Bits which were already set in \p *this remain unchanged. \n
76 Bits which weren't set in either \p *this or \p other remain unset.
78 @param other Logging_Bits
80 void merge ( const Logging_Bits & other );
82 /** @brief Return a string corresponding to the bits set in this object.
84 @return an \c expstring_t containing a textual description.
85 The caller is responsible for calling Free().
86 The returned string is suitable for use in the Titan config file.
89 expstring_t describe() const;