PLaSK library
Loading...
Searching...
No Matches
plask::PathHints Struct Reference

Represent hints for path finder. More...

#include <plask/geometry/path.hpp>

Collaboration diagram for plask::PathHints:
[legend]

Public Types

typedef std::map< weak_ptr< GeometryObject >, std::set< weak_ptr< GeometryObject > > > HintMap
 Type for map: geometry object container -> object in container.
 
typedef Edge Hint
 Type for arc in graph.
 

Public Member Functions

 PathHints (const Hint &hint)
 
 PathHints (const Path &path)
 
 PathHints (const std::vector< shared_ptr< const GeometryObject > > &path)
 Construct path hints with all hinst included in path.
 
 PathHints (const GeometryObject::Subtree &subtree)
 Construct path hints with all hinst included in subtree.
 
 PathHints ()=default
 Construct empty set of path hints.
 
void addHint (const Hint &hint)
 Add hint to hints map.
 
bool includes (shared_ptr< const GeometryObject > container, shared_ptr< const GeometryObject > child_tran) const
 Check if hint is included in this.
 
bool includes (const Hint &hint) const
 Check if hint is included in this.
 
PathHintsoperator+= (const Hint &hint)
 Add hint to hints map.
 
bool operator== (const PathHints &comp) const
 Comparison operator.
 
bool operator< (const PathHints &comp) const
 Comparison operator for using PathHints as map keys.
 
void addHint (weak_ptr< GeometryObject > container, weak_ptr< GeometryObject > child)
 Add hint to hints map.
 
void addAllHintsFromPath (const std::vector< shared_ptr< const GeometryObject > > &pathObjects)
 Add all hinst included in path objects.
 
void addAllHintsFromPath (const Path &path)
 Add all hinst included in path.
 
void addAllHintsFromSubtree (const GeometryObject::Subtree &subtree)
 Add all hinst included in subtree.
 
std::set< shared_ptr< GeometryObject > > getChildren (shared_ptr< const GeometryObject > container)
 Get children for given container.
 
std::set< shared_ptr< GeometryObject > > getChildren (const GeometryObject &container)
 Get children for given container.
 
std::set< shared_ptr< GeometryObject > > getChildren (shared_ptr< const GeometryObject > container) const
 Get child for given container.
 
std::set< shared_ptr< GeometryObject > > getChildren (const GeometryObject &container) const
 Get child for given container.
 
template<int dim>
std::set< shared_ptr< Translation< dim > > > getTranslationChildren (shared_ptr< const GeometryObject > container)
 Get child for given container casted to Translation object.
 
template<int dim>
std::set< shared_ptr< Translation< dim > > > getTranslationChildren (const GeometryObject &container)
 Get child for given container casted to Translation object.
 
template<int dim>
std::set< shared_ptr< Translation< dim > > > getTranslationChildren (shared_ptr< const GeometryObject > container) const
 Get child for given container casted to Translation object.
 
template<int dim>
std::set< shared_ptr< Translation< dim > > > getTranslationChildren (const GeometryObject &container) const
 Get child for given container casted to Translation object.
 
void cleanDeleted ()
 Remove all hints which refer to deleted objects.
 

Static Public Member Functions

template<int dim>
static std::set< shared_ptr< Translation< dim > > > castToTranslation (std::set< shared_ptr< GeometryObject > > src)
 

Public Attributes

HintMap hintFor
 Hints map.
 

Detailed Description

Represent hints for path finder.

Hints are used to find unique path for all GeometryObject pairs, even if one of the pair object is inserted to the geometry graph in more than one place.

Each hint allows for chooseing one child for geometry object container and it is a pair: geometry object container -> object in container.

Typically, hints are returned by methods which adds new objects to containers.

See also
Paths

Definition at line 44 of file path.hpp.

Member Typedef Documentation

◆ Hint

Type for arc in graph.

Pair: container of geometry objects -> object in container.

See also
Paths

Definition at line 58 of file path.hpp.

◆ HintMap

typedef std::map<weak_ptr<GeometryObject>, std::set<weak_ptr<GeometryObject> > > plask::PathHints::HintMap

Type for map: geometry object container -> object in container.

Definition at line 51 of file path.hpp.

Constructor & Destructor Documentation

◆ PathHints() [1/5]

plask::PathHints::PathHints ( const Hint hint)
inlineexplicit
Parameters
hintinitial hint in the path hints

Definition at line 66 of file path.hpp.

◆ PathHints() [2/5]

plask::PathHints::PathHints ( const Path path)
inlineexplicit
Parameters
pathpath which is split to the path hints

Definition at line 73 of file path.hpp.

◆ PathHints() [3/5]

plask::PathHints::PathHints ( const std::vector< shared_ptr< const GeometryObject > > &  path)
inlineexplicit

Construct path hints with all hinst included in path.

Parameters
pathpath

Definition at line 81 of file path.hpp.

◆ PathHints() [4/5]

plask::PathHints::PathHints ( const GeometryObject::Subtree subtree)
inlineexplicit

Construct path hints with all hinst included in subtree.

Parameters
subtreesubtree

Definition at line 89 of file path.hpp.

◆ PathHints() [5/5]

plask::PathHints::PathHints ( )
default

Construct empty set of path hints.

Member Function Documentation

◆ addAllHintsFromPath() [1/2]

void plask::PathHints::addAllHintsFromPath ( const Path path)

Add all hinst included in path.

Parameters
pathpath

Definition at line 43 of file path.cpp.

