CBMC
flag_overridet Class Reference

Allows to: More...

+ Collaboration diagram for flag_overridet:

Public Member Functions

 flag_overridet (const source_locationt &source_location)
 
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_overridet ()
 Restore the values of all flags that have been modified via set_flag. More...
 

Private Attributes

const source_locationtsource_location
 
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 350 of file goto_check_c.cpp.

Constructor & Destructor Documentation

◆ flag_overridet()

flag_overridet::flag_overridet ( const source_locationt source_location)
inlineexplicit

Definition at line 353 of file goto_check_c.cpp.

◆ ~flag_overridet()

flag_overridet::~flag_overridet ( )
inline

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

Definition at line 407 of file goto_check_c.cpp.

Member Function Documentation

◆ disable_flag()

void flag_overridet::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 385 of file goto_check_c.cpp.

◆ set_flag()

void flag_overridet::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 363 of file goto_check_c.cpp.

Member Data Documentation

◆ disabled_flags

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

Definition at line 416 of file goto_check_c.cpp.

◆ flags_to_reset

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

Definition at line 415 of file goto_check_c.cpp.

◆ source_location

const source_locationt& flag_overridet::source_location
private

Definition at line 414 of file goto_check_c.cpp.


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