Jpp  18.0.1-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
JLANG::JTemplate< JType_t > Struct Template Reference

Auxiliary class for managing multiple objects. More...

#include <JTemplate.hh>

Inheritance diagram for JLANG::JTemplate< JType_t >:
JSUPPORT::JTreeSampler< T, JSampler_t >

Public Types

typedef JTemplate< JType_t > template_type
 

Public Member Functions

 JTemplate ()
 Default constructor. More...
 
 JTemplate (const JType_t &value)
 Constructor. More...
 
 operator const JType_t & () const
 Type conversion. More...
 
 operator JType_t & ()
 Type conversion. More...
 
const JType_t * operator-> () const
 Smart pointer operator. More...
 
JType_t * operator-> ()
 Smart pointer operator. More...
 
template<class T , bool use_polymorphism = false>
const Tget () const
 Get reference to object. More...
 
template<class T , bool use_polymorphism = false>
Tget ()
 Get reference to object. More...
 
template_typeset (const JType_t &value)
 Set value. More...
 
template<bool use_polymorphism, class T >
template_typeset (const T &value)
 Set value. More...
 

Protected Member Functions

const JType_t & c_get (JBool< true > option) const
 Get reference to object. More...
 
JType_t & c_get (JBool< true > option)
 Get reference to object. More...
 
template<class T >
template_typec_set (const T &value, JBool< true > option)
 Set value. More...
 

Protected Attributes

JType_t object
 object More...
 

Friends

std::istream & operator>> (std::istream &in, JTemplate< JType_t > &object)
 Read object from input. More...
 
std::ostream & operator<< (std::ostream &out, const JTemplate< JType_t > &object)
 Write object to output. More...
 

Detailed Description

template<class JType_t>
struct JLANG::JTemplate< JType_t >

Auxiliary class for managing multiple objects.

This class can be used to replace regular base classes by corresponding data members. The various operators and methods facilitate the access to these data members.

The template value use_polymorfism in methods get and set applies to the given template parameter of these methods. If false, only exact type matches are allowed. If true, method get will return a reference to the first data member of which the type derives from the specified class and method set will assign the given value to the first data member for which a matching constructor exists.

Definition at line 40 of file JTemplate.hh.

Member Typedef Documentation

template<class JType_t>
typedef JTemplate<JType_t> JLANG::JTemplate< JType_t >::template_type

Definition at line 42 of file JTemplate.hh.

Constructor & Destructor Documentation

template<class JType_t>
JLANG::JTemplate< JType_t >::JTemplate ( )
inline

Default constructor.

Definition at line 48 of file JTemplate.hh.

48  :
49  object()
50  {}
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
JLANG::JTemplate< JType_t >::JTemplate ( const JType_t &  value)
inline

Constructor.

Parameters
valuevalue

Definition at line 58 of file JTemplate.hh.

58  :
59  object(value)
60  {}
JType_t object
object
Definition: JTemplate.hh:222

Member Function Documentation

template<class JType_t>
JLANG::JTemplate< JType_t >::operator const JType_t & ( ) const
inline

Type conversion.

Returns
reference to object

Definition at line 68 of file JTemplate.hh.

69  {
70  return object;
71  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
JLANG::JTemplate< JType_t >::operator JType_t & ( )
inline

Type conversion.

Returns
reference to object

Definition at line 79 of file JTemplate.hh.

80  {
81  return object;
82  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
const JType_t* JLANG::JTemplate< JType_t >::operator-> ( ) const
inline

Smart pointer operator.

Returns
pointer to object

Definition at line 90 of file JTemplate.hh.

91  {
92  return &object;
93  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
JType_t* JLANG::JTemplate< JType_t >::operator-> ( )
inline

Smart pointer operator.

Returns
pointer to object

Definition at line 101 of file JTemplate.hh.

102  {
103  return &object;
104  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
template<class T , bool use_polymorphism = false>
const T& JLANG::JTemplate< JType_t >::get ( ) const
inline

Get reference to object.

Returns
reference to object

Definition at line 113 of file JTemplate.hh.

114  {
116  }
const JType_t & c_get(JBool< true > option) const
Get reference to object.
Definition: JTemplate.hh:188
Auxiliary template class for type bool.
Definition: JBool.hh:20
Template class test for polymorphism.
Definition: JConversion.hh:22
template<class JType_t>
template<class T , bool use_polymorphism = false>
T& JLANG::JTemplate< JType_t >::get ( )
inline

Get reference to object.

Returns
reference to object

Definition at line 125 of file JTemplate.hh.

126  {
128  }
const JType_t & c_get(JBool< true > option) const
Get reference to object.
Definition: JTemplate.hh:188
Auxiliary template class for type bool.
Definition: JBool.hh:20
Template class test for polymorphism.
Definition: JConversion.hh:22
template<class JType_t>
template_type& JLANG::JTemplate< JType_t >::set ( const JType_t &  value)
inline

Set value.

Parameters
valuevalue
Returns
this object

Definition at line 137 of file JTemplate.hh.

138  {
139  return c_set(value, JBool<true>());
140  }
template_type & c_set(const T &value, JBool< true > option)
Set value.
Definition: JTemplate.hh:214
Auxiliary template class for type bool.
Definition: JBool.hh:20
template<class JType_t>
template<bool use_polymorphism, class T >
template_type& JLANG::JTemplate< JType_t >::set ( const T value)
inline

Set value.

Parameters
valuevalue
Returns
this object

Definition at line 150 of file JTemplate.hh.

151  {
153  }
template_type & c_set(const T &value, JBool< true > option)
Set value.
Definition: JTemplate.hh:214
Auxiliary template class for type bool.
Definition: JBool.hh:20
Template class test for polymorphism.
Definition: JConversion.hh:22
Template class test for availability of a suitable constructor JType_t(const JArgument_t).
Definition: JConstructor.hh:19
template<class JType_t>
const JType_t& JLANG::JTemplate< JType_t >::c_get ( JBool< true >  option) const
inlineprotected

Get reference to object.

Parameters
optiontrue
Returns
reference to object

Definition at line 188 of file JTemplate.hh.

189  {
190  return object;
191  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
JType_t& JLANG::JTemplate< JType_t >::c_get ( JBool< true >  option)
inlineprotected

Get reference to object.

Parameters
optiontrue
Returns
reference to object

Definition at line 200 of file JTemplate.hh.

201  {
202  return object;
203  }
JType_t object
object
Definition: JTemplate.hh:222
template<class JType_t>
template<class T >
template_type& JLANG::JTemplate< JType_t >::c_set ( const T value,
JBool< true >  option 
)
inlineprotected

Set value.

Parameters
valuevalue
optiontrue
Returns
this object

Definition at line 214 of file JTemplate.hh.

215  {
216  object = value;
217 
218  return *this;
219  }

Friends And Related Function Documentation

template<class JType_t>
std::istream& operator>> ( std::istream &  in,
JTemplate< JType_t > &  object 
)
friend

Read object from input.

Parameters
ininput stream
objectobject
Returns
input stream

Definition at line 163 of file JTemplate.hh.

164  {
165  return in >> object.object;
166  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
template<class JType_t>
std::ostream& operator<< ( std::ostream &  out,
const JTemplate< JType_t > &  object 
)
friend

Write object to output.

Parameters
outoutput stream
objectobject
Returns
output stream

Definition at line 176 of file JTemplate.hh.

177  {
178  return out << object.object;
179  }

Member Data Documentation

template<class JType_t>
JType_t JLANG::JTemplate< JType_t >::object
protected

object

Definition at line 222 of file JTemplate.hh.


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