Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::coalescence::container::Forest< Position, Tree > Class Template Reference

#include <quetzal/coalescence/container/Forest.hpp>

Detailed Description

template<typename Position, typename Tree>
class quetzal::coalescence::container::Forest< Position, Tree >

Collection of geo-localized coalescing trees.

Template Parameters
PositionType of the geographic coordinate of the associated tree.
TreeType of the coalescence tree.

Public Types

using position_type = Position
 
using iterator = typename data_type::iterator
 
using const_iterator = typename data_type::const_iterator
 

Public Member Functions

 Forest ()
 Default constructor.
 
 Forest (const Forest< Position, Tree > &other)
 Copy constructor.
 
 Forest (Forest< Position, Tree > &&other) noexcept
 Move constructor.
 
Forest< Position, Tree > & operator= (const Forest< Position, Tree > &other)
 Copy assignment operator.
 
Forest< Position, Tree > & operator= (Forest< Position, Tree > &&other) noexcept
 Move assignment operator.
 
iterator begin ()
 returns iterator to the begin
 
iterator end ()
 returns iterator to the end
 
const_iterator begin () const
 returns iterator to the begining
 
const_iterator end () const
 returns iterator to the begining
 
const_iterator cbegin () const
 returns iterator to the begin
 
const_iterator cend () const
 returns iterator to the begin
 
unsigned int nb_trees () const
 number of trees in the forest
 
unsigned int nb_trees (Position const &position) const
 number of trees in the forest at a given position
 
std::pair< const_iterator, const_iterator > trees_at_same_position (const Position &position) const
 non-modifying access to trees in the forest at a given position
 
std::pair< iterator, iterator > trees_at_same_position (const Position &position)
 access to trees in the forest at a given position
 
iterator insert (Position const &position, Tree const &tree)
 insert a new tree at a given position
 
iterator insert (Position const &position, Tree &&tree) noexcept
 insert a new tree at a given position
 
Forest< Position, Tree > & insert (Position const &position, std::vector< Tree > const &trees)
 insert a vector of trees at a given position
 
Forest< Position, Tree > & insert (Position const &position, std::vector< Tree > &&trees) noexcept
 insert a vector of trees at a given position
 
size_type erase (Position const &x)
 erase a position from the Forest.
 
void erase (iterator first, iterator last)
 remove elements from the Forest.
 
std::set< Position > positions () const
 positions in the forest
 
std::vector< Treeget_all_trees () const
 copies all trees in the forest
 

Constructor & Destructor Documentation

◆ Forest() [1/3]

template<typename Position , typename Tree >
quetzal::coalescence::container::Forest< Position, Tree >::Forest ( )
inline

Default constructor.

Remarks
Position and Tree must be default constructible

◆ Forest() [2/3]

template<typename Position , typename Tree >
quetzal::coalescence::container::Forest< Position, Tree >::Forest ( const Forest< Position, Tree > &  other)
inline

Copy constructor.

Parameters
otherthe Forest to be constructed from
Remarks
Position and Tree must be copy constructible.

◆ Forest() [3/3]

template<typename Position , typename Tree >
quetzal::coalescence::container::Forest< Position, Tree >::Forest ( Forest< Position, Tree > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherthe Forest to be constructed from
Remarks
Position and Tree must be copy constructible.

Member Function Documentation

◆ erase() [1/2]

template<typename Position , typename Tree >
void quetzal::coalescence::container::Forest< Position, Tree >::erase ( iterator  first,
iterator  last 
)
inline

remove elements from the Forest.

Returns
the number of deleted trees.

◆ erase() [2/2]

template<typename Position , typename Tree >
size_type quetzal::coalescence::container::Forest< Position, Tree >::erase ( Position const &  x)
inline

erase a position from the Forest.

Returns
the number of deleted trees.

◆ get_all_trees()

template<typename Position , typename Tree >
std::vector< Tree > quetzal::coalescence::container::Forest< Position, Tree >::get_all_trees ( ) const
inline

copies all trees in the forest

Returns
a vector of trees.

◆ insert() [1/4]

template<typename Position , typename Tree >
Forest< Position, Tree > & quetzal::coalescence::container::Forest< Position, Tree >::insert ( Position const &  position,
std::vector< Tree > &&  trees 
)
inlinenoexcept

insert a vector of trees at a given position

Returns
a reference to the Forest
Remarks
Position should be copy constructible.

◆ insert() [2/4]

template<typename Position , typename Tree >
Forest< Position, Tree > & quetzal::coalescence::container::Forest< Position, Tree >::insert ( Position const &  position,
std::vector< Tree > const &  trees 
)
inline

insert a vector of trees at a given position

Returns
a reference to the Forest
Remarks
Position and Tree should be copy constructible.

◆ insert() [3/4]

template<typename Position , typename Tree >
iterator quetzal::coalescence::container::Forest< Position, Tree >::insert ( Position const &  position,
Tree &&  tree 
)
inlinenoexcept

insert a new tree at a given position

Returns
an iterator to the inserted tree
Remarks
Position and Tree should be move constructible.

◆ insert() [4/4]

template<typename Position , typename Tree >
iterator quetzal::coalescence::container::Forest< Position, Tree >::insert ( Position const &  position,
Tree const &  tree 
)
inline

insert a new tree at a given position

Returns
an iterator to the inserted tree
Remarks
Position and Tree should be copy constructible.

◆ operator=() [1/2]

template<typename Position , typename Tree >
Forest< Position, Tree > & quetzal::coalescence::container::Forest< Position, Tree >::operator= ( const Forest< Position, Tree > &  other)
inline

Copy assignment operator.

Remarks
Position and Tree must be copy constructible and move assignable.

◆ operator=() [2/2]

template<typename Position , typename Tree >
Forest< Position, Tree > & quetzal::coalescence::container::Forest< Position, Tree >::operator= ( Forest< Position, Tree > &&  other)
inlinenoexcept

Move assignment operator.

Remarks
CellT must be move assignable.

◆ positions()

template<typename Position , typename Tree >
std::set< Position > quetzal::coalescence::container::Forest< Position, Tree >::positions ( ) const
inline

positions in the forest

Returns
a set of coordinates giving the spatial occupancy of the forest.

◆ trees_at_same_position() [1/2]

template<typename Position , typename Tree >
std::pair< iterator, iterator > quetzal::coalescence::container::Forest< Position, Tree >::trees_at_same_position ( const Position &  position)
inline

access to trees in the forest at a given position

Returns
a range [first, last) given by a pair of iterators. The second member of the pair is the past-the-end iterator

◆ trees_at_same_position() [2/2]

template<typename Position , typename Tree >
std::pair< const_iterator, const_iterator > quetzal::coalescence::container::Forest< Position, Tree >::trees_at_same_position ( const Position &  position) const
inline

non-modifying access to trees in the forest at a given position

Returns
a range [first, last) given by a pair of const iterators. The second member of the pair is the past-the-end iterator

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