Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
JLANG::JValve< T > Class Template Reference

Auxiliary class for selection of data type. More...

#include <JObjectIterator.hh>

Inheritance diagram for JLANG::JValve< T >:
JLANG::JDefault< JValve< T > >

Public Member Functions

 JValve ()
 Default constructor. More...
 
template<class JController_t >
 JValve (const JController_t &controller)
 Constructor. More...
 
bool is_open () const
 Check if valve is open. More...
 
void open ()
 Open valve. More...
 
void close ()
 Close valve. More...
 
template<class JController_t >
JValveoperator() (const JController_t &controller)
 Set valve. More...
 

Static Public Member Functions

static const JValve< T > & getDefault ()
 Get default value of template class. More...
 

Protected Attributes

bool status
 

Detailed Description

template<class T>
class JLANG::JValve< T >

Auxiliary class for selection of data type.

Definition at line 34 of file JObjectIterator.hh.

Constructor & Destructor Documentation

template<class T>
JLANG::JValve< T >::JValve ( )
inline

Default constructor.

By default, the valve is open.

Definition at line 30 of file JValve.hh.

30  :
31  status(true)
32  {}
bool status
Definition: JValve.hh:99
template<class T>
template<class JController_t >
JLANG::JValve< T >::JValve ( const JController_t &  controller)
inline

Constructor.

Parameters
controllercontroller of valve

Definition at line 41 of file JValve.hh.

42  {
43  (*this)(controller);
44  }

Member Function Documentation

template<class T>
bool JLANG::JValve< T >::is_open ( ) const
inline

Check if valve is open.

Returns
true if open; else false

Definition at line 52 of file JValve.hh.

53  {
54  return status;
55  }
bool status
Definition: JValve.hh:99
template<class T>
void JLANG::JValve< T >::open ( )
inline

Open valve.

Definition at line 61 of file JValve.hh.

62  {
63  status = true;
64  }
bool status
Definition: JValve.hh:99
template<class T>
void JLANG::JValve< T >::close ( )
inline

Close valve.

Definition at line 70 of file JValve.hh.

71  {
72  status = false;
73  }
bool status
Definition: JValve.hh:99
template<class T>
template<class JController_t >
JValve& JLANG::JValve< T >::operator() ( const JController_t &  controller)
inline

Set valve.

The template argument JController_t refers to a data structure which should provide for the function object operator:

  bool operator()(JType<T>& type) const;    // get status of valve
Parameters
controllercontroller of valve

Definition at line 88 of file JValve.hh.

89  {
90  if (controller(JType<T>()))
91  this->open();
92  else
93  this->close();
94 
95  return *this;
96  }
Auxiliary class for a type holder.
Definition: JType.hh:19
void close()
Close valve.
Definition: JValve.hh:70
void open()
Open valve.
Definition: JValve.hh:61
static const JValve< T > & JLANG::JDefault< JValve< T > >::getDefault ( )
inlinestaticinherited

Get default value of template class.

Returns
value

Definition at line 24 of file JDefault.hh.

25  {
26  return value;
27  }
static const JValve< T > value
Definition: JDefault.hh:30

Member Data Documentation

template<class T>
bool JLANG::JValve< T >::status
protected

Definition at line 99 of file JValve.hh.


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