SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_graph_ArcImplementation_h
12 #define smtk_graph_ArcImplementation_h
17 #include "smtk/graph/detail/TypeTraits.h"
19 #include "smtk/graph/RuntimeArcEndpoint.h"
23 #include "smtk/graph/ArcImplementationBase.h"
24 #include "smtk/resource/Component.h"
25 #include "smtk/string/Token.h"
27 #include "smtk/common/CompilerInformation.h"
34 #if defined(_MSC_VER_FULL) && _MSC_FULL_VER < 192930040
35 __pragma(warning(push))
36 __pragma(warning(disable : 4348))
45 template<Directionality>
49 template<
typename TraitsType>
51 template<
typename TraitsType,
typename Const,
typename Outgoing>
60 template<
typename ArcTraits>
64 using Traits = ArcTraits;
77 using ToType =
typename ArcTraits::ToType;
92 static constexpr std::size_t MinOutDegree = minOutDegree<ArcTraits>(
unconstrained());
94 static constexpr std::size_t MinInDegree = minInDegree<ArcTraits>(
unconstrained());
96 static constexpr std::size_t MaxOutDegree = maxOutDegree<ArcTraits>(
unconstrained());
98 static constexpr std::size_t MaxInDegree = maxInDegree<ArcTraits>(
unconstrained());
100 Directed::value || !std::is_same<FromType, ToType>::value ||
101 (MaxOutDegree == MaxInDegree && MinOutDegree == MinInDegree),
103 Undirected arcs with identical From/To types must
104 have identical in- and out-degree constraints.)");
119 std::string
typeName()
const override {
return smtk::common::typeName<ArcTraits>(); }
123 return this->isDirected() ? Directionality::IsDirected : Directionality::IsUndirected;
125 bool mutability()
const override {
return this->isMutable(); }
126 bool explicitStorage()
const override {
return this->isExplicit(); }
130 typename U =
typename ArcProperties<ArcTraits>::template hasFromNodeSpecs<ArcTraits>::type>
131 typename std::enable_if<!U::value, std::unordered_set<smtk::string::Token>>::type _fromTypes()
134 return { { (
"'" + smtk::common::typeName<typename ArcTraits::FromType>() +
"'") } };
138 typename U =
typename ArcProperties<ArcTraits>::template hasFromNodeSpecs<ArcTraits>::type>
139 typename std::enable_if<U::value, std::unordered_set<smtk::string::Token>>::type _fromTypes()
142 return m_data.traits().m_fromNodeSpecs;
146 typename U =
typename ArcProperties<ArcTraits>::template hasToNodeSpecs<ArcTraits>::type>
147 typename std::enable_if<!U::value, std::unordered_set<smtk::string::Token>>::type _toTypes()
150 return { { (
"'" + smtk::common::typeName<typename ArcTraits::ToType>() +
"'") } };
154 typename U =
typename ArcProperties<ArcTraits>::template hasToNodeSpecs<ArcTraits>::type>
155 typename std::enable_if<U::value, std::unordered_set<smtk::string::Token>>::type _toTypes()
158 return m_data.traits().m_toNodeSpecs;
162 std::unordered_set<smtk::string::Token> fromTypes()
const override
164 return this->_fromTypes();
167 std::unordered_set<smtk::string::Token> toTypes()
const override {
return this->_toTypes(); }
187 typename std::enable_if<U::value, bool>::type
empty()
const
189 auto result = m_data.size();
196 typename std::enable_if<!U::value, bool>::type
empty()
const
209 template<
typename TraitsType>
217 return self->inVisitor(node, [&](
const FromType* from) {
return visitor(from); });
221 template<
typename TraitsType>
239 const auto* properType =
dynamic_cast<const FromType*
>(from);
250 [
this](
bool isMax) {
return isMax ? maximumOutDegree() : minimumOutDegree(); },
252 [
this, properType]() {
return this->outDegree(properType); },
254 [
this, properType](
const Component* to) {
255 if (
const auto* properTo =
dynamic_cast<const ToType*
>(to))
257 return this->contains(properType, properTo);
264 [
this, properType](
const Component*) {
return false; },
267 return this->outVisitor(properType, [&](
const ToType* node) {
return visitor(node); });
273 const auto* properType =
dynamic_cast<const FromType*
>(from);
284 [
this](
bool isMax) {
return isMax ? maximumOutDegree() : minimumOutDegree(); },
286 [
this, properType]() {
return this->outDegree(properType); },
288 [
this, properType](
const Component* to) {
289 if (
const auto* properTo =
dynamic_cast<const ToType*
>(to))
291 return this->contains(properType, properTo);
299 (beforeTo && !
dynamic_cast<const ToType*
>(beforeTo)) ||
300 (beforeFrom && !
dynamic_cast<const FromType*
>(beforeFrom)))
305 if (
const auto* properTo =
dynamic_cast<const ToType*
>(to))
311 dynamic_cast<const FromType*
>(beforeFrom),
312 dynamic_cast<const ToType*
>(beforeTo));
317 [
this, properType](
const Component* to) {
318 if (
const auto* properTo =
dynamic_cast<const ToType*
>(to))
321 return self->
disconnect(properType, properTo);
327 return this->outVisitor(properType, [&](
const ToType* node) {
return visitor(node); });
337 const auto* properType =
dynamic_cast<const ToType*
>(to);
348 [
this](
bool isMax) {
return isMax ? maximumInDegree() : minimumInDegree(); },
350 [
this, properType]() {
351 std::size_t result = 0;
356 RuntimeInVisitor<ArcTraits>()(
this, properType, [&result](
const Component*) {
363 [
this, properType](
const Component* from) {
364 if (
const auto* properFrom =
dynamic_cast<const FromType*
>(from))
366 return this->contains(properFrom, properType);
373 [
this, properType](
const Component*) {
return false; },
376 return RuntimeInVisitor<ArcTraits>()(
this, properType, visitor);
382 const auto* properType =
dynamic_cast<const ToType*
>(to);
393 [
this](
bool isMax) {
return isMax ? maximumInDegree() : minimumInDegree(); },
395 [
this, properType]() {
396 std::size_t result = 0;
401 RuntimeInVisitor<ArcTraits>()(
this, properType, [&result](
const Component*) {
408 [
this, properType](
const Component* from) {
409 if (
const auto* properFrom =
dynamic_cast<const FromType*
>(from))
411 return this->contains(properFrom, properType);
419 (beforeTo && !
dynamic_cast<const ToType*
>(beforeTo)) ||
420 (beforeFrom && !
dynamic_cast<const FromType*
>(beforeFrom)))
425 if (
const auto* properFrom =
dynamic_cast<const FromType*
>(from))
431 dynamic_cast<const FromType*
>(beforeFrom),
432 dynamic_cast<const ToType*
>(beforeTo));
437 [
this, properType](
const Component* from) {
438 if (
auto* properFrom =
dynamic_cast<const FromType*
>(from))
441 return self->
disconnect(properFrom, properType);
447 return RuntimeInVisitor<ArcTraits>()(
this, properType, visitor);
469 this->outVisitor(from, [&result, &to](
const ToType* node) {
486 bool result = m_data.contains(from, to);
504 typename ResourcePtr,
519 std::function<void(
const std::shared_ptr<smtk::resource::Component>&)> compVisitor =
521 if (
const auto* node =
dynamic_cast<const typename Traits::FromType*
>(component.get()))
526 rsrc->visit(compVisitor);
534 typename ResourcePtr,
549 RuntimeNodeVisitor visitor)
const override
552 return this->visitAllOutgoingNodes(
554 [&](
const typename Traits::FromType* node) {
return visitor(node); });
570 typename ResourcePtr,
585 std::function<void(
const std::shared_ptr<smtk::resource::Component>&)> compVisitor =
587 if (
const auto* node =
dynamic_cast<const typename Traits::ToType*
>(component.get()))
592 rsrc->visit(compVisitor);
600 typename ResourcePtr,
626 typename std::enable_if<U::value, bool>::type
accepts(
629 const FromType* beforeFrom =
nullptr,
630 const ToType* beforeTo =
nullptr)
const
632 return m_data.accepts(from, to, beforeFrom, beforeTo);
638 typename std::enable_if<!U::value, bool>::type
accepts(
641 const FromType* beforeFrom =
nullptr,
642 const ToType* beforeTo =
nullptr)
const
650 if (MaxOutDegree !=
unconstrained() && this->outDegree(from) + 1 >= MaxOutDegree)
659 this->inDegree(to) + 1 >= MaxInDegree)
664 if (this->contains(from, to))
675 bool ok = this->accepts(
676 dynamic_cast<const FromType*
>(from),
677 dynamic_cast<const ToType*
>(to),
678 dynamic_cast<const FromType*
>(beforeFrom),
679 dynamic_cast<const ToType*
>(beforeTo));
692 template<
typename U = Mutable>
694 typename std::enable_if<!U::value, bool>::type
connect(
697 const FromType* beforeFrom =
nullptr,
698 const ToType* beforeTo =
nullptr)
707 template<
typename U = Mutable>
708 typename std::enable_if<U::value, bool>::type
connect(
711 const FromType* beforeFrom =
nullptr,
712 const ToType* beforeTo =
nullptr)
714 bool result = m_data.connect(from, to, beforeFrom, beforeTo);
722 template<
typename U = Mutable>
733 template<
typename U = Mutable>
736 bool result = m_data.disconnect(from, to);
742 template<
typename Functor>
745 return m_data.outVisitor(from, visitor);
756 typename std::enable_if<!U::value && !V::value, std::size_t>::type
outDegree(
762 std::size_t result = 0;
767 this->outVisitor(from, [&result](
const ToType*) { ++result; });
776 typename std::enable_if<!U::value && V::value, std::size_t>::type
outDegree(
782 std::size_t result = 0;
787 this->outVisitor(from, [&result](
const ToType*) { ++result; });
792 reinterpret_cast<const ToType*
>(from), [&result](
const FromType*) { ++result; });
802 std::size_t result = m_data.outDegree(from);
815 typename std::enable_if<!U::value && !V::value, std::size_t>::type
inDegree(
821 std::size_t result = 0;
826 this->inVisitor(to, [&result](
const FromType*) { ++result; });
835 typename std::enable_if<!U::value && V::value, std::size_t>::type
inDegree(
841 std::size_t result = 0;
846 this->inVisitor(to, [&result](
const ToType*) { ++result; });
850 this->inVisitor(
reinterpret_cast<const ToType*
>(to), [&result](
const ToType*) { ++result; });
858 typename std::enable_if<U::value, std::size_t>::type
inDegree(
const ToType* to)
const
860 std::size_t result = m_data.inDegree(to);
872 return m_data.inVisitor(to, visitor);
882 template<
typename Functor>
885 return this->inVisitorDetail<Functor, true>(to, visitor);
930 template<
typename TraitsType,
typename Const,
typename Outgoing>
934 using Traits = TraitsType;
935 using FromType =
typename TraitsType::FromType;
936 using ToType =
typename TraitsType::ToType;
937 using Directed =
typename TraitsType::Directed;
941 using ThisType =
typename std::
942 conditional<Outgoing::value, typename ImplType::FromType, typename ImplType::ToType>::type;
943 using OtherType =
typename std::
944 conditional<Outgoing::value, typename ImplType::ToType, typename ImplType::FromType>::type;
945 using Constness = Const;
950 This arc type is not indexed for reverse lookups.
958 , m_endpoint(nullptr)
966 typename std::conditional<Const::value, const ThisType*, ThisType*>::type
self()
972 constexpr std::size_t maxDegree()
const
974 return Outgoing::value ? maxOutDegree<Traits>(
unconstrained())
977 constexpr std::size_t minDegree()
const
979 return Outgoing::value ? minOutDegree<Traits>(
unconstrained())
984 template<
bool Outgoingness,
typename Functor>
989 return self->m_arcs->outVisitor(self->m_endpoint, visitor);
993 template<
typename Functor>
998 return self->m_arcs->inVisitor(self->m_endpoint, visitor);
1002 template<
bool Outgoingness,
int Dummy = 0>
1005 bool operator()(
const SelfEndpoint*
self,
const ToType* endpoint)
const
1007 return self->m_arcs->contains(self->m_endpoint, endpoint);
1014 bool operator()(
const SelfEndpoint*
self,
const FromType* endpoint)
const
1016 return self->m_arcs->contains(endpoint, self->m_endpoint);
1022 template<
bool Outgoingness,
int Dummy = 0>
1027 return self->m_arcs->outDegree(self->m_endpoint);
1037 return self->m_arcs->inDegree(self->m_endpoint);
1043 template<
typename Functor>
1059 std::size_t degree()
const
1062 std::size_t dd = Degree<Outgoing::value>()(
this);
1065 std::size_t
size()
const {
return this->degree(); }
1069 bool empty()
const {
return this->size() == 0; }
1084 const OtherType* result =
nullptr;
1085 this->visit([&result](
const OtherType* node) {
1093 const OtherType*
front()
const {
return this->node(); }
1099 template<
bool Mutability,
bool Outgoingness,
int Dummy = 0>
1104 const OtherType* other,
1105 const OtherType* beforeOther =
nullptr,
1106 const ThisType* beforeThis =
nullptr)
const
1108 return self->m_arcs->connect(self->m_endpoint, other, beforeThis, beforeOther);
1117 const OtherType* other,
1118 const OtherType* beforeOther =
nullptr,
1119 const ThisType* beforeThis =
nullptr)
const
1121 return self->m_arcs->connect(other, self->m_endpoint, beforeOther, beforeThis);
1126 template<
bool Outgoingness,
int Dummy>
1131 const OtherType* other,
1132 const OtherType* beforeOther =
nullptr,
1133 const ThisType* beforeThis =
nullptr)
const
1143 template<
bool Mutability,
bool Outgoingness,
int Dummy = 0>
1146 bool operator()(
SelfEndpoint*
self,
const OtherType* other)
const
1148 bool didDisconnect =
self->m_arcs->disconnect(self->m_endpoint, other);
1149 return didDisconnect;
1156 bool operator()(
SelfEndpoint*
self,
const OtherType* other)
const
1158 bool didDisconnect =
self->m_arcs->disconnect(other, self->m_endpoint);
1159 return didDisconnect;
1163 template<
bool Outgoingness,
int Dummy>
1166 bool operator()(
SelfEndpoint*
self,
const OtherType* other)
const
1178 static_assert(!Constness::value,
"A const-referenced node may not be edited.");
1183 bool connect(
const std::shared_ptr<OtherType>& other) {
return this->
connect(other.get()); }
1187 const OtherType* other,
1188 const OtherType* beforeOther =
nullptr,
1189 const ThisType* beforeThis =
nullptr)
1191 static_assert(!Constness::value,
"A const-referenced node may not be edited.");
1198 static_assert(!Constness::value,
"A const-referenced node may not be edited.");
1203 static_assert(!Constness::value,
"A const-referenced node may not be edited.");
1209 return this->disconnect(other.get());
1212 bool erase(
const std::shared_ptr<OtherType>& other) {
return this->
erase(other.get()); }
1227 typename std::conditional<Const::value, const ThisType*, ThisType*>::type endpoint)
1229 , m_endpoint(endpoint)
1234 typename std::conditional<Const::value, const ThisType*, ThisType*>::type m_endpoint;
1240 #if defined(_MSC_VER_FULL) && _MSC_FULL_VER < 192930040
1241 __pragma(warning(pop))
1244 #endif // smtk_graph_ArcImplementation_h
RuntimeArcEndpoint< NonConstArc > outgoingRuntime(const Component *from) override
Return a "container" of outgoing arcs of the given from node.
Definition: ArcImplementation.h:271
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
ArcEndpointInterface< ArcTraits, ConstArc, OutgoingArc > outgoing(const FromType *from) const
Return a "container" of outgoing arcs of the given from node.
Definition: ArcImplementation.h:889
Graph Component represents a node in the graph resource.
Definition: Component.h:66
std::enable_if<!U::value, bool >::type accepts(const FromType *from, const ToType *to, const FromType *beforeFrom=nullptr, const ToType *beforeTo=nullptr) const
Determine whether the given arc is allowed.
Definition: ArcImplementation.h:638
const OtherType * front() const
STL-container synonym for node():
Definition: ArcImplementation.h:1093
bool erase(const OtherType *other)
Connect the other node to this node.
Definition: ArcImplementation.h:1201
@ Halt
Stop visiting items immediately.
bool connect(const OtherType *other)
Connect the other node to this node.
Definition: ArcImplementation.h:1176
detail::SelectArcContainer< ArcTraits, ArcTraits > m_data
Store arc endpoint data.
Definition: ArcImplementation.h:918
True when the order in which arcs are stored is significant.
Definition: ArcProperties.h:207
std::enable_if<!U::value &&!V::value, std::size_t >::type inDegree(const ToType *to) const
Compute the in-degree of the node.
Definition: ArcImplementation.h:815
std::size_t maximumOutDegree() const override
The maximum out-degree of a FromType node. This is enforced.
Definition: ArcImplementation.h:174
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.
Definition: ArcImplementation.h:536
smtk::common::Visited inVisitor(const ToType *to, Functor visitor) const
Visit nodes attached via incoming arcs.
Definition: ArcImplementation.h:883
@ All
The visitor was invoked on every item exhaustively.
typename TraitsType ::ToType ToType
The type of node that these arcs point to.
Definition: ArcImplementation.h:77
bool isMutable() const
Return whether arcs of this type may be edited.
Definition: ArcImplementation.h:113
@ Empty
The were no values to visit.
std::enable_if< U::value, bool >::type empty() const
Return true if there are no arcs of this type in the resource.
Definition: ArcImplementation.h:187
std::string typeName() const override
Return the type of arc this class implements.
Definition: ArcImplementation.h:119
std::size_t minimumOutDegree() const override
The minimum out-degree of a FromType node. This is not enforced.
Definition: ArcImplementation.h:170
Directionality
An enumeration indicated whether an arc is directed or undirected.
Definition: Directionality.h:25
Definition: ArcImplementation.h:1003
std::enable_if< U::value, std::size_t >::type outDegree(const FromType *from) const
Compute the out-degree of the node.
Definition: ArcImplementation.h:800
bool insert(const OtherType *other, const OtherType *beforeOther=nullptr, const ThisType *beforeThis=nullptr)
Insert a new arc connecting this endpoint to the other.
Definition: ArcImplementation.h:1186
RuntimeArcEndpoint< NonConstArc > incomingRuntime(const Component *to) override
Return a "container" of incoming arcs of the given to node.
Definition: ArcImplementation.h:380
std::enable_if<!U::value, bool >::type disconnect(const FromType *from, const ToType *to)
Remove an arc from from to to.
Definition: ArcImplementation.h:724
bool erase(const std::shared_ptr< OtherType > &other)
A convenience version of erase() that accepts shared pointers.
Definition: ArcImplementation.h:1212
bool disconnect(const OtherType *other)
Disconnect the other node from this one (i.e., erase an arc).
Definition: ArcImplementation.h:1196
bool contains(const OtherType *node) const
Return true if this endpoint is connected to node.
Definition: ArcImplementation.h:1050
RuntimeArcEndpoint< ConstArc > incomingRuntime(const Component *to) const override
Return a "container" of incoming arcs of the given to node.
Definition: ArcImplementation.h:335
bool empty() const
Return whether this endpoint has zero arcs.
Definition: ArcImplementation.h:1069
typename TraitsType ::Directed Directed
If "truthy," this arc is considered directed rather than undirected.
Definition: ArcImplementation.h:73
Check whether the arc traits object (1) is implicit and has methods to insert and remove arcs; or (2)...
Definition: ArcProperties.h:254
Definition: ArcImplementation.h:1144
typename TraitsType ::FromType FromType
The type of node that these arcs originate from.
Definition: ArcImplementation.h:75
Edit methods (only enabled for non-const interfaces).
Definition: ArcImplementation.h:1100
A functor that either calls inVisitor (on arcs with reverse indices) or does nothing.
Definition: ArcImplementation.h:207
An object that a node instance can present to access/edit its outgoing/incoming arcs.
Definition: ArcImplementation.h:52
Checks that can be performed on arc trait-types.
Definition: ArcProperties.h:43
std::enable_if<!U::value &&V::value, std::size_t >::type inDegree(const ToType *to) const
Compute the in-degree of the node.
Definition: ArcImplementation.h:835
ArcEndpointInterface()
This is a dummy constructor that is not used by valid code.
Definition: ArcImplementation.h:956
Visit
Return values common to most visitor methods.
Definition: Visit.h:23
@ Continue
Continue to visit items.
std::enable_if< U::value, bool >::type contains(const FromType *from, const ToType *to) const
Test whether an arc from from to to exists.
Definition: ArcImplementation.h:483
bool disconnect(const std::shared_ptr< OtherType > &other)
A convenience version of disconnect() that accepts shared pointers.
Definition: ArcImplementation.h:1207
std::enable_if< U::value, bool >::type accepts(const FromType *from, const ToType *to, const FromType *beforeFrom=nullptr, const ToType *beforeTo=nullptr) const
Determine whether the given arc is allowed.
Definition: ArcImplementation.h:626
Definition: ArcImplementation.h:1023
RuntimeArcEndpoint< ConstArc > outgoingRuntime(const Component *from) const override
Return a "container" of outgoing arcs of the given from node.
Definition: ArcImplementation.h:237
std::enable_if<!U::value &&V::value, std::size_t >::type outDegree(const FromType *from) const
Compute the out-degree of the node.
Definition: ArcImplementation.h:776
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.
Definition: ArcImplementation.h:572
An object that can query and manipulate arcs at run-time.
Definition: ArcImplementationBase.h:28
smtk::common::Visited outVisitor(const FromType *from, Functor visitor) const
Visit nodes attached via outgoing arcs.
Definition: ArcImplementation.h:743
const OtherType * node() const
Return the first destination endpoint.
Definition: ArcImplementation.h:1082
std::size_t size() const
Return the number of arcs of this type that terminate at this endpoint.
Definition: ArcImplementation.h:1065
bool isOrdered() const
Return whether arcs of this type are ordered (true) or unordered (false).
Definition: ArcImplementation.h:107
bool isDirected() const
Return whether arcs of this type are directed (true) or undirected (false).
Definition: ArcImplementation.h:110
bool isExplicit() const
Return whether arcs of this type are explicit.
Definition: ArcImplementation.h:116
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.
Definition: ArcImplementation.h:602
smtk::common::Visited visit(Functor visitor) const
Visit nodes attached to the endpoint by arcs of this type.
Definition: ArcImplementation.h:1044
std::enable_if< U::value, std::size_t >::type inDegree(const ToType *to) const
Compute the in-degree of the node.
Definition: ArcImplementation.h:858
smtk::common::Visited visitOutgoingNodes(const smtk::graph::ResourceBase *resource, smtk::string::Token arcTypeName, RuntimeNodeVisitor visitor) const override
Visit all nodes with outgoing run-time arcs.
Definition: ArcImplementation.h:546
constexpr std::enable_if< std::is_integral< decltype(T::MaxInDegree)>::value, std::size_t >::type maxInDegree(std::size_t)
Return the maximum in-degree of an arc type (or unconstrained() if unspecified).
Definition: ArcProperties.h:397
A wrapper around arc type-traits classes that provides API.
Definition: ArcImplementation.h:50
Visited
Return value for functions/methods that accept visitors.
Definition: Visit.h:35
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.
Definition: ArcImplementation.h:506
constexpr std::size_t unconstrained()
Return a constant used to indicate the maximimum degree of an arc endpoint is unconstrained.
Definition: ArcProperties.h:30
std::string typeName()
Return the name of a class.
Definition: TypeName.h:289
std::enable_if<!U::value, bool >::type empty() const
Return true if there are no arcs of this type in the resource.
Definition: ArcImplementation.h:196
typename ArcProperties< TraitsType >::isOrdered Ordered
If "truthy," this arc will report incoming/outgoing nodes in a (user-specified) order.
Definition: ArcImplementation.h:79
False when an arc class provides implementations of required methods; true otherwise.
Definition: ArcProperties.h:243
std::enable_if<!U::value &&!V::value, std::size_t >::type outDegree(const FromType *from) const
Compute the out-degree of the node.
Definition: ArcImplementation.h:756
std::size_t maximumInDegree() const override
The maximum in-degree of a ToType node. This is enforced.
Definition: ArcImplementation.h:176
constexpr std::enable_if< std::is_integral< decltype(T::MinInDegree)>::value, std::size_t >::type minInDegree(std::size_t)
Return the minimum in-degree of an arc type (or 0 if unspecified).
Definition: ArcProperties.h:431
A string token identified by an integer.
Definition: Token.h:29
ArcEndpointInterface< ArcTraits, ConstArc, IncomingArc > incoming(const ToType *to) const
Return a "container" of incoming arcs of the given to node.
Definition: ArcImplementation.h:899
Definition: ArcImplementation.h:985
typename ArcProperties< TraitsType >::isExplicit Explicit
If "truthy," arc endpoint connections are explicitly stored by SMTK.
Definition: ArcImplementation.h:89
bool connect(const std::shared_ptr< OtherType > &other)
A convenience version of connect() that accepts shared pointers.
Definition: ArcImplementation.h:1183
std::size_t minimumInDegree() const override
The minimum in-degree of a ToType node. This is not enforced.
Definition: ArcImplementation.h:172
std::enable_if< U::value, bool >::type disconnect(const FromType *from, const ToType *to)
Remove an arc from from to to.
Definition: ArcImplementation.h:734
std::enable_if<!U::value, bool >::type contains(const FromType *from, const ToType *to) const
Test whether an arc from from to to exists.
Definition: ArcImplementation.h:459
A base class for all arc implementations.
Definition: ArcImplementationBase.h:34
A non-templated base class for graph resources.
Definition: ResourceBase.h:35
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.
Definition: ArcImplementation.h:694
typename ArcProperties< TraitsType >::isMutable Mutable
If "truthy," methods that edit arcs may sometimes return true.
Definition: ArcImplementation.h:87
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.
Definition: ArcImplementation.h:708
smtk::shared_ptr< smtk::resource::Component > ComponentPtr
Definition: PublicPointerDefs.h:304
Provide no default arc storage.
Definition: TypeTraits.h:37
A base class for arc-types defined at runtime.
Definition: ArcImplementation.h:46
A template for accepting visitors with different return types.
Definition: Visit.h:56