LifeV
Switch Class Reference

I use standard constructor/destructors. More...

#include <Switch.hpp>

+ Inheritance diagram for Switch:
+ Collaboration diagram for Switch:

Public typedefs

typedef std::map< std::string, bool >::iterator iterator_Type
 
typedef std::map< std::string, bool >::const_iterator iteratorConst_Type
 

Public methods

bool set (std::string const &a)
 It sets the switch It does NOT create a new switch (use create); Returns true if the switch s existed. More...
 
bool set (const char *a)
 
bool unset (std::string const &a)
 It unsets the switch. More...
 
bool unset (const char *a)
 
bool toggle (std::string const &a)
 It toggles the switch Returns true if the switch s existed. More...
 
bool toggle (const char *a)
 
void create (std::string const &a, bool status=false)
 Creates a switch (default is OFF) It sets the switch if it is there. More...
 
void create (const char *a, bool status=false)
 
std::ostream & showMe (bool verbose=false, std::ostream &out=std::cout) const
 
bool test (std::string const &a) const
 
bool test (const char *a) const
 
std::pair< bool, bool > status (std::string const &a) const
 
std::pair< bool, bool > status (const char *a) const
 

Detailed Description

I use standard constructor/destructors.

A better Switches class

Definition at line 50 of file Switch.hpp.

Member Typedef Documentation

◆ iterator_Type

typedef std::map<std::string, bool>::iterator iterator_Type

Definition at line 56 of file Switch.hpp.

◆ iteratorConst_Type

typedef std::map<std::string, bool>::const_iterator iteratorConst_Type

Definition at line 57 of file Switch.hpp.

Member Function Documentation

◆ set() [1/2]

bool set ( std::string const &  a)

It sets the switch It does NOT create a new switch (use create); Returns true if the switch s existed.

Definition at line 46 of file Switch.cpp.

◆ set() [2/2]

bool set ( const char *  a)

Definition at line 61 of file Switch.cpp.

◆ unset() [1/2]

bool unset ( std::string const &  a)

It unsets the switch.

It does NOT create a new switch (use create) Returns true if the switch s existed

Definition at line 68 of file Switch.cpp.

◆ unset() [2/2]

bool unset ( const char *  a)

Definition at line 83 of file Switch.cpp.

◆ toggle() [1/2]

bool toggle ( std::string const &  a)

It toggles the switch Returns true if the switch s existed.

Definition at line 90 of file Switch.cpp.

◆ toggle() [2/2]

bool toggle ( const char *  a)

Definition at line 105 of file Switch.cpp.

◆ create() [1/2]

void create ( std::string const &  a,
bool  status = false 
)

Creates a switch (default is OFF) It sets the switch if it is there.

Definition at line 112 of file Switch.cpp.

◆ create() [2/2]

void create ( const char *  a,
bool  status = false 
)

Definition at line 126 of file Switch.cpp.

+ Here is the caller graph for this function:

◆ showMe()

std::ostream & showMe ( bool  verbose = false,
std::ostream &  out = std::cout 
) const

Definition at line 174 of file Switch.cpp.

+ Here is the caller graph for this function:

◆ test() [1/2]

bool test ( std::string const &  a) const

Returns the status of the switch: true-> set false-> unset or non existent. It does not distinguish between not existent and unset switches: use status if you want the full information

Definition at line 155 of file Switch.cpp.

◆ test() [2/2]

bool test ( const char *  a) const

Definition at line 168 of file Switch.cpp.

+ Here is the caller graph for this function:

◆ status() [1/2]

std::pair< bool, bool > status ( std::string const &  a) const

Returns a std::pair of bools : the first refers to the existence in the list of switches, the second on the status (true or false) If the first bool is false also the second is false

Definition at line 133 of file Switch.cpp.

◆ status() [2/2]

std::pair< bool, bool > status ( const char *  a) const

Definition at line 147 of file Switch.cpp.


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