cprover
flag_resett Class Reference

Allows to: More...

+ Collaboration diagram for flag_resett:

Public Member Functions

 flag_resett (const goto_programt::instructiont &_instruction)
 
void set_flag (bool &flag, bool new_value, const irep_idt &flag_name)
 Store the current value of flag and then set its value to new_value. More...
 
void disable_flag (bool &flag, const irep_idt &flag_name)
 Sets the given flag to false, overriding any previous value. More...
 
 ~flag_resett ()
 Restore the values of all flags that have been modified via set_flag. More...
 

Private Attributes

const goto_programt::instructiontinstruction
 
std::map< bool *, bool > flags_to_reset
 
std::set< bool * > disabled_flags
 

Detailed Description

Allows to:

  • override a Boolean flag with a new value via set_flag
  • set a Boolean flag to false via disable_flag, such that previous set_flag are overridden and future set_flag are ignored.

A flag's initial value (before any set_flag or disable_flag) is restored when the entire object goes out of scope.

Definition at line 1940 of file goto_check_c.cpp.

Constructor & Destructor Documentation

◆ flag_resett()

flag_resett::flag_resett ( const goto_programt::instructiont _instruction)
inlineexplicit

Definition at line 1943 of file goto_check_c.cpp.

◆ ~flag_resett()

flag_resett::~flag_resett ( )
inline

Restore the values of all flags that have been modified via set_flag.

Definition at line 1997 of file goto_check_c.cpp.

Member Function Documentation

◆ disable_flag()

void flag_resett::disable_flag ( bool &  flag,
const irep_idt flag_name 
)
inline

Sets the given flag to false, overriding any previous value.

  • calling disable_flag after set_flag overrides the set value
  • calling disable_flag twice triggers an INVARIANT

Definition at line 1975 of file goto_check_c.cpp.

◆ set_flag()

void flag_resett::set_flag ( bool &  flag,
bool  new_value,
const irep_idt flag_name 
)
inline

Store the current value of flag and then set its value to new_value.

  • calling set_flag after disable_flag is a no-op
  • calling set_flag twice triggers an INVARIANT

Definition at line 1953 of file goto_check_c.cpp.

Member Data Documentation

◆ disabled_flags

std::set<bool *> flag_resett::disabled_flags
private

Definition at line 2006 of file goto_check_c.cpp.

◆ flags_to_reset

std::map<bool *, bool> flag_resett::flags_to_reset
private

Definition at line 2005 of file goto_check_c.cpp.

◆ instruction

const goto_programt::instructiont& flag_resett::instruction
private

Definition at line 2004 of file goto_check_c.cpp.


The documentation for this class was generated from the following file: