SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
A wrapper around arc type-traits classes that provides API. More...
#include <ArcImplementation.h>
Public Types | |
using | Traits = ArcTraits |
using | Directed = typename ArcTraits::Directed |
If "truthy," this arc is considered directed rather than undirected. | |
using | FromType = typename ArcTraits::FromType |
The type of node that these arcs originate from. | |
using | ToType = typename ArcTraits::ToType |
The type of node that these arcs point to. | |
using | Ordered = typename ArcProperties< ArcTraits >::isOrdered |
If "truthy," this arc will report incoming/outgoing nodes in a (user-specified) order. | |
using | Mutable = typename ArcProperties< ArcTraits >::isMutable |
If "truthy," methods that edit arcs may sometimes return true. More... | |
using | Explicit = typename ArcProperties< ArcTraits >::isExplicit |
If "truthy," arc endpoint connections are explicitly stored by SMTK. | |
Public Member Functions | |
bool | isOrdered () const |
Return whether arcs of this type are ordered (true) or unordered (false). | |
bool | isDirected () const |
Return whether arcs of this type are directed (true) or undirected (false). | |
bool | isMutable () const |
Return whether arcs of this type may be edited. | |
bool | isExplicit () const |
Return whether arcs of this type are explicit. | |
std::string | typeName () const |
Return the type of arc this class implements. | |
template<typename Functor > | |
smtk::common::Visited | outVisitor (const FromType *from, Functor visitor) const |
Visit nodes attached via outgoing arcs. | |
template<typename Functor > | |
smtk::common::Visited | inVisitor (const ToType *to, Functor visitor) const |
Visit nodes attached via incoming arcs. More... | |
ArcEndpointInterface< ArcTraits, ConstArc, OutgoingArc > | outgoing (const FromType *from) const |
Return a "container" of outgoing arcs of the given from node. | |
ArcEndpointInterface< ArcTraits, NonConstArc, OutgoingArc > | outgoing (FromType *from) |
ArcEndpointInterface< ArcTraits, ConstArc, IncomingArc > | incoming (const ToType *to) const |
Return a "container" of incoming arcs of the given to node. | |
ArcEndpointInterface< ArcTraits, NonConstArc, IncomingArc > | incoming (ToType *to) |
template<typename U = typename ArcProperties<Traits>::template hasContains< detail::SelectArcContainer<Traits, Traits>>> | |
std::enable_if<!U::value, bool >::type | contains (const FromType *from, const ToType *to) const |
Test whether an arc from from to to exists. | |
template<typename U = typename ArcProperties<Traits>::template hasContains< detail::SelectArcContainer<Traits, Traits>>> | |
std::enable_if< U::value, bool >::type | contains (const FromType *from, const ToType *to) const |
Test whether an arc from from to to exists. | |
template<typename U = typename ArcProperties<Traits>::template hasOutNodeVisitor< detail::SelectArcContainer<Traits, Traits>>, typename ResourcePtr , typename Functor > | |
std::enable_if<!U::value, smtk::common::Visited >::type | visitAllOutgoingNodes (ResourcePtr rsrc, Functor ff) const |
Visit all nodes which have outgoing arcs of this type. More... | |
template<typename U = typename ArcProperties<Traits>::template hasOutNodeVisitor< detail::SelectArcContainer<Traits, Traits>>, typename ResourcePtr , typename Functor > | |
std::enable_if< U::value, smtk::common::Visited >::type | visitAllOutgoingNodes (ResourcePtr rsrc, Functor ff) const |
Visit all nodes which have outgoing arcs of this type. More... | |
template<typename U = typename ArcProperties<Traits>::template hasInNodeVisitor< detail::SelectArcContainer<Traits, Traits>>, typename ResourcePtr , typename Functor > | |
std::enable_if<!U::value, smtk::common::Visited >::type | visitAllIncomingNodes (ResourcePtr rsrc, Functor ff) const |
Visit all nodes which have incoming arcs of this type. More... | |
template<typename U = typename ArcProperties<Traits>::template hasInNodeVisitor< detail::SelectArcContainer<Traits, Traits>>, typename ResourcePtr , typename Functor > | |
std::enable_if< U::value, smtk::common::Visited >::type | visitAllIncomingNodes (ResourcePtr rsrc, Functor ff) const |
Visit all nodes which have incoming arcs of this type. More... | |
template<typename U = Mutable> | |
std::enable_if<!U::value, bool >::type | connect (const FromType *from, const ToType *to, const FromType *beforeFrom=nullptr, const ToType *beforeTo=nullptr) |
Insert an arc from from to to, optionally ordered by beforeFrom and beforeTo. More... | |
template<typename U = Mutable> | |
std::enable_if< U::value, bool >::type | connect (const FromType *from, const ToType *to, const FromType *beforeFrom=nullptr, const ToType *beforeTo=nullptr) |
Insert an arc from from to to, optionally ordered by beforeFrom and beforeTo. More... | |
template<typename U = Mutable> | |
std::enable_if<!U::value, bool >::type | disconnect (const FromType *from, const ToType *to) |
Remove an arc from from to to. | |
template<typename U = Mutable> | |
std::enable_if< U::value, bool >::type | disconnect (const FromType *from, const ToType *to) |
Remove an arc from from to to. | |
template<typename U = typename ArcProperties<Traits>::template hasOutDegree< detail::SelectArcContainer<Traits, Traits>>, typename V = typename ArcProperties<detail::SelectArcContainer<Traits, Traits>>::isAutoUndirected> | |
std::enable_if<!U::value &&!V::value, std::size_t >::type | outDegree (const FromType *from) const |
Compute the out-degree of the node. | |
template<typename U = typename ArcProperties<Traits>::template hasOutDegree< detail::SelectArcContainer<Traits, Traits>>, typename V = typename ArcProperties<detail::SelectArcContainer<Traits, Traits>>::isAutoUndirected> | |
std::enable_if<!U::value &&V::value, std::size_t >::type | outDegree (const FromType *from) const |
Compute the out-degree of the node. | |
template<typename U = typename ArcProperties<Traits>::template hasOutDegree< detail::SelectArcContainer<Traits, Traits>>> | |
std::enable_if< U::value, std::size_t >::type | outDegree (const FromType *from) const |
Compute the out-degree of the node. | |
template<typename U = typename ArcProperties<Traits>::template hasInDegree< detail::SelectArcContainer<Traits, Traits>>, typename V = typename ArcProperties<detail::SelectArcContainer<Traits, Traits>>::isAutoUndirected> | |
std::enable_if<!U::value &&!V::value, std::size_t >::type | inDegree (const ToType *to) const |
Compute the in-degree of the node. | |
template<typename U = typename ArcProperties<Traits>::template hasInDegree< detail::SelectArcContainer<Traits, Traits>>, typename V = typename ArcProperties<detail::SelectArcContainer<Traits, Traits>>::isAutoUndirected> | |
std::enable_if<!U::value &&V::value, std::size_t >::type | inDegree (const ToType *to) const |
Compute the in-degree of the node. | |
template<typename U = typename ArcProperties<Traits>::template hasInDegree< detail::SelectArcContainer<Traits, Traits>>> | |
std::enable_if< U::value, std::size_t >::type | inDegree (const ToType *to) const |
Compute the in-degree of the node. | |
Static Public Attributes | |
static constexpr std::size_t | MinOutDegree = minOutDegree<ArcTraits>(unconstrained()) |
The minimum out-degree of a FromType node. This is not enforced. | |
static constexpr std::size_t | MinInDegree = minInDegree<ArcTraits>(unconstrained()) |
The minimum in-degree of a ToType node. This is not enforced. | |
static constexpr std::size_t | MaxOutDegree = maxOutDegree<ArcTraits>(unconstrained()) |
The maximum out-degree of a FromType node. This is enforced. | |
static constexpr std::size_t | MaxInDegree = maxInDegree<ArcTraits>(unconstrained()) |
The maximum in-degree of a ToType node. This is enforced. | |
Protected Member Functions | |
template<typename Functor , bool IsBidirectional = !ArcProperties<ArcTraits>::isOnlyForwardIndexed::value> | |
smtk::common::Visited | inVisitorDetail (const ToType *to, Functor visitor) const |
Protected Attributes | |
detail::SelectArcContainer< ArcTraits, ArcTraits > | m_data |
Store arc endpoint data. More... | |
A wrapper around arc type-traits classes that provides API.
Arc traits may not provide implementations for all methods (or indeed, any at all in the case of explicit arcs). This class either forwards calls to the traits object or provides implementations for methods itself.
using smtk::graph::ArcImplementation< ArcTraits >::Mutable = typename ArcProperties<ArcTraits>::isMutable |
If "truthy," methods that edit arcs may sometimes return true.
If "falsey," methods for editing arcs will always return false. This type can be used to optimize at compile time (by omitting code that tests the return value of methods like connect, disconnect, erase, clear, etc.).
|
inline |
Insert an arc from from to to, optionally ordered by beforeFrom and beforeTo.
If the arc is ordered, then beforeFrom indicates where from should be placed in the order of incoming nodes and similarly for beforeTo and to. If the arc is not ordered, then beforeFrom and beforeTo are ignored.
|
inline |
Insert an arc from from to to, optionally ordered by beforeFrom and beforeTo.
If the arc is ordered, then beforeFrom indicates where from should be placed in the order of incoming nodes and similarly for beforeTo and to. If the arc is not ordered, then beforeFrom and beforeTo are ignored.
|
inline |
Visit nodes attached via incoming arcs.
This method will only be provided for
|
inline |
Visit all nodes which have incoming arcs of this type.
If the traits object does not provide its own implementation, the ArcImplementation will simply visit all nodes of type ToType and invoke the visitor on each.
The intent is for traits objects to provide a fast method that only visits nodes which have incoming arcs of this type.
|
inline |
Visit all nodes which have incoming arcs of this type.
If the traits object does not provide its own implementation, the ArcImplementation will simply visit all nodes of type ToType and invoke the visitor on each.
The intent is for traits objects to provide a fast method that only visits nodes which have incoming arcs of this type.
|
inline |
Visit all nodes which have outgoing arcs of this type.
If the traits object does not provide its own implementation, the ArcImplementation will simply visit all nodes of type FromType and invoke the visitor on each.
The intent is for traits objects to provide a fast method that only visits nodes which have outgoing arcs of this type.
|
inline |
Visit all nodes which have outgoing arcs of this type.
If the traits object does not provide its own implementation, the ArcImplementation will simply visit all nodes of type FromType and invoke the visitor on each.
The intent is for traits objects to provide a fast method that only visits nodes which have outgoing arcs of this type.
|
protected |
Store arc endpoint data.
This will be either ArcTraits or ExplicitArcs<ArcTraits>, depending on whether ArcTraits is implicit or explicit. If ArcTraits is implicit, m_data will typically not store components or their IDs directly. If ArcTraits is explicit, m_data will hold a multi-index container of arc endpoints.