ImFusion SDK 4.3
DataList Class Referencefinal

#include <ImFusion/Base/DataList.h>

Container for any number of Data instances such as image or meshes. More...

Detailed Description

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).

See also
OwningDataList
Examples
ExampleAlgorithm.cpp, ExampleAlgorithm.h, NetworkCommunication.cpp, SqrtAlgorithm.cpp, SqrtAlgorithm.h, and StreamAlgorithmFactory.cpp.

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
 
DataListoperator= (const DataList &)=default
 
 DataList (DataList &&) noexcept=default
 
DataListoperator= (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

Dataoperator[] (int idx) const
 Array access; returns the data located in the underlying vector at the given index.
 
DatagetItem (int which) const
 Return data item via list index.
 
DatagetFirst (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.
 
SharedImageSetgetImage (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
 

Constructor & Destructor Documentation

◆ DataList()

template<typename T>
DataList ( const std::vector< T * > & data)

Constructor from a vector of data.

Note
This constructor is deliberately implicit to allow for easy assignment of DataList queries (i.e. get-accessors) to DataLists. For instance, you can write dataList2 = dataList1.getAll<SharedImageSet>(); to filter all SharedImageSets from dataList1 and assign them to dataList2.
Template Parameters
TData type stored in the vector, must inherit from Data.

Member Function Documentation

◆ getFirst() [1/2]

Data * getFirst ( Data::Kind kind = Data::UNKNOWN) const

Return the first Data instance of the given kind.

Data::UNKNOWN will match all kinds.

Note
This is a shortcut for getFirst<Data>(kind).
Examples
StreamAlgorithmFactory.cpp.

◆ getFirst() [2/2]

template<typename T>
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.

◆ getAll() [1/2]

std::vector< Data * > getAll ( Data::Kind kind = Data::UNKNOWN) const

Retrieve all Data instances of given kind.

Data::UNKNOWN will match all kinds.

Note
This is a shortcut for getAll<Data>(kind).

◆ getAll() [2/2]

template<typename T>
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.

◆ getPointClouds()

std::vector< PointCloud * > getPointClouds ( ) const

Return all point clouds data.

Note
This is a shortcut for getAll<PointCloud>(Data::POINTSET).

◆ getSurfaces()

std::vector< Mesh * > getSurfaces ( ) const

Return all surfaces data.

Note
This is a shortcut for getAll<Mesh>(Data::SURFACE).

◆ getTrackingSequences()

std::vector< TrackingSequence * > getTrackingSequences ( ) const

Return all tracking sequences.

Note
This is a shortcut for getAll<TrackingSequence>(Data::TRACKINGDATA).

◆ getTrees()

std::vector< Tree * > getTrees ( ) const

Return all trees data.

Note
This is a shortcut for getAll<Tree>(Data::TREE).

The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close