Visual Computing Library
Loading...
Searching...
No Matches
vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes > Class Template Reference

The ContainerComponent class is the base class for all the components of VCLib that store a container of objects of a given type T. More...

#include <vclib/mesh/components/bases/container_component.h>

Inheritance diagram for vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >:

Static Public Attributes

static const bool TIED_TO_VERTEX_NUMBER = TTVN
 Boolean that tells if this component stores a container having its size tied to the number of the vertices of the Element.
 
static const int SIZE = N
 

Protected Types

using Iterator = Vector< T, N >::Iterator
 
using ConstIterator = Vector< T, N >::ConstIterator
 

Protected Member Functions

void init ()
 
Vector< T, N > & container ()
 
const Vector< T, N > & container () const
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
AdDtadditionalData ()
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
const AdDtadditionalData () const
 

Private Types

using Base = detail::ContCompBase< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes... >
 

Static Private Attributes

static constexpr bool HAS_ADDITIONAL_DATA
 

Detailed Description

template<typename DerivedComponent, uint COMP_ID, typename T, int N, typename AdditionalData, typename ParentElemType, bool VERT, bool OPT, bool TTVN, typename... PointedTypes>
class vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >

The ContainerComponent class is the base class for all the components of VCLib that store a container of objects of a given type T.

A component that inherits from this class will have all the features of the Component class, plus automatic storage of the data in a Container of objects that could have static or dynamic size, and the possibility to tie the size of the Container to the number of Vertices of the Element (E.g. useful for some Face components like AdjacentFaces or WedgeTexCoords).

For further details , please refer to the page implement_component page.

Template Parameters
DerivedComponentThe type of the Derived Component. It is used to implement the CRTP pattern.
COMPONENT_IDThe id of the component. It is a value of the enum ComponentIDEnum, or an integer value that is not already used by any other component. It is used to identify the component at compile time.
TThe type of the data that the component needs to store in a Container. E.g. a WedgeTexCoord component would have vcl::TexCoordd as DataType.
NThe size of the container: if >= 0 the size is static, if < 0 the size is dynamic.
AdditionalDatathe type of additional data that could be stored outside the Container. If you don't have additional data. set AdditionalData = void. E.g. a WedgeTexCoord component stores a short as AdditionalData that indicates the texture index used by all the Wedge TexCoords.
ParentElemTypeThe Parent Element type is used to get access to the Element that has the component (and, in case, to the Mesh that has the Element). If the component doesn't need to access the Element, this type can be void. Note: if the component is vertical (or optional), this type cannot be void.
VERTBoolean that tells if the component is vertical. If the component is vertical, this parameter must be true. Note: to be vertical, this parameter must be true, and ElementType must be the type of the Element that has the component (the 'parent' Element Type).
OPTWhen a component is vertical, it could be optional, that means that could be enabled/disabled at runtime. To make the component optional, this template parameter must be true.
TTVN"Tied To Vertex Number", this boolean tells whether the component should leave liberty to control the size of the Container to the user, or it should be tied to the vertex number and changed automatically when the number of vertices changes. E.g. a WedgeTexCoord component is a Container that should be tied to the vertex number, meaning that the number of texture coordinates should be always be the same of the number of vertices. Setting this value to true will tie the size of this container to the number of vertices.
PointedTypesVariadic Template types of all the Pointer types that the component stores, and that need to be updated when some reallocation happens.

Member Data Documentation

◆ HAS_ADDITIONAL_DATA

template<typename DerivedComponent , uint COMP_ID, typename T , int N, typename AdditionalData , typename ParentElemType , bool VERT, bool OPT, bool TTVN, typename... PointedTypes>
constexpr bool vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >::HAS_ADDITIONAL_DATA
staticconstexprprivate
Initial value:
=
!std::is_same_v<AdditionalData, void>

◆ TIED_TO_VERTEX_NUMBER

template<typename DerivedComponent , uint COMP_ID, typename T , int N, typename AdditionalData , typename ParentElemType , bool VERT, bool OPT, bool TTVN, typename... PointedTypes>
const bool vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >::TIED_TO_VERTEX_NUMBER = TTVN
static

Boolean that tells if this component stores a container having its size tied to the number of the vertices of the Element.

E.g. suppose to have a Polygonal Face f (dynamic number of vertices), having 5 vertices (and 5 edges). This means that if the Face has the AdjacentFaces component, then it should store 5 adjacent faces (the same number of the vertices). In this case, the AdjacentFaces component will have the boolean TIED_TO_VERTEX_NUMBER set to true.


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