DATAKIT SDK  V2026.1
dtk Namespace Reference

Data Structures

struct  DynamicExtent
 Numeric wrapping type denoting the dynamic nature of a size. More...
 
class  Span
 
class  Span< T, DynamicExtent::value >
 Lightweight view over a contiguous sequence of objects. More...
 

Typedefs

typedef Span< char const > ConstBuffer
 
typedef Span< char > MutableBuffer
 

Functions

template<typename T , class Predicate >
bool all_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<class InputIterator , class Predicate >
bool all_of (InputIterator first, InputIterator last, Predicate Pred)
 Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<typename T , class Predicate >
bool any_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty. More...
 
template<class InputIterator , class Predicate >
bool any_of (InputIterator first, InputIterator last, Predicate Pred)
 Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty. More...
 
template<class Range >
auto as_buffer (Range &&range) -> decltype(as_buffer(std::forward< Range >(range).data(), std::forward< Range >(range).size()))
 
template<class T >
auto as_buffer (T *data, std::size_t n) DTK_NOEXCEPT -> MutableBuffer
 
template<class T >
auto as_buffer (T const *data, std::size_t n) DTK_NOEXCEPT -> ConstBuffer
 
template<class Range >
auto as_const_buffer (Range &&range) -> ConstBuffer
 
template<class T >
auto as_const_buffer (T *data, std::size_t n) DTK_NOEXCEPT -> ConstBuffer
 
template<class T >
auto as_const_buffer (T const *data, std::size_t n) DTK_NOEXCEPT -> ConstBuffer
 
template<class Range >
auto as_const_span (Range &&range) -> Span< typename std::add_const< typename std::remove_pointer< decltype(std::forward< Range >(range).data())>::type >::type >
 
template<class T >
auto as_const_span (T *data, std::size_t n) DTK_NOEXCEPT -> Span< T const >
 
template<class T >
auto as_const_span (T const *data, std::size_t n) DTK_NOEXCEPT -> Span< T const >
 
template<class Range >
auto as_span (Range &&range) -> Span< typename std::remove_pointer< decltype(std::forward< Range >(range).data())>::type >
 
template<class T >
auto as_span (T *data, std::size_t n) DTK_NOEXCEPT -> Span< T >
 
template<class T >
auto as_span (T const *data, std::size_t n) DTK_NOEXCEPT -> Span< T const >
 
template<typename T , class Predicate >
bool none_of (const Dtk_tab< T > &tab, Predicate Pred)
 Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 
template<class InputIterator , class Predicate >
bool none_of (InputIterator first, InputIterator last, Predicate Pred)
 Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise. More...
 

Typedef Documentation

◆ ConstBuffer

typedef Span<char const> dtk::ConstBuffer

◆ MutableBuffer

typedef Span<char> dtk::MutableBuffer

Function Documentation

◆ all_of() [1/2]

template<typename T , class Predicate >
bool dtk::all_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1009  {
1010  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1011  if(!Pred(tab[i]))
1012  return false;
1013  return true;
1014  }

◆ all_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::all_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test condition on all elements in range, and returns true if pred returns true for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
994  { // test if all elements satisfy _Pred
995  for (; first != last; ++first)
996  if (!Pred(*first))
997  return false;
998  return true;
999  }

◆ any_of() [1/2]

template<typename T , class Predicate >
bool dtk::any_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1038  {
1039  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1040  if(Pred(tab[i]))
1041  return true;
1042  return false;
1043  }

◆ any_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::any_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test if any element in range fulfills condition, returns true if pred returns true for any of the elements in the range [first,last], and false otherwise or if the range is empty.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
1023  {
1024  for(; first != last; ++first)
1025  if(Pred(*first))
1026  return true;
1027  return false;
1028  }

◆ as_buffer() [1/3]

template<class Range >
auto dtk::as_buffer ( Range &&  range) -> decltype( as_buffer( std::forward<Range>( range ).data(), std::forward<Range>( range ).size() ) )
154  {
155  return as_buffer( std::forward<Range>( range ).data(), std::forward<Range>( range ).size() );
156  }

◆ as_buffer() [2/3]

template<class T >
auto dtk::as_buffer ( T *  data,
std::size_t  n 
) -> MutableBuffer
146  {
147  return MutableBuffer( reinterpret_cast<char*>( data ), n * sizeof( T ) );
148  }

