Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JValve< T > Class Template Reference

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

#include <JValve.hh>

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

Public Member Functions

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

Static Public Member Functions

static const T & getDefault ()
 Get default value of template class.
 

Protected Attributes

bool status
 

Static Private Attributes

static const T value
 

Detailed Description

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

Auxiliary class for selection of data type.

Definition at line 21 of file JValve.hh.

Constructor & Destructor Documentation

◆ JValve() [1/2]

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

◆ JValve() [2/2]

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

◆ is_open()

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 }

◆ open()

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

Open valve.

Definition at line 61 of file JValve.hh.

62 {
63 status = true;
64 }

◆ close()

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

Close valve.

Definition at line 70 of file JValve.hh.

71 {
72 status = false;
73 }

◆ operator()()

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 }
void open()
Open valve.
Definition JValve.hh:61
void close()
Close valve.
Definition JValve.hh:70

◆ getDefault()

static const T & JLANG::JDefault< T >::getDefault ( )
inlinestaticinherited

Get default value of template class.

Returns
value

Definition at line 24 of file JDefault.hh.

25 {
26 return value;
27 }

Member Data Documentation

◆ status

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

Definition at line 99 of file JValve.hh.

◆ value

const T JLANG::JDefault< T >::value
staticprivateinherited

Definition at line 30 of file JDefault.hh.


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