![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/DataList.h>
Container for any number of Data instances such as image or meshes. More...
Container for any number of Data instances such as image or meshes.
The DataList is merely a wrapper around a std::vector<Data*>
that provides various convenience functions to query certain types of Data. In particular, DataList will not take any ownership of its contents. Use OwningDataList to model ownership of the underlying data.
It is safe to access and modify the underlying container directly (e.g. if you want to apply STL algorithms on it).
Public Member Functions | |
DataList () | |
Default Constructor to create an empty list. | |
DataList (std::initializer_list< Data * > l) | |
Constructor with a set of data. | |
template<typename T> | |
DataList (const std::vector< T * > &data) | |
Constructor from a vector of data. | |
DataList (const DataList &)=default | |
DataList & | operator= (const DataList &)=default |
DataList (DataList &&) noexcept=default | |
DataList & | operator= (DataList &&) noexcept=default |
int | size () const |
Return the size of the list. | |
bool | isEmpty () const |
Return whether this list is empty. | |
int | indexOf (const Data *data) const |
Returns the index of data within the list or -1 if it is not present. | |
void | clear () |
Clear all data. | |
bool | contains (const Data *data) const |
Returns true when data is part of data list. | |
bool | operator== (const DataList &other) const |
Returns true if the both DataList have the same elements in the same order, false otherwise. | |
bool | operator!= (const DataList &other) const |
Returns false if the both DataList have the same elements in the same order, true otherwise. | |
Modifying a DataList | |
void | add (Data *data) |
Add data to the list. | |
void | add (const DataList &dataList) |
void | remove (const Data *data) |
Remove data from the list. | |
Retrieving items from a DataList | |
Data * | operator[] (int idx) const |
Array access; returns the data located in the underlying vector at the given index. | |
Data * | getItem (int which) const |
Return data item via list index. | |
Data * | getFirst (Data::Kind kind=Data::UNKNOWN) const |
Return the first Data instance of the given kind. | |
template<typename T> | |
T * | getFirst (Data::Kind kind=Data::UNKNOWN) const |
Return the first Data instance of the given type and kind. | |
std::vector< Data * > | getAll (Data::Kind kind=Data::UNKNOWN) const |
Retrieve all Data instances of given kind. | |
template<typename T> | |
std::vector< T * > | getAll (Data::Kind kind=Data::UNKNOWN) const |
Retrieve all Data instances of given type and kind. | |
SharedImageSet * | getImage (Data::Kind kind=Data::UNKNOWN, Data::Modality modality=Data::NA) const |
Return first image data with the requested properties Data::UNKNOWN will match all kinds and Data::NA will match all modalities. | |
std::vector< SharedImageSet * > | getImages (Data::Kind kind=Data::UNKNOWN, Data::Modality modality=Data::NA) const |
Return all image data sets with the requested properties Data::UNKNOWN will match all kinds and Data::NA will match all modalities. | |
std::vector< PointCloud * > | getPointClouds () const |
Return all point clouds data. | |
std::vector< Mesh * > | getSurfaces () const |
Return all surfaces data. | |
std::vector< TrackingSequence * > | getTrackingSequences () const |
Return all tracking sequences. | |
std::vector< Tree * > | getTrees () const |
Return all trees data. | |
std::vector< Data * > | getAnnotationData () const |
Return all entries which have an associated annotation (Data::isAnnotationType() is true ). | |
Access to the underlying std::vector holding the data. | |
std::vector< Data * > & | container () |
Return the underlying std::vector. | |
const std::vector< Data * > & | container () const |
Return the underlying std::vector. | |
std::vector< Data * >::const_iterator | begin () const |
Const iterators to the underlying datasets. | |
std::vector< Data * >::const_iterator | end () const |
DataList | ( | const std::vector< T * > & | data | ) |
Constructor from a vector of data.
dataList2 = dataList1.getAll<SharedImageSet>();
to filter all SharedImageSets from dataList1
and assign them to dataList2
. Data * getFirst | ( | Data::Kind | kind = Data::UNKNOWN | ) | const |
Return the first Data instance of the given kind.
Data::UNKNOWN will match all kinds.
getFirst<Data>(kind)
. T * getFirst | ( | Data::Kind | kind = Data::UNKNOWN | ) | const |
Return the first Data instance of the given type and kind.
Data::UNKNOWN will match all kinds.
std::vector< Data * > getAll | ( | Data::Kind | kind = Data::UNKNOWN | ) | const |
Retrieve all Data instances of given kind.
Data::UNKNOWN will match all kinds.
getAll<Data>(kind)
. std::vector< T * > getAll | ( | Data::Kind | kind = Data::UNKNOWN | ) | const |
Retrieve all Data instances of given type and kind.
Data::UNKNOWN will match all kinds.
std::vector< PointCloud * > getPointClouds | ( | ) | const |
Return all point clouds data.
getAll<PointCloud>(Data::POINTSET)
. std::vector< Mesh * > getSurfaces | ( | ) | const |
Return all surfaces data.
getAll<Mesh>(Data::SURFACE)
. std::vector< TrackingSequence * > getTrackingSequences | ( | ) | const |
Return all tracking sequences.
getAll<TrackingSequence>(Data::TRACKINGDATA)
. std::vector< Tree * > getTrees | ( | ) | const |
Return all trees data.
getAll<Tree>(Data::TREE)
.