ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > Struct Template Reference

#include <constraint.h>

Inheritance diagram for ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >:
[legend]
Collaboration diagram for ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >:
[legend]

Classes

struct  sequence_elem_t
 

Public Types

using key_type = std::conditional_t< ttg::meta::is_void_v< Key >, ttg::Void, Key >
 
using ordinal_type = Ordinal
 
using keymap_t = std::function< Ordinal(const key_type &)>
 
using compare_t = Compare
 
using base_t = ConstraintBase< Key >
 
- Public Types inherited from ttg::ConstraintBase< Key >
using key_type = Key
 
using listener_t = std::function< void(const ttg::span< key_type > &)>
 

Public Member Functions

 SequencedKeysConstraint (bool auto_release=false)
 
template<typename Mapper_ >
requires (std::is_invocable_v<Mapper_, Key>)
 SequencedKeysConstraint (Mapper_ &&map, bool auto_release=false)
 
 SequencedKeysConstraint (SequencedKeysConstraint &&skc)=default
 
 SequencedKeysConstraint (const SequencedKeysConstraint &skc)=default
 
SequencedKeysConstraint & operator= (SequencedKeysConstraint &&skc)=default
 
SequencedKeysConstraint & operator= (const SequencedKeysConstraint &skc)=default
 
virtual ~SequencedKeysConstraint ()=default
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ >, bool > check (const key_type &key, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ >, bool > check (const key_type &key, Ordinal ord, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t< ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ >, bool > check (ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t< ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ >, bool > check (ordinal_type ord, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ > > complete (const key_type &key, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ > > complete (const key_type &key, Ordinal ord, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ > > complete (Ordinal ord, ttg::TTBase *tt)
 
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ > > complete (ttg::TTBase *tt)
 
void stop ()
 
void start ()
 
void release (ordinal_type ord=0)
 
bool is_auto () const
 
- Public Member Functions inherited from ttg::ConstraintBase< Key >
 ConstraintBase ()
 
 ConstraintBase (ConstraintBase &&cb)
 
 ConstraintBase (const ConstraintBase &cb)
 
ConstraintBase & operator= (ConstraintBase &&cb)
 
ConstraintBase & operator= (const ConstraintBase &cb)
 
virtual ~ConstraintBase ()=default
 
void add_listener (listener_t l, ttg::TTBase *tt)
 
void notify_listener (const ttg::span< key_type > &keys, ttg::TTBase *tt)
 

Protected Member Functions

bool comp_equal (const Ordinal &a, const Ordinal &b) const
 
bool eligible (const Ordinal &ord) const
 
bool check_key_impl (const key_type &key, Ordinal ord, ttg::TTBase *tt)
 
void complete_key_impl ()
 
void release_next ()
 
void release_next (ordinal_type ord, bool force_check=false)
 
- Protected Member Functions inherited from ttg::ConstraintBase< Key >
auto lock_guard ()
 

Protected Attributes

std::map< ordinal_type, sequence_elem_t, compare_t > m_sequence
 
ordinal_type m_current = std::numeric_limits<ordinal_type>::min()
 
Mapper m_map
 
compare_t m_order
 
std::atomic< std::size_t > m_active
 
bool m_stopped = false
 
bool m_auto_release = false
 

Detailed Description

template<typename Key, typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
struct ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >

Definition at line 67 of file constraint.h.

Member Typedef Documentation

◆ base_t

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
using ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::base_t = ConstraintBase<Key>

Definition at line 73 of file constraint.h.

◆ compare_t

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
using ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::compare_t = Compare

Definition at line 72 of file constraint.h.

◆ key_type

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
using ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::key_type = std::conditional_t<ttg::meta::is_void_v<Key>, ttg::Void, Key>

Definition at line 69 of file constraint.h.

◆ keymap_t

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
using ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::keymap_t = std::function<Ordinal(const key_type&)>

Definition at line 71 of file constraint.h.

◆ ordinal_type

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
using ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::ordinal_type = Ordinal

Definition at line 70 of file constraint.h.

Constructor & Destructor Documentation

◆ SequencedKeysConstraint() [1/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::SequencedKeysConstraint ( bool  auto_release = false)
inline

Used for external key mapper.

Definition at line 216 of file constraint.h.

◆ SequencedKeysConstraint() [2/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Mapper_ >
requires (std::is_invocable_v<Mapper_, Key>)
ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::SequencedKeysConstraint ( Mapper_ &&  map,
bool  auto_release = false 
)
inline

Definition at line 223 of file constraint.h.

◆ SequencedKeysConstraint() [3/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::SequencedKeysConstraint ( SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > &&  skc)
default

◆ SequencedKeysConstraint() [4/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::SequencedKeysConstraint ( const SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > &  skc)
default

◆ ~SequencedKeysConstraint()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
virtual ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::~SequencedKeysConstraint ( )
virtualdefault

Member Function Documentation

◆ check() [1/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ >, bool > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::check ( const key_type &  key,
Ordinal  ord,
ttg::TTBase *  tt 
)
inline

Definition at line 251 of file constraint.h.

Here is the call graph for this function:

◆ check() [2/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ >, bool > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::check ( const key_type &  key,
ttg::TTBase *  tt 
)
inline

Definition at line 244 of file constraint.h.

Here is the call graph for this function:

◆ check() [3/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t< ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ >, bool > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::check ( ordinal_type  ord,
ttg::TTBase *  tt 
)
inline

Definition at line 263 of file constraint.h.

Here is the call graph for this function:

◆ check() [4/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t< ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ >, bool > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::check ( ttg::TTBase *  tt)
inline

Definition at line 257 of file constraint.h.

Here is the call graph for this function:

◆ check_key_impl()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::check_key_impl ( const key_type &  key,
Ordinal  ord,
ttg::TTBase *  tt 
)
inlineprotected

Definition at line 105 of file constraint.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ comp_equal()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::comp_equal ( const Ordinal &  a,
const Ordinal &  b 
) const
inlineprotected

Definition at line 97 of file constraint.h.

Here is the caller graph for this function:

◆ complete() [1/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ > > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::complete ( const key_type &  key,
Ordinal  ord,
ttg::TTBase *  tt 
)
inline

Definition at line 275 of file constraint.h.

Here is the call graph for this function:

◆ complete() [2/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ > > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::complete ( const key_type &  key,
ttg::TTBase *  tt 
)
inline

Definition at line 269 of file constraint.h.

Here is the call graph for this function:

◆ complete() [3/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&ttg::meta::is_void_v< Mapper_ > > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::complete ( Ordinal  ord,
ttg::TTBase *  tt 
)
inline

Definition at line 281 of file constraint.h.

Here is the call graph for this function:

◆ complete() [4/4]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
template<typename Key_ = key_type, typename Mapper_ = Mapper>
std::enable_if_t<!ttg::meta::is_void_v< Key_ > &&!ttg::meta::is_void_v< Mapper_ > > ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::complete ( ttg::TTBase *  tt)
inline

Definition at line 287 of file constraint.h.

Here is the call graph for this function:

◆ complete_key_impl()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::complete_key_impl ( )
inlineprotected

Definition at line 142 of file constraint.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eligible()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::eligible ( const Ordinal &  ord) const
inlineprotected

Definition at line 101 of file constraint.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_auto()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::is_auto ( ) const
inline

Definition at line 335 of file constraint.h.

◆ operator=() [1/2]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
SequencedKeysConstraint & ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::operator= ( const SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > &  skc)
default

◆ operator=() [2/2]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
SequencedKeysConstraint & ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::operator= ( SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > &&  skc)
default

◆ release()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::release ( ordinal_type  ord = 0)
inline

Release tasks up to the ordinal. The provided ordinal is ignored if auto_release is enabled.

Definition at line 325 of file constraint.h.

Here is the call graph for this function:

◆ release_next() [1/2]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::release_next ( )
inlineprotected

Definition at line 152 of file constraint.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ release_next() [2/2]

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::release_next ( ordinal_type  ord,
bool  force_check = false 
)
inlineprotected

Definition at line 180 of file constraint.h.

Here is the call graph for this function:

◆ start()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::start ( )
inline

Start execution. This constraint is not stopped by default so calls to start are only necessary if explictily stopped.

Definition at line 305 of file constraint.h.

Here is the call graph for this function:

◆ stop()

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
void ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::stop ( )
inline

Stop all execution. Call start to resume. This constraint is not stopped by default so calls to start are only necessary if explictily stopped.

Definition at line 296 of file constraint.h.

Member Data Documentation

◆ m_active

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
std::atomic<std::size_t> ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_active
protected

Definition at line 347 of file constraint.h.

◆ m_auto_release

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_auto_release = false
protected

Definition at line 349 of file constraint.h.

◆ m_current

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
ordinal_type ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_current = std::numeric_limits<ordinal_type>::min()
protected

Definition at line 342 of file constraint.h.

◆ m_map

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
Mapper ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_map
protected

Definition at line 344 of file constraint.h.

◆ m_order

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
compare_t ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_order
protected

Definition at line 346 of file constraint.h.

◆ m_sequence

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
std::map<ordinal_type, sequence_elem_t, compare_t> ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_sequence
protected

Definition at line 341 of file constraint.h.

◆ m_stopped

template<typename Key , typename Ordinal = std::size_t, typename Compare = std::less<Ordinal>, typename Mapper = ttg::Void>
bool ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >::m_stopped = false
protected

Definition at line 348 of file constraint.h.


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