Jpp  16.0.0
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 > Struct 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>
struct 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 29 of file JValve.hh.

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

Constructor.

Parameters
controllercontroller of valve

Definition at line 40 of file JValve.hh.

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

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 51 of file JValve.hh.

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

Open valve.

Definition at line 60 of file JValve.hh.

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

Close valve.

Definition at line 69 of file JValve.hh.

70  {
71  status = false;
72  }
bool status
Definition: JValve.hh:98
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 87 of file JValve.hh.

88  {
89  if (controller(JType<T>()))
90  this->open();
91  else
92  this->close();
93 
94  return *this;
95  }
Auxiliary class for a type holder.
Definition: JType.hh:19
void close()
Close valve.
Definition: JValve.hh:69
void open()
Open valve.
Definition: JValve.hh:60
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 98 of file JValve.hh.


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