MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_dimension_index_for_role()

size_t MayaFlux::Kakshya::ContainerDataStructure::get_dimension_index_for_role ( const std::vector< DataDimension > &  dimensions,
DataDimension::Role  role 
) const

Find the index of a dimension with the specified role.

Parameters
dimensionsVector of dimension descriptors to search
roleDimension role to find
Returns
Index of the dimension with the specified role

Definition at line 143 of file NDimensionalContainer.cpp.

145{
146 auto expected_roles = get_expected_dimension_roles();
147
148 auto it = std::ranges::find(expected_roles, role);
149 if (it != expected_roles.end()) {
150 return std::distance(expected_roles.begin(), it);
151 }
152
153 for (size_t i = 0; i < dimensions.size(); ++i) {
154 if (dimensions[i].role == role) {
155 return i;
156 }
157 }
158
159 return SIZE_MAX;
160}
std::vector< DataDimension::Role > get_expected_dimension_roles() const
Get the expected dimension roles for this structure's modality.

References dimensions, and get_expected_dimension_roles().

+ Here is the call graph for this function: