PPL  0.12.1
Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag > Class Template Reference

A kind of Handler that installs a flag onto a flag-holder. More...

#include <Handler.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >:
Collaboration diagram for Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >:

List of all members.

Public Member Functions

 Handler_Flag (const Flag_Base *volatile &holder, Flag &flag)
 Constructor with a given function.
virtual void act () const
 Does its job: installs the flag onto the holder, if a flag with an higher priority has not already been installed.

Private Attributes

const Flag_Base *volatile & h
Flag & f

Detailed Description

template<typename Flag_Base, typename Flag>
class Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >

A kind of Handler that installs a flag onto a flag-holder.

The template class Handler_Flag<Flag_Base, Flag> is an handler whose job is to install a flag onto an holder for the flag. The flag is of type Flag and the holder is a (volatile) pointer to Flag_Base. Installing the flag onto the holder means making the holder point to the flag, so that it must be possible to assign a value of type Flag* to an entity of type Flag_Base*. The class Flag must provide the method

    int priority() const

returning an integer priority associated to the flag.

The handler will install its flag onto the holder only if the holder is empty, namely, it is the null pointer, or if the holder holds a flag of strictly lower priority.

Definition at line 60 of file Handler.defs.hh.


Constructor & Destructor Documentation

template<typename Flag_Base , typename Flag >
Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >::Handler_Flag ( const Flag_Base *volatile &  holder,
Flag &  flag 
)

Constructor with a given function.

Definition at line 38 of file Handler.inlines.hh.

  : h(holder), f(flag) {
}

Member Function Documentation

template<typename Flag_Base , typename Flag >
void Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >::act ( ) const
virtual

Does its job: installs the flag onto the holder, if a flag with an higher priority has not already been installed.

Implements Parma_Polyhedra_Library::Implementation::Watchdog::Handler.

Definition at line 45 of file Handler.inlines.hh.

                                         {
  if (h == 0 || static_cast<const Flag&>(*h).priority() < f.priority())
    h = &f;
}

Member Data Documentation

template<typename Flag_Base , typename Flag >
Flag& Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >::f
private

Definition at line 75 of file Handler.defs.hh.

template<typename Flag_Base , typename Flag >
const Flag_Base* volatile& Parma_Polyhedra_Library::Implementation::Watchdog::Handler_Flag< Flag_Base, Flag >::h
private

Definition at line 74 of file Handler.defs.hh.


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