Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JMultiKey< 1, JKey_t > Class Template Reference

One-dimensional key. More...

#include <JMultiKey.hh>

Inheritance diagram for JTOOLS::JMultiKey< 1, JKey_t >:
JLANG::JComparable< JFirst_t, JSecond_t >

Public Types

typedef JKey_t key_type
 
typedef JMultiKey< 0, JKey_t > mapped_type
 

Public Member Functions

 JMultiKey ()
 Default constructor.
 
 JMultiKey (typename JClass< mapped_type >::argument_type __first, typename JClass< key_type > ::argument_type __second)
 Constructor.
 
 JMultiKey (typename JClass< key_type > ::argument_type __first, typename JClass< mapped_type >::argument_type __second)
 Constructor.
 
 JMultiKey (typename JClass< key_type >::argument_type __first)
 Constructor.
 
 JMultiKey (typename JArgument< 1, JKey_t >::argument_type key)
 Copy constructor.
 
bool less (const JMultiKey< 1, JKey_t > &key) const
 Less than method.
 
double getLengthSquared () const
 Get length squared.
 
double getLength () const
 Get length.
 
key_type back () const
 Get backend key.
 

Public Attributes

key_type first
 

Friends

std::istream & operator>> (std::istream &in, JMultiKey< 1, JKey_t > &key)
 Read key from input.
 
std::ostream & operator<< (std::ostream &out, const JMultiKey< 1, JKey_t > &key)
 Write key to output.
 

Detailed Description

template<class JKey_t>
class JTOOLS::JMultiKey< 1, JKey_t >

One-dimensional key.

Definition at line 374 of file JMultiKey.hh.

Member Typedef Documentation

◆ key_type

template<class JKey_t >
JKey_t JTOOLS::JMultiKey< 1, JKey_t >::key_type

Definition at line 379 of file JMultiKey.hh.

◆ mapped_type

template<class JKey_t >
JMultiKey<0, JKey_t> JTOOLS::JMultiKey< 1, JKey_t >::mapped_type

Definition at line 380 of file JMultiKey.hh.

Constructor & Destructor Documentation

◆ JMultiKey() [1/5]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( )
inline

Default constructor.

Definition at line 386 of file JMultiKey.hh.

386 :
387 first()
388 {}

◆ JMultiKey() [2/5]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( typename JClass< mapped_type >::argument_type __first,
typename JClass< key_type > ::argument_type __second )
inline

Constructor.

The secondary key is appended to the end of the primary key.

Parameters
__firstprimary key
__secondsecondary key

Definition at line 398 of file JMultiKey.hh.

399 :
400 first(__second)
401 {}

◆ JMultiKey() [3/5]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( typename JClass< key_type > ::argument_type __first,
typename JClass< mapped_type >::argument_type __second )
inline

Constructor.

The primary key is inserted at the start of the secondary key.

Parameters
__firstprimary key
__secondsecondary key

Definition at line 411 of file JMultiKey.hh.

412 :
413 first(__first)
414 {}

◆ JMultiKey() [4/5]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( typename JClass< key_type >::argument_type __first)
inline

Constructor.

Parameters
__firstkey

Definition at line 422 of file JMultiKey.hh.

422 :
423 first(__first)
424 {}

◆ JMultiKey() [5/5]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( typename JArgument< 1, JKey_t >::argument_type key)
inline

Copy constructor.

Parameters
keykey

Definition at line 432 of file JMultiKey.hh.

432 :
433 first(key.first)
434 {}

Member Function Documentation

◆ less()

template<class JKey_t >
bool JTOOLS::JMultiKey< 1, JKey_t >::less ( const JMultiKey< 1, JKey_t > & key) const
inline

Less than method.

Parameters
keykey
Returns
true if this key less than given key; else false

Definition at line 443 of file JMultiKey.hh.

444 {
445 return this->first < key.first;
446 }

◆ getLengthSquared()

template<class JKey_t >
double JTOOLS::JMultiKey< 1, JKey_t >::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 454 of file JMultiKey.hh.

455 {
456 return this->first*this->first;
457 }

◆ getLength()

template<class JKey_t >
double JTOOLS::JMultiKey< 1, JKey_t >::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 465 of file JMultiKey.hh.

466 {
467 return sqrt(this->getLengthSquared());
468 }
double getLengthSquared() const
Get length squared.
Definition JMultiKey.hh:454

◆ back()

template<class JKey_t >
key_type JTOOLS::JMultiKey< 1, JKey_t >::back ( ) const
inline

Get backend key.

Returns
backend key

Definition at line 476 of file JMultiKey.hh.

477 {
478 return this->first;
479 }

Friends And Related Symbol Documentation

◆ operator>>

template<class JKey_t >
std::istream & operator>> ( std::istream & in,
JMultiKey< 1, JKey_t > & key )
friend

Read key from input.

Parameters
ininput stream
keykey
Returns
input stream

Definition at line 489 of file JMultiKey.hh.

490 {
491 in >> key.first;
492
493 return in;
494 }

◆ operator<<

template<class JKey_t >
std::ostream & operator<< ( std::ostream & out,
const JMultiKey< 1, JKey_t > & key )
friend

Write key to output.

Parameters
outoutput stream
keykey
Returns
output stream

Definition at line 504 of file JMultiKey.hh.

505 {
506 const JFormat format(out, getFormat< JMultiKey<1, JKey_t> >(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
507
508 out << format << key.first;
509
510 return out;
511 }
JFormat_t & getFormat()
Get format for given type.
Definition JManip.hh:682
Data structure for format specifications.
Definition JManip.hh:524
Auxiliary class to temporarily define format specifications.
Definition JManip.hh:636

Member Data Documentation

◆ first

template<class JKey_t >
key_type JTOOLS::JMultiKey< 1, JKey_t >::first

Definition at line 514 of file JMultiKey.hh.


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