Public Member Functions | Static Public Member Functions | List of all members
Pair< Type > Class Template Reference

An ordered pair of two objects of type <T> with first() and second() elements. More...

Inheritance diagram for Pair< Type >:
Inheritance graph
[legend]
Collaboration diagram for Pair< Type >:
Collaboration graph
[legend]

Public Member Functions

 Pair ()
 Null constructor. More...
 
 Pair (const Type &f, const Type &s)
 Construct from components. More...
 
 Pair (const FixedList< Type, 2 > &fl)
 Construct from FixedList. More...
 
 Pair (Istream &is)
 Construct from Istream. More...
 
const Type & first () const
 Return first. More...
 
Type & first ()
 Return first. More...
 
const Type & second () const
 Return second. More...
 
Type & second ()
 Return second. More...
 
const Type & other (const Type &a) const
 Return other. More...
 
- Public Member Functions inherited from FixedList< Type, 2 >
 FixedList ()
 Null constructor. More...
 
 FixedList (const Type &)
 Construct from value. More...
 
 FixedList (const Type v[Size])
 Construct from C-array. More...
 
 FixedList (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 FixedList (std::initializer_list< Type >)
 Construct from an initializer list. More...
 
 FixedList (const UList< Type > &)
 Construct from UList. More...
 
 FixedList (const SLList< Type > &)
 Construct from SLList. More...
 
 FixedList (const FixedList< Type, Size > &)
 Copy constructor. More...
 
 FixedList (Istream &)
 Construct from Istream. More...
 
autoPtr< FixedList< Type, Size > > clone () const
 Clone. More...
 
label fcIndex (const label i) const
 Return the forward circular index, i.e. the next index. More...
 
label rcIndex (const label i) const
 Return the reverse circular index, i.e. the previous index. More...
 
const Type * cdata () const
 Return a const pointer to the first data element,. More...
 
Type * data ()
 Return a pointer to the first data element,. More...
 
Type & first ()
 Return the first element of the list. More...
 
const Type & first () const
 Return first element of the list. More...
 
Type & last ()
 Return the last element of the list. More...
 
const Type & last () const
 Return the last element of the list. More...
 
void checkStart (const label start) const
 Check start is within valid range (0 ... size-1) More...
 
void checkSize (const label size) const
 Check size is within valid range (0 ... size) More...
 
void checkIndex (const label i) const
 Check index i is within valid range (0 ... size-1) More...
 
void resize (const label)
 Dummy resize function. More...
 
void setSize (const label)
 Dummy setSize function. More...
 
void transfer (const FixedList< Type, Size > &)
 Copy (not transfer) the argument contents. More...
 
void writeEntry (Ostream &) const
 Write the FixedList as a dictionary entry. More...
 
void writeEntry (const word &keyword, Ostream &) const
 Write the FixedList as a dictionary entry with keyword. More...
 
Type & operator[] (const label)
 Return element of FixedList. More...
 
const Type & operator[] (const label) const
 Return element of constant FixedList. More...
 
void operator= (const Type v[Size])
 Assignment to array operator. Takes linear time. More...
 
void operator= (const UList< Type > &)
 Assignment to UList operator. Takes linear time. More...
 
void operator= (const SLList< Type > &)
 Assignment to SLList operator. Takes linear time. More...
 
void operator= (std::initializer_list< Type >)
 Assignment to an initializer list. Takes linear time. More...
 
void operator= (const Type &)
 Assignment of all entries to the given value. More...
 
iterator begin ()
 Return an iterator to begin traversing the FixedList. More...
 
const_iterator begin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
iterator end ()
 Return an iterator to end traversing the FixedList. More...
 
const_iterator end () const
 Return const_iterator to end traversing the constant FixedList. More...
 
const_iterator cbegin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
const_iterator cend () const
 Return const_iterator to end traversing the constant FixedList. More...
 
reverse_iterator rbegin ()
 Return reverse_iterator to begin reverse traversing the FixedList. More...
 
const_reverse_iterator rbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
reverse_iterator rend ()
 Return reverse_iterator to end reverse traversing the FixedList. More...
 
const_reverse_iterator rend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
const_reverse_iterator crbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
const_reverse_iterator crend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
label size () const
 Return the number of elements in the FixedList. More...
 
label max_size () const
 Return size of the largest possible FixedList. More...
 
bool empty () const
 Return true if the FixedList is empty (ie, size() is zero) More...
 
void swap (FixedList< Type, Size > &)
 Swap two FixedLists of the same type in constant time. More...
 
bool operator== (const FixedList< Type, Size > &) const
 Equality operation on FixedLists of the same type. More...
 
bool operator!= (const FixedList< Type, Size > &) const
 The opposite of the equality operation. Takes linear time. More...
 
bool operator< (const FixedList< Type, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator> (const FixedList< Type, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator<= (const FixedList< Type, Size > &) const
 Return true if !(a > b). Takes linear time. More...
 
bool operator>= (const FixedList< Type, Size > &) const
 Return true if !(a < b). Takes linear time. More...
 

Static Public Member Functions

static int compare (const Pair< Type > &a, const Pair< Type > &b)
 Compare Pairs. More...
 
- Static Public Member Functions inherited from FixedList< Type, 2 >
static const FixedList< Type, Size > & null ()
 Return a null FixedList. More...
 

Additional Inherited Members

- Public Types inherited from FixedList< Type, 2 >
typedef Type value_type
 Type of values the FixedList contains. More...
 
typedef Type & reference
 Type that can be used for storing into. More...
 
typedef const Type & const_reference
 Type that can be used for storing into. More...
 
typedef label difference_type
 The type that can represent the difference between any two. More...
 
typedef label size_type
 The type that can represent the size of a FixedList. More...
 
typedef Type * iterator
 Random access iterator for traversing FixedList. More...
 
typedef const Type * const_iterator
 Random access iterator for traversing FixedList. More...
 
typedef Type * reverse_iterator
 Reverse iterator for reverse traversal of FixedList. More...
 
typedef const Type * const_reverse_iterator
 Reverse iterator for reverse traversal of constant FixedList. More...
 

Detailed Description

template<class Type>
class Foam::Pair< Type >

An ordered pair of two objects of type <T> with first() and second() elements.

See also
Foam::Tuple2 for storing two objects of dissimilar types.

Definition at line 49 of file contiguous.H.

Constructor & Destructor Documentation

◆ Pair() [1/4]

Pair ( )
inline

Null constructor.

Definition at line 61 of file Pair.H.

◆ Pair() [2/4]

Pair ( const Type &  f,
const Type &  s 
)
inline

Construct from components.

Definition at line 65 of file Pair.H.

◆ Pair() [3/4]

Pair ( const FixedList< Type, 2 > &  fl)
inline

Construct from FixedList.

Definition at line 72 of file Pair.H.

◆ Pair() [4/4]

Pair ( Istream is)
inline

Construct from Istream.

Definition at line 78 of file Pair.H.

Member Function Documentation

◆ first() [1/2]

const Type& first ( ) const
inline

◆ first() [2/2]

Type& first ( )
inline

Return first.

Definition at line 93 of file Pair.H.

◆ second() [1/2]

const Type& second ( ) const
inline

◆ second() [2/2]

Type& second ( )
inline

Return second.

Definition at line 105 of file Pair.H.

◆ other()

const Type& other ( const Type &  a) const
inline

Return other.

Definition at line 111 of file Pair.H.

◆ compare()

static int compare ( const Pair< Type > &  a,
const Pair< Type > &  b 
)
inlinestatic

Compare Pairs.

Returning:

  • 0: different
  • +1: identical
  • -1: same pair, but reversed order

Definition at line 142 of file Pair.H.

Referenced by preserveBafflesConstraint::add(), minEqOp< labelPair >::operator()(), and Pair< word >::other().

Here is the caller graph for this function:

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