◆ addAllHintsFromPath() [2/2]

void plask::PathHints::addAllHintsFromPath ( const std::vector< shared_ptr< const GeometryObject > > &  pathObjects)

Add all hinst included in path objects.

Parameters
pathObjectsgeometry objects which are on path

Definition at line 36 of file path.cpp.

◆ addAllHintsFromSubtree()

void plask::PathHints::addAllHintsFromSubtree ( const GeometryObject::Subtree subtree)

Add all hinst included in subtree.

Parameters
subtreesubtree

Definition at line 47 of file path.cpp.

◆ addHint() [1/2]

void plask::PathHints::addHint ( const Hint hint)

Add hint to hints map.

Overwrite if hint for given container already exists.

Parameters
hinthint to add

Definition at line 22 of file path.cpp.

◆ addHint() [2/2]

void plask::PathHints::addHint ( weak_ptr< GeometryObject container,
weak_ptr< GeometryObject child 
)

Add hint to hints map.

Overwrite if hint for given container already exists.

Parameters
container,childhint to add

Definition at line 32 of file path.cpp.

◆ castToTranslation()

template<int dim>
static std::set< shared_ptr< Translation< dim > > > plask::PathHints::castToTranslation ( std::set< shared_ptr< GeometryObject > >  src)
inlinestatic

Definition at line 192 of file path.hpp.

◆ cleanDeleted()

void plask::PathHints::cleanDeleted ( )

Remove all hints which refer to deleted objects.

Definition at line 88 of file path.cpp.

◆ getChildren() [1/4]

std::set< shared_ptr< GeometryObject > > plask::PathHints::getChildren ( const GeometryObject container)
inline

Get children for given container.

Returns
children for given container or empty set if there is no hints for given container

Definition at line 173 of file path.hpp.

◆ getChildren() [2/4]

std::set< shared_ptr< GeometryObject > > plask::PathHints::getChildren ( const GeometryObject container) const
inline

Get child for given container.

Returns
child for given container or nullptr if there is no hint for given container

Definition at line 187 of file path.hpp.

◆ getChildren() [3/4]

std::set< shared_ptr< GeometryObject > > plask::PathHints::getChildren ( shared_ptr< const GeometryObject container)

Get children for given container.

Returns
children for given container or empty set if there is no hints for given container

Definition at line 56 of file path.cpp.

◆ getChildren() [4/4]

std::set< shared_ptr< GeometryObject > > plask::PathHints::getChildren ( shared_ptr< const GeometryObject container) const

Get child for given container.

Returns
child for given container or nullptr if there is no hint for given container

Definition at line 77 of file path.cpp.

◆ getTranslationChildren() [1/4]

template<int dim>
std::set< shared_ptr< Translation< dim > > > plask::PathHints::getTranslationChildren ( const GeometryObject container)
inline

Get child for given container casted to Translation object.

Parameters
containercontainer
Returns
casted child for given container or nullptr if there is no hint or it cannot be casted

Definition at line 212 of file path.hpp.

◆ getTranslationChildren() [2/4]

template<int dim>
std::set< shared_ptr< Translation< dim > > > plask::PathHints::getTranslationChildren ( const GeometryObject container) const
inline

Get child for given container casted to Translation object.

Parameters
containercontainer
Returns
casted child for given container or nullptr if there is no hint or it cannot be casted

Definition at line 230 of file path.hpp.

◆ getTranslationChildren() [3/4]

template<int dim>
std::set< shared_ptr< Translation< dim > > > plask::PathHints::getTranslationChildren ( shared_ptr< const GeometryObject container)
inline

Get child for given container casted to Translation object.

Parameters
containercontainer
Returns
casted child for given container or nullptr if there is no hint or it cannot be casted

Definition at line 203 of file path.hpp.

◆ getTranslationChildren() [4/4]

template<int dim>
std::set< shared_ptr< Translation< dim > > > plask::PathHints::getTranslationChildren ( shared_ptr< const GeometryObject container) const
inline

Get child for given container casted to Translation object.

Parameters
containercontainer
Returns
casted child for given container or nullptr if there is no hint or it cannot be casted

Definition at line 221 of file path.hpp.

◆ includes() [1/2]

bool plask::PathHints::includes ( const Hint hint) const
inline

Check if hint is included in this.

Parameters
hinthint to check
Returns
*c true only if hint is included in this

Definition at line 116 of file path.hpp.

◆ includes() [2/2]

bool plask::PathHints::includes ( shared_ptr< const GeometryObject container,
shared_ptr< const GeometryObject child_tran 
) const

Check if hint is included in this.

Parameters
container,child_trancontent of hint (container and child - typically translation)
Returns
*c true only if hint is included in this

Definition at line 26 of file path.cpp.

◆ operator+=()

PathHints & plask::PathHints::operator+= ( const Hint hint)
inline

Add hint to hints map.

Overwrite if hint for given container already exists.

Parameters
hinthint to add

Definition at line 124 of file path.hpp.

◆ operator<()

bool plask::PathHints::operator< ( const PathHints comp) const
inline

Comparison operator for using PathHints as map keys.

Definition at line 135 of file path.hpp.

◆ operator==()

bool plask::PathHints::operator== ( const PathHints comp) const
inline

Comparison operator.

Definition at line 130 of file path.hpp.

Member Data Documentation

◆ hintFor

HintMap plask::PathHints::hintFor

Hints map.

Definition at line 61 of file path.hpp.


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