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

◆ slice() [1/2]

std::optional< CompositeSlice > MayaFlux::Kakshya::CompositeAccess::slice ( const Region &  region) const

Borrow the elements selected by a one-dimensional Region.

Parameters
regionInclusive element bounds and optional Region attributes.
Returns
Slice retaining the Region, or std::nullopt for invalid bounds.

Definition at line 83 of file CompositeAccess.cpp.

84{
85 if (region.start_coordinates.size() != 1 || region.end_coordinates.size() != 1)
86 return std::nullopt;
87
88 const auto start = region.start_coordinates[0];
89 const auto end = region.end_coordinates[0];
90
91 if (start > end || end >= size())
92 return std::nullopt;
93
94 return CompositeSlice(*this, static_cast<size_t>(start),
95 static_cast<size_t>(end - start + 1), region);
96}
size_t size() const noexcept
Number of packed elements in the current element store.

References MayaFlux::Kakshya::Region::end_coordinates, size(), and MayaFlux::Kakshya::Region::start_coordinates.

+ Here is the call graph for this function: