DNA Calib 1.1
Project brief
Namespaces | Functions
extd Namespace Reference

Namespaces

namespace  impl
 

Functions

template<typename T >
clamp (T value, T low, T high)
 
template<typename T >
roundUp (T number, T multiple)
 
template<typename T >
interpolate (T a, T b, T weight)
 
template<class TInputIterator , class T >
bool contains (TInputIterator first, TInputIterator last, const T &value)
 
template<class TContainer , class T >
bool contains (const TContainer &container, const T &value)
 
template<class T >
bool contains (const std::set< T > &container, const T &value)
 
template<class T , class Predicate , typename ... Args>
void filter (std::vector< T, Args... > &source, Predicate pred)
 
template<class TContainer , class Predicate , typename ... Args>
void filter (TContainer &source, Predicate pred)
 
template<typename TLookUpTable >
impl::LUTFilter< TLookUpTable, impl::LUTStrategy::ByValuebyValue (const TLookUpTable &lookUpTable)
 
template<typename TLookUpTable >
impl::LUTFilter< TLookUpTable, impl::LUTStrategy::ByPositionbyPosition (const TLookUpTable &lookUpTable)
 
template<class TContainer >
TContainer::value_type maxOf (const TContainer &container)
 
template<class TSource , class TDestination >
void copy (const TSource &source, TDestination &destination)
 
template<class TIterator , typename TDistance >
TIterator advanced (TIterator source, TDistance distance)
 
template<class TIterator , class Predicate >
std::iterator_traits< TIterator >::difference_type advanceWhile (TIterator &it, const TIterator &end, Predicate pred)
 
template<class TIterator , class Predicate >
TIterator::difference_type advanceWhile (TIterator &it, const TIterator &end, Predicate pred)
 

Function Documentation

◆ advanced()

template<class TIterator , typename TDistance >
TIterator extd::advanced ( TIterator  source,
TDistance  distance 
)

◆ advanceWhile() [1/2]

template<class TIterator , class Predicate >
std::iterator_traits< TIterator >::difference_type extd::advanceWhile ( TIterator &  it,
const TIterator &  end,
Predicate  pred 
)
134 {
135 const auto start = it;
136 while (it != end && pred(*it)) {
137 ++it;
138 }
139 return std::distance(start, it);
140}

◆ advanceWhile() [2/2]

template<class TIterator , class Predicate >
TIterator::difference_type extd::advanceWhile ( TIterator &  it,
const TIterator &  end,
Predicate  pred 
)
134 {
135 const auto start = it;
136 while (it != end && pred(*it)) {
137 ++it;
138 }
139 return std::distance(start, it);
140}

◆ byPosition()

template<typename TLookUpTable >
impl::LUTFilter< TLookUpTable, impl::LUTStrategy::ByPosition > extd::byPosition ( const TLookUpTable &  lookUpTable)
inline

◆ byValue()

template<typename TLookUpTable >
impl::LUTFilter< TLookUpTable, impl::LUTStrategy::ByValue > extd::byValue ( const TLookUpTable &  lookUpTable)
inline
102 {
104}

◆ clamp()

template<typename T >
T extd::clamp ( value,
low,
high 
)
inline
25 {
26 return std::min(std::max(value, low), high);
27}

◆ contains() [1/3]

template<class T >
bool extd::contains ( const std::set< T > &  container,
const T &  value 
)
inline
50 {
51 return container.find(value) != container.end();
52}

◆ contains() [2/3]

template<class TContainer , class T >
bool extd::contains ( const TContainer &  container,
const T &  value 
)
inline
45 {
46 return contains(std::begin(container), std::end(container), value);
47}
bool contains(const std::set< T > &container, const T &value)
Definition: utils/Extd.h:50

References contains().

◆ contains() [3/3]

template<class TInputIterator , class T >
bool extd::contains ( TInputIterator  first,
TInputIterator  last,
const T &  value 
)
inline

◆ copy()

template<class TSource , class TDestination >
void extd::copy ( const TSource &  source,
TDestination &  destination 
)
inline
123 {
124 std::copy(std::begin(source), std::end(source), std::back_inserter(destination));
125}
void copy(const TSource &source, TDestination &destination)
Definition: utils/Extd.h:123

References copy().

Referenced by terse::DynArray< T, TAllocator >::assign(), copy(), tdm::vec< L, T >::operator=(), and tdm::vec< L, T >::vec().

◆ filter() [1/2]

template<class T , class Predicate , typename ... Args>
void extd::filter ( std::vector< T, Args... > &  source,
Predicate  pred 
)
inline
55 {
56 source.erase(std::remove_if(std::begin(source), std::end(source), [&source, &pred](const T& value) {
57 const auto index = static_cast<std::size_t>(&value - &(source.front()));
58 return !pred(value, index);
59 }), source.end());
60}

Referenced by dna::AnimatedMapFilter::apply(), dna::BlendShapeFilter::apply(), dna::JointFilter::apply(), dna::MeshFilter::apply(), dnac::AnimatedMapFilter::apply(), dnac::BlendShapeFilter::apply(), dnac::JointFilter::apply(), dnac::MeshFilter::apply(), dna::LODConstraint::applyTo(), dnac::LODConstraint::applyTo(), dna::LODConstraint::clampTo(), dnac::LODConstraint::clampTo(), dna::FilteredInputArchive::process(), and dnac::DNACalibDNAReaderImpl::removeMeshes().

◆ filter() [2/2]

template<class TContainer , class Predicate , typename ... Args>
void extd::filter ( TContainer &  source,
Predicate  pred 
)
inline
63 {
64 using value_type = typename TContainer::value_type;
65 auto newEnd = std::remove_if(std::begin(source), std::end(source), [&source, &pred](const value_type& value) {
66 const auto index = static_cast<std::size_t>(&value - source.data());
67 return !pred(value, index);
68 });
69 const auto newSize = static_cast<std::size_t>(std::distance(source.begin(), newEnd));
70 source.resize(newSize);
71}

◆ interpolate()

template<typename T >
T extd::interpolate ( a,
b,
weight 
)
inline
35 {
36 return a * (static_cast<T>(1) - weight) + b * weight;
37}

Referenced by dnac::OperationFactory::create().

◆ maxOf()

template<class TContainer >
TContainer::value_type extd::maxOf ( const TContainer &  container)
inline
112 {
113 assert(!container.empty());
114 using ValueType = typename TContainer::value_type;
115 const auto compare = [](const ValueType& lhs, const ValueType& rhs) {
116 return lhs.second < rhs.second;
117 };
118 const auto it = std::max_element(container.begin(), container.end(), compare);
119 return (it == container.end() ? ValueType{} : *it);
120}

Referenced by dna::JointFilter::maxRemappedIndex(), and dnac::JointFilter::maxRemappedIndex().

◆ roundUp()

template<typename T >
T extd::roundUp ( number,
multiple 
)
inline
30 {
31 return ((number + multiple - 1) / multiple) * multiple;
32}