Loading...
Searching...
No Matches
Opm::IOrderSet< T > Class Template Reference

Set of elements which preserves order of element insertion. More...

`#include <IOrderSet.hpp>`

## Public Member Functions

| IOrderSet ()=default
| Default constructor.
| IOrderSet (const std::vector< T > &data)
| Constructor.
auto | size () const
| Number of elements in collection.
auto | empty () const
| Whether or not this collection is empty.
auto | contains (const T &value) const
| Whether or not a particular element exists in the collection.
bool | insert (const T &value)
| Insert element into collection.
std::size_t | erase (const T &value)
| Remove element from collection.
auto | begin () const
| Iterator to first element in ordered collection view.
auto | end () const
| End of ordered collection view.
const T & | operator[] (const std::size_t i) const
| Access element by index in ordered collection view.
const std::vector< T > & | data () const
| Ordered collection view.
bool | operator== (const IOrderSet< T > &data) const
| Equality predicate.
template<class Serializer>
void | serializeOp (Serializer &serializer)
| Convert between byte array and object representation.

## Detailed Description

template<typename T>
class Opm::IOrderSet< T >

Set of elements which preserves order of element insertion.

Repeated insertion of a particular element leaves container unchanged.

Template Parameters

  T | Element type. Should typically be a fairly small type, such as a built-in arithmetic type or a std::string.

## Constructor & Destructor Documentation

## IOrderSet() [1/2]

template<typename T>

Opm::IOrderSet< T >::IOrderSet | ( |  | ) |

default

Default constructor.

Resulting object is usable as target for a deserialisation operation, and population through insert()/erase().

## IOrderSet() [2/2]

template<typename T>

Opm::IOrderSet< T >::IOrderSet | ( | const std::vector< T > & | data | ) |

inline explicit

Constructor.

Populates container with an initial set of elements.

Parameters

  [in] | data | Ordered view of element collection.

## Member Function Documentation

## contains()

template<typename T>

auto Opm::IOrderSet< T >::contains | ( | const T & | value | ) | const

inline

Whether or not a particular element exists in the collection.

Parameters

  [in] | value | Element.

Returns
  Whether or no `value` exists in the collection.

## erase()

template<typename T>

std::size_t Opm::IOrderSet< T >::erase | ( | const T & | value | ) |

inline

Remove element from collection.

If element does not exist in the collection, the collection is unchanged.

Parameters

  [in] | value | Element.

Returns
  Number of elements removed from collection (0 or 1).

## insert()

template<typename T>

bool Opm::IOrderSet< T >::insert | ( | const T & | value | ) |

inline

Insert element into collection.

If element already exists, then collection is unchanged. Otherwise, the element will be appended to the ordered view of the collection's elements.

Parameters

  [in] | value | Element.

Returns
  Whether or not the `value` was inserted into the collection.

## operator==()

template<typename T>

bool Opm::IOrderSet< T >::operator== | ( | const IOrderSet< T > & | data | ) | const

inline

Equality predicate.

Parameters

  [in] | data | Object against which will be tested for equality.

Returns
  Whether or not
  is the same as `data`.

## operator[]()

template<typename T>

const T & Opm::IOrderSet< T >::operator[] | ( | const std::size_t | i | ) | const

inline

Access element by index in ordered collection view.

Throws an exception of type std::out_of_range if the index is not strictly less than size().

Parameters

  [in] | i | Element index. Should be strictly less than size().

Returns
  Element at position `i` in ordered collection view.

## serializeOp()

template<typename T>
template<class Serializer>

void Opm::IOrderSet< T >::serializeOp | ( | Serializer & | serializer | ) |

inline

Convert between byte array and object representation.

Template Parameters

  Serializer | Byte array conversion protocol.

Parameters

  [in,out] | serializer | Byte array conversion object.

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

- opm/input/eclipse/EclipseState/Util/IOrderSet.hpp