◆ as_buffer() [3/3]

template<class T >
auto dtk::as_buffer ( T const *  data,
std::size_t  n 
) -> ConstBuffer
150  {
151  return ConstBuffer( reinterpret_cast<char const*>( data ), n * sizeof( T ) );
152  }

◆ as_const_buffer() [1/3]

template<class Range >
auto dtk::as_const_buffer ( Range &&  range) -> ConstBuffer
141  {
142  typedef typename std::remove_pointer<decltype( std::forward<Range>( range ).data() )>::type Element;
143  return ConstBuffer( reinterpret_cast< char const* >( std::forward<Range>( range ).data() ), std::forward<Range>( range ).size() * sizeof( Element ) );
144  }

◆ as_const_buffer() [2/3]

template<class T >
auto dtk::as_const_buffer ( T *  data,
std::size_t  n 
) -> ConstBuffer
133  {
134  return ConstBuffer( reinterpret_cast< char const* >( data ), n * sizeof( T ) );
135  }

◆ as_const_buffer() [3/3]

template<class T >
auto dtk::as_const_buffer ( T const *  data,
std::size_t  n 
) -> ConstBuffer
137  {
138  return ConstBuffer( reinterpret_cast< char const* >( data ), n * sizeof( T ) );
139  }

◆ as_const_span() [1/3]

template<class Range >
auto dtk::as_const_span ( Range &&  range) -> Span<typename std::add_const<typename std::remove_pointer<decltype( std::forward<Range>( range ).data() )>::type>::type>
105  {
106  return Span<typename std::add_const<typename std::remove_pointer<decltype( std::forward<Range>( range ).data() )>::type>::type>( std::forward<Range>( range ) );
107  }

◆ as_const_span() [2/3]

template<class T >
auto dtk::as_const_span ( T *  data,
std::size_t  n 
) -> Span<T const>
109  {
110  return Span<T const>( data, n );
111  }

◆ as_const_span() [3/3]

template<class T >
auto dtk::as_const_span ( T const *  data,
std::size_t  n 
) -> Span<T const>
113  {
114  return Span<T const>( data, n );
115  }

◆ as_span() [1/3]

template<class Range >
auto dtk::as_span ( Range &&  range) -> Span<typename std::remove_pointer<decltype( std::forward<Range>( range ).data() )>::type>
117  {
118  return Span<typename std::remove_pointer<decltype( std::forward<Range>( range ).data() )>::type>( std::forward<Range>( range ) );
119  }

◆ as_span() [2/3]

template<class T >
auto dtk::as_span ( T *  data,
std::size_t  n 
) -> Span<T>
121  {
122  return Span<T>( data, n );
123  }

◆ as_span() [3/3]

template<class T >
auto dtk::as_span ( T const *  data,
std::size_t  n 
) -> Span<T const>
125  {
126  return Span<T const>( data, n );
127  }

◆ none_of() [1/2]

template<typename T , class Predicate >
bool dtk::none_of ( const Dtk_tab< T > &  tab,
Predicate  Pred 
)

Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
Specialized version for Dtk_tab.
1067  {
1068  for(Dtk_Size_t i = 0; i < tab.size(); ++i)
1069  if(Pred(tab[i]))
1070  return false;
1071  return true;
1072  }

◆ none_of() [2/2]

template<class InputIterator , class Predicate >
bool dtk::none_of ( InputIterator  first,
InputIterator  last,
Predicate  Pred 
)

Test if no elements fulfill condition, returns true if pred returns false for all the elements in the range [first,last] or if the range is empty, and false otherwise.

Parameters
firstInput iterator to the initial position in a sequence
lastInput iterator to the final position in a sequence
PredUnary function that accepts an element in the range as argument and returns a value convertible to bool.
Remarks
Note that invalid parameters cause undefined behavior.
1052  {
1053  for (; first != last; ++first)
1054  if (Pred(*first))
1055  return false;
1056  return true;
1057  }
dtk::as_buffer
auto as_buffer(Range &&range) -> decltype(as_buffer(std::forward< Range >(range).data(), std::forward< Range >(range).size()))
Definition: span.hpp:153
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:715
dtk::MutableBuffer
Span< char > MutableBuffer
Definition: span.hpp:129
dtk::ConstBuffer
Span< char const > ConstBuffer
Definition: span.hpp:130
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503