Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Friends | List of all members
JTOOLS::JMultiKey< 2, JKey_t > Class Template Reference

Two-dimensional key. More...

#include <JMultiKey.hh>

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

Public Types

typedef JKey_t key_type
 
typedef JMultiKey< 1, JKey_t > mapped_type
 
typedef std::pair< key_type,
mapped_type
pair
 

Public Member Functions

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

Friends

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

Detailed Description

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

Two-dimensional key.

Definition at line 220 of file JMultiKey.hh.

Member Typedef Documentation

template<class JKey_t >
typedef JKey_t JTOOLS::JMultiKey< 2, JKey_t >::key_type

Definition at line 226 of file JMultiKey.hh.

template<class JKey_t >
typedef JMultiKey<1, JKey_t> JTOOLS::JMultiKey< 2, JKey_t >::mapped_type

Definition at line 227 of file JMultiKey.hh.

template<class JKey_t >
typedef std::pair<key_type, mapped_type> JTOOLS::JMultiKey< 2, JKey_t >::pair

Definition at line 228 of file JMultiKey.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 234 of file JMultiKey.hh.

234  :
235  pair()
236  {}
std::pair< key_type, mapped_type > pair
Definition: JMultiKey.hh:228
template<class JKey_t >
JTOOLS::JMultiKey< 2, 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 246 of file JMultiKey.hh.

247  :
248  pair(__first.first, __second)
249  {}
std::pair< key_type, mapped_type > pair
Definition: JMultiKey.hh:228
template<class JKey_t >
JTOOLS::JMultiKey< 2, 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 259 of file JMultiKey.hh.

260  :
261  pair(__first, __second.first)
262  {}
std::pair< key_type, mapped_type > pair
Definition: JMultiKey.hh:228
template<class JKey_t >
JTOOLS::JMultiKey< 2, JKey_t >::JMultiKey ( typename JArgument< 2, JKey_t >::argument_type  key)
inline

Copy constructor.

Parameters
keykey

Definition at line 270 of file JMultiKey.hh.

270  :
271  pair(key.first, key.second)
272  {}
std::pair< key_type, mapped_type > pair
Definition: JMultiKey.hh:228

Member Function Documentation

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

Less than method.

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

Definition at line 281 of file JMultiKey.hh.

282  {
283  if (this->first == key.first)
284  return this->second.less(key.second);
285  else
286  return this->first < key.first;
287  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
template<class JKey_t >
double JTOOLS::JMultiKey< 2, JKey_t >::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 295 of file JMultiKey.hh.

296  {
297  return this->first*this->first + this->second.getLengthSquared();
298  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
template<class JKey_t >
double JTOOLS::JMultiKey< 2, JKey_t >::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 306 of file JMultiKey.hh.

307  {
308  return sqrt(this->getLengthSquared());
309  }
double getLengthSquared() const
Get length squared.
Definition: JMultiKey.hh:295
template<class JKey_t >
JMultiKey<1, JKey_t> JTOOLS::JMultiKey< 2, JKey_t >::front ( ) const
inline

Get frontend key.

Returns
frontend key

Definition at line 317 of file JMultiKey.hh.

318  {
319  return JMultiKey<1, JKey_t>(this->first);
320  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
One-dimensional key.
Definition: JMultiKey.hh:374
template<class JKey_t >
key_type JTOOLS::JMultiKey< 2, JKey_t >::back ( ) const
inline

Get backend key.

Returns
backend key

Definition at line 328 of file JMultiKey.hh.

329  {
330  return this->second.back();
331  }

Friends And Related Function Documentation

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

Read key from input.

Parameters
ininput stream
keykey
Returns
input stream

Definition at line 341 of file JMultiKey.hh.

342  {
343  in >> key.first;
344  in >> key.second;
345 
346  return in;
347  }
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
template<class JKey_t >
std::ostream& operator<< ( std::ostream &  out,
const JMultiKey< 2, JKey_t > &  key 
)
friend

Write key to output.

Parameters
outoutput stream
keykey
Returns
output stream

Definition at line 357 of file JMultiKey.hh.

358  {
359  const JFormat format(out, getFormat< JMultiKey<2, JKey_t> >(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
360 
361  out << format << key.first;
362  out << ' ';
363  out << key.second;
364 
365  return out;
366  }
Two-dimensional key.
Definition: JMultiKey.hh:220
JFormat_t & getFormat()
Get format for given type.
Definition: JManip.hh:680
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
Data structure for format specifications.
Definition: JManip.hh:522

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