ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper > Struct Template Reference
Inheritance diagram for ttg::SequencedKeysConstraint< Key, Ordinal, Compare, Mapper >:
ttg::ConstraintBase< Key >

Documentation

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 70 of file constraint.h.

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
 
 SequencedKeysConstraint (const SequencedKeysConstraint &skc)=default
 
SequencedKeysConstraintoperator= (SequencedKeysConstraint &&skc)=default
 
SequencedKeysConstraintoperator= (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)
 
ConstraintBaseoperator= (ConstraintBase &&cb)
 
ConstraintBaseoperator= (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)
 

Public Attributes

bool auto_release
 

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_tm_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
 

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 76 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 75 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 72 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 74 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 73 of file constraint.h.

Constructor & Destructor Documentation

◆ SequencedKeysConstraint() [1/2]

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 219 of file constraint.h.

◆ SequencedKeysConstraint() [2/2]

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 254 of file constraint.h.

◆ 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 247 of file constraint.h.

◆ 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 266 of file constraint.h.

◆ 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 260 of file constraint.h.

◆ 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 108 of file constraint.h.

◆ 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 100 of file constraint.h.

◆ 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 278 of file constraint.h.

◆ 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 272 of file constraint.h.

◆ 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 284 of file constraint.h.

◆ 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 290 of file constraint.h.

◆ 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 145 of file constraint.h.

◆ 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 104 of file constraint.h.

◆ 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 338 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 328 of file constraint.h.

◆ 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 155 of file constraint.h.

◆ 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 183 of file constraint.h.

◆ requires()

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

◆ 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 308 of file constraint.h.

◆ 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 299 of file constraint.h.

Member Data Documentation

◆ 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 >::auto_release
Initial value:
= false)
: base_t()
, m_map(std::forward<Mapper_>(map))
{ }
SequencedKeysConstraint(bool auto_release=false)
Definition: constraint.h:219
ConstraintBase< Key > base_t
Definition: constraint.h:76

Definition at line 226 of file constraint.h.

◆ 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 350 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 352 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 345 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 347 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 349 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 344 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 351 of file constraint.h.


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