Helios++
Helios software for LiDAR simulations
KDGrove Class Reference

Grove of KDTrees. It supports both static and dynamic KDTrees, handling each accordingly. More...

#include <KDGrove.h>

Inheritance diagram for KDGrove:
Collaboration diagram for KDGrove:

Public Member Functions

 KDGrove ()
 Default constructor for KDGrove.
 
void addSubject (KDGroveSubject *subject, std::shared_ptr< GroveKDTreeRaycaster > tree)
 Workaround to redirect calls from KDGrove::addSubject(KDGroveSubject *, shared_ptr<GroveKDTreeRaycaster>) to BasicDynGrove::addSubject. More...
 
void removeSubject (KDGroveSubject *subject)
 Workaround to redirect calls from KDGrove::removeSubject(KDGroveSubject *) to BasicDynGrove::removeSubject. More...
 
virtual std::shared_ptr< KDGrovemakeTemporalClone () const
 Make a temporal clone of the KDGrove. More...
 
virtual std::shared_ptr< KDGroveStatsgetStats ()
 Obtain the KDGrove stats. More...
 
virtual void setStats (std::shared_ptr< KDGroveStats > stats)
 Set the KDGrove stats. More...
 
- Public Member Functions inherited from BasicDynGrove< GroveKDTreeRaycaster, DynMovingObject >
 BasicDynGrove ()
 Default constructor for BasicDynGrove.
 
void update (DynMovingObject &s) override
 
virtual void addSubject (BasicDynGroveSubject< GroveKDTreeRaycaster, DynMovingObject > *subject, std::shared_ptr< GroveKDTreeRaycaster > tree)
 Add a new subject which identifier is automatically and internally computed. More...
 
virtual void removeSubject (BasicDynGroveSubject< GroveKDTreeRaycaster, DynMovingObject > *subject)
 Remove subject with given identifier from the grove. More...
 
virtual std::vector< BasicDynGroveSubject< GroveKDTreeRaycaster, DynMovingObject > * > const & getSubjects () const
 Obtain a read-only reference to vector of subjects. More...
 
- Public Member Functions inherited from BasicStaticGrove< Tree >
 BasicStaticGrove ()=default
 Default constructor for BasicStaticGrove.
 
bool hasTrees () const override
 
size_t getNumTrees () const override
 
void addTree (std::shared_ptr< Tree > tree) override
 
void removeTree (size_t const index) override
 
void removeTrees (size_t const startIndex, size_t const endIndex) override
 
void removeAll () override
 
void replaceTree (size_t const index, std::shared_ptr< Tree > tree) override
 Replace tree at given index by given tree. More...
 
Tree & getTreeReference (size_t const index) const override
 
std::shared_ptr< Tree > getTreeShared (size_t const index) const override
 
Tree * getTreePointer (size_t const index) const override
 
void toZeroTree () override
 
bool hasNextTree () const override
 
Tree & nextTreeReference () override
 
std::shared_ptr< Tree > nextTreeShared () override
 
Tree * nextTreePointer () override
 
- Public Member Functions inherited from StaticGrove< Tree >
void clear ()
 Alias for StaticGrove::removeAll method. More...
 
void setTree (size_t const index, std::shared_ptr< Tree > tree)
 Alias for StaticGrove::replaceTree. More...
 
std::shared_ptr< Tree > operator[] (size_t const index) const
 Obtain a shared pointer to the tree at given index. More...
 
virtual GroveTreeWrapper< Tree > begin ()
 Obtain the first element of a for-each loop over trees. More...
 
virtual GroveTreeWrapper< Tree > end ()
 Obtaint the last element of a for-each loop over trees. More...
 
- Public Member Functions inherited from DynGrove< Subject >
virtual void update (Subject &s)=0
 The update method. It is expected that always that a subject must notify that it has been updated, it calls this method so the observer can act as corresponds. More...
 

Protected Attributes

std::shared_ptr< KDGroveStatsstats
 Stats of the KDGgrove. More...
 
- Protected Attributes inherited from BasicDynGrove< GroveKDTreeRaycaster, DynMovingObject >
std::vector< BasicDynGroveSubject< GroveKDTreeRaycaster, DynMovingObject > * > subjects
 Vector with pointers to subjects. More...
 
- Protected Attributes inherited from BasicStaticGrove< Tree >
std::vector< std::shared_ptr< Tree > > trees
 The trees contained in the grove.
 
size_t whileIter
 Current iteration for while loop friendly methods.
 

Detailed Description

Grove of KDTrees. It supports both static and dynamic KDTrees, handling each accordingly.

Author
Alberto M. Esmoris Pena
Version
1.0
See also
BasicDynGrove

Member Function Documentation

◆ addSubject()

void KDGrove::addSubject ( KDGroveSubject subject,
std::shared_ptr< GroveKDTreeRaycaster tree 
)
inline

Workaround to redirect calls from KDGrove::addSubject(KDGroveSubject *, shared_ptr<GroveKDTreeRaycaster>) to BasicDynGrove::addSubject.

See also
BasicDynGrove::addSubject

◆ getStats()

virtual std::shared_ptr<KDGroveStats> KDGrove::getStats ( )
inlinevirtual

Obtain the KDGrove stats.

Returns
KDGrove stats

◆ makeTemporalClone()

std::shared_ptr< KDGrove > KDGrove::makeTemporalClone ( ) const
virtual

Make a temporal clone of the KDGrove.

The temporal clone preserves all static trees but holds its own copy for each dynamic tree. Therefore, source KDGrove can be updated, which means its dynamic trees can change, while the dynamic trees at the temporal clone are not affected by those changes.

It is called a temporal clone because it clones the KDGrove at a certain time. Considering the KDGrove mutates over time. It is not a typical clone because it avoids cloning whatever components that do not change over time.

Notice stats are not cloned. Only the main components, it is the trees. The subjects are neither updated. The temporal clone should not be updated. It must be understood simply as a way of holding the state of a KDGrove at a certain time, not as a new fully operating KDGrove.

Returns
Temporal clone of the KDGrove
See also
GroveKDTreeRaycaster::makeTemporalClone
KDGroveRaycaster::makeTemporalClone

◆ removeSubject()

void KDGrove::removeSubject ( KDGroveSubject subject)
inline

◆ setStats()

virtual void KDGrove::setStats ( std::shared_ptr< KDGroveStats stats)
inlinevirtual

Set the KDGrove stats.

Parameters
statsNew KDGrove stats

Member Data Documentation

◆ stats

std::shared_ptr<KDGroveStats> KDGrove::stats
protected

Stats of the KDGgrove.

See also
KDGroveStats

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