IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
SetCheckState.h
Go to the documentation of this file.
1
/**
2
* \file IMP/base/SetCheckState.h
3
* \brief Checkging and error reporting support.
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPBASE_SET_CHECK_STATE_H
10
#define IMPBASE_SET_CHECK_STATE_H
11
12
#include <IMP/base/base_config.h>
13
#include "
enums.h
"
14
#include "
raii_macros.h
"
15
#include "
value_macros.h
"
16
#include <
IMP/base/nullptr.h
>
17
18
IMPBASE_BEGIN_NAMESPACE
19
class
Object;
20
21
//! A class to change and restore check state
22
/**
23
To use, create an instance of this class with the check level you
24
want. When it goes out of scope, it will restore the old level.
25
26
\note This will not keep objects alive, make sure there is also some
27
other ref-counted pointer to them.
28
29
\ingroup checking
30
*/
31
class
IMPBASEEXPORT
SetCheckState
:
public
base::RAII
32
{
33
CheckLevel
level_;
34
Object
* obj_;
35
void
do_set(
Object
*o,
CheckLevel
l);
36
void
do_reset();
37
void
do_show(std::ostream &out)
const
;
38
public
:
39
IMP_RAII
(
SetCheckState
, (
Object
*o,
CheckLevel
l),
40
{level_=
DEFAULT_CHECK
; obj_=
nullptr
;},
41
{
42
do_set(o, l);
43
},
44
{
45
do_reset();
46
}, do_show(out););
47
48
//! Construct it with the desired level and target
49
SetCheckState
(
CheckLevel
l){
50
obj_=
nullptr
;
51
level_=
DEFAULT_CHECK
;
52
set
(l);
53
}
54
void
set
(
CheckLevel
l);
55
};
56
57
58
IMP_VALUES
(
SetCheckState
,
SetCheckStates
);
59
60
IMPBASE_END_NAMESPACE
61
62
#endif
/* IMPBASE_SET_CHECK_STATE_H */