Jpp 21.0.0-rc.1
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, key_typemapped_type
 
typedef std::array< key_type, 1 > array_type
 
typedef std::conditional< std::is_const< key_type >::value, typenamestd::remove_const< key_type >::type, typenamestd::add_const< key_type >::type >::type U
 

Public Member Functions

 JMultiKey ()
 Default constructor.
 
 JMultiKey (typename JClass< mapped_type >::argument_type first, typename JClass< key_type > ::argument_type second)
 Append onstructor.
 
 JMultiKey (typename JClass< key_type > ::argument_type first, typename JClass< mapped_type >::argument_type second)
 Insert constructor.
 
 JMultiKey (const JMultiKey &first, typename JClass< key_type >::argument_type second)
 Shift constructor.
 
 JMultiKey (typename JClass< key_type >::argument_type first)
 Constructor.
 
 JMultiKey (const JMultiKey< 1, U > &key)
 Copy constructor.
 
 JMultiKey (const std::array< key_type, 1 > &array)
 Copy constructor.
 
 operator array_type () const
 Type conversion operator.
 
bool less (const JMultiKey &key) const
 Less than method.
 
key_type back () const
 Get backend key.
 

Public Attributes

key_type first
 

Friends

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

Detailed Description

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

One-dimensional key.

Definition at line 253 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 258 of file JMultiKey.hh.

◆ mapped_type

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

Definition at line 259 of file JMultiKey.hh.

◆ array_type

template<class JKey_t >
std::array<key_type, 1> JTOOLS::JMultiKey< 1, JKey_t >::array_type

Definition at line 260 of file JMultiKey.hh.

◆ U

template<class JKey_t >
std::conditional<std::is_const<key_type>::value,typenamestd::remove_const<key_type>::type,typenamestd::add_const<key_type>::type>::type JTOOLS::JMultiKey< 1, JKey_t >::U

Definition at line 264 of file JMultiKey.hh.

Constructor & Destructor Documentation

◆ JMultiKey() [1/7]

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

Default constructor.

Definition at line 270 of file JMultiKey.hh.

270 :
271 first()
272 {}

◆ JMultiKey() [2/7]

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

Append onstructor.

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

Parameters
firstprimary key
secondsecondary key

Definition at line 282 of file JMultiKey.hh.

283 :
284 first(second)
285 {}

◆ JMultiKey() [3/7]

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

Insert constructor.

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

Parameters
firstprimary key
secondsecondary key

Definition at line 295 of file JMultiKey.hh.

296 :
297 first(first)
298 {}

◆ JMultiKey() [4/7]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( const JMultiKey< 1, JKey_t > & first,
typename JClass< key_type >::argument_type second )
inline

Shift constructor.

The first of the primary keys is removed and the secondary key is appended to the end of the remainder of the primary keys.

Parameters
firstprimary keys
secondsecondary key

Definition at line 308 of file JMultiKey.hh.

308 :
309 first(second)
310 {}

◆ JMultiKey() [5/7]

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

Constructor.

Parameters
firstkey

Definition at line 318 of file JMultiKey.hh.

318 :
319 first(first)
320 {}

◆ JMultiKey() [6/7]

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

Copy constructor.

Parameters
keykey

Definition at line 328 of file JMultiKey.hh.

328 :
329 first(key.first)
330 {}

◆ JMultiKey() [7/7]

template<class JKey_t >
JTOOLS::JMultiKey< 1, JKey_t >::JMultiKey ( const std::array< key_type, 1 > & array)
inline

Copy constructor.

Parameters
arrayarray

Definition at line 338 of file JMultiKey.hh.

338 :
339 first(array[0])
340 {}

Member Function Documentation

◆ operator array_type()

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

Type conversion operator.

Returns
array

Definition at line 348 of file JMultiKey.hh.

349 {
350 return {this->first};
351 }

◆ 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 360 of file JMultiKey.hh.

361 {
362 return this->first < key.first;
363 }

◆ back()

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

Get backend key.

Returns
backend key

Definition at line 371 of file JMultiKey.hh.

372 {
373 return this->first;
374 }

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 384 of file JMultiKey.hh.

385 {
386 in >> key.first;
387
388 return in;
389 }

◆ 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 399 of file JMultiKey.hh.

400 {
401 const JFormat format(out, getFormat< JMultiKey<0, key_type> >(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
402
403 out << format << key.first;
404
405 return out;
406 }
JFormat_t & getFormat()
Get format for given type.
Definition JManip.hh:682
JMultiKey()
Default constructor.
Definition JMultiKey.hh:270
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 409 of file JMultiKey.hh.


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