Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
JTOOLS::JTuple< T > Struct Template Reference

Template data structure. More...

#include <JTuple.hh>

Inheritance diagram for JTOOLS::JTuple< T >:
JMATH::JMath< JFirst_t, JSecond_t > JLANG::JComparable< JFirst_t, JSecond_t >

Public Types

typedef JTypeList< T > typelist
 

Public Member Functions

 JTuple ()
 Default constructor. More...
 
 JTuple (typename JClass< T >::argument_type __first)
 Constructor. More...
 
JTuplenegate ()
 Negate tuple. More...
 
JTupleadd (const JTuple &tuple)
 Add tuple. More...
 
JTuplesub (const JTuple &tuple)
 Subtract tuple. More...
 
JTuplemul (const double factor)
 Scale tuple. More...
 
JTuplediv (const double factor)
 Scale tuple. More...
 
bool less (const JTuple &tuple) const
 Compare tuple. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Public Attributes

first
 

Friends

std::istream & operator>> (std::istream &in, JTuple &tuple)
 Read tuple from input. More...
 
std::ostream & operator<< (std::ostream &out, const JTuple &tuple)
 Write tuple to output. More...
 
JReaderoperator>> (JReader &in, JTuple &tuple)
 Read tuple from input. More...
 
JWriteroperator<< (JWriter &out, const JTuple &tuple)
 Write tuple to output. More...
 

Detailed Description

template<class T>
struct JTOOLS::JTuple< T >

Template data structure.

Definition at line 44 of file JTuple.hh.

Member Typedef Documentation

◆ typelist

template<class T >
typedef JTypeList<T> JTOOLS::JTuple< T >::typelist

Definition at line 49 of file JTuple.hh.

Constructor & Destructor Documentation

◆ JTuple() [1/2]

template<class T >
JTOOLS::JTuple< T >::JTuple ( )
inline

Default constructor.

Definition at line 54 of file JTuple.hh.

55  {}

◆ JTuple() [2/2]

template<class T >
JTOOLS::JTuple< T >::JTuple ( typename JClass< T >::argument_type  __first)
inline

Constructor.

Parameters
__firstfirst

Definition at line 63 of file JTuple.hh.

63  :
64  first(__first)
65  {}

Member Function Documentation

◆ negate()

template<class T >
JTuple& JTOOLS::JTuple< T >::negate ( )
inline

Negate tuple.

Returns
this tuple

Definition at line 73 of file JTuple.hh.

74  {
75  first = -first;
76 
77  return *this;
78  }

◆ add()

template<class T >
JTuple& JTOOLS::JTuple< T >::add ( const JTuple< T > &  tuple)
inline

Add tuple.

Parameters
tupletuple
Returns
this tuple

Definition at line 87 of file JTuple.hh.

88  {
89  first += tuple.first;
90 
91  return *this;
92  }

◆ sub()

template<class T >
JTuple& JTOOLS::JTuple< T >::sub ( const JTuple< T > &  tuple)
inline

Subtract tuple.

Parameters
tupletuple
Returns
this tuple

Definition at line 101 of file JTuple.hh.

102  {
103  first -= tuple.first;
104 
105  return *this;
106  }

◆ mul() [1/2]

template<class T >
JTuple& JTOOLS::JTuple< T >::mul ( const double  factor)
inline

Scale tuple.

Parameters
factormultiplication factor
Returns
this tuple

Definition at line 115 of file JTuple.hh.

116  {
117  first *= factor;
118 
119  return *this;
120  }

◆ div()

template<class T >
JTuple& JTOOLS::JTuple< T >::div ( const double  factor)
inline

Scale tuple.

Parameters
factordivision factor
Returns
this tuple

Definition at line 129 of file JTuple.hh.

130  {
131  first /= factor;
132 
133  return *this;
134  }

◆ less()

template<class T >
bool JTOOLS::JTuple< T >::less ( const JTuple< T > &  tuple) const
inline

Compare tuple.

Parameters
tupletuple
Returns
true if this tuple less than given tuple; else false

Definition at line 143 of file JTuple.hh.

144  {
145  return first < tuple.first;
146  }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

Friends And Related Function Documentation

◆ operator>> [1/2]

template<class T >
std::istream& operator>> ( std::istream &  in,
JTuple< T > &  tuple 
)
friend

Read tuple from input.

Parameters
ininput stream
tupletuple
Returns
input stream

Definition at line 156 of file JTuple.hh.

157  {
158  return in >> tuple.first;
159  }

◆ operator<< [1/2]

template<class T >
std::ostream& operator<< ( std::ostream &  out,
const JTuple< T > &  tuple 
)
friend

Write tuple to output.

Parameters
outoutput stream
tupletuple
Returns
output stream

Definition at line 169 of file JTuple.hh.

170  {
171  return out << tuple.first;
172  }

◆ operator>> [2/2]

template<class T >
JReader& operator>> ( JReader in,
JTuple< T > &  tuple 
)
friend

Read tuple from input.

Parameters
inreader
tupletuple
Returns
reader

Definition at line 182 of file JTuple.hh.

183  {
184  return in >> tuple.first;
185  }

◆ operator<< [2/2]

template<class T >
JWriter& operator<< ( JWriter out,
const JTuple< T > &  tuple 
)
friend

Write tuple to output.

Parameters
outwriter
tupletuple
Returns
writer

Definition at line 195 of file JTuple.hh.

196  {
197  return out << tuple.first;
198  }

Member Data Documentation

◆ first

template<class T >
T JTOOLS::JTuple< T >::first

Definition at line 201 of file JTuple.hh.


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