SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_graph_ArcProperties_h
12 #define smtk_graph_ArcProperties_h
14 #include "smtk/Metaprogramming.h"
16 #include "smtk/graph/OwnershipSemantics.h"
17 #include "smtk/string/Token.h"
22 #include <type_traits>
32 return std::numeric_limits<std::size_t>::max();
42 template<
typename ArcTraits>
51 using type_sink_t =
typename type_sink<T>::type;
55 template<
class T,
class =
void>
62 type_sink_t<decltype(std::declval<T>().outVisitor(
64 std::function<smtk::common::Visited(typename T::ToType const*)>()))>> : std::true_type
69 template<
class T,
class =
void>
76 type_sink_t<decltype(std::declval<T>().inVisitor(
78 std::function<smtk::common::Visited(typename T::FromType const*)>()))>> : std::true_type
83 template<
class T,
class =
void>
90 type_sink_t<decltype(std::declval<T>().visitAllOutgoingNodes(
92 std::function<smtk::common::Visited(typename T::FromType const*)>()))>> : std::true_type
97 template<
class T,
class =
void>
104 type_sink_t<decltype(std::declval<T>().visitAllIncomingNodes(
106 std::function<smtk::common::Visited(typename T::ToType const*)>()))>> : std::true_type
111 template<
class T,
class =
void>
118 type_sink_t<decltype(std::declval<T>().contains(
119 static_cast<const typename ArcTraits::FromType*>(nullptr),
120 static_cast<const typename ArcTraits::ToType*>(nullptr)))>> : std::true_type
125 template<
class T,
class =
void>
132 type_sink_t<decltype(std::declval<T>().outDegree(
133 static_cast<const typename ArcTraits::FromType*>(nullptr)))>> : std::true_type
138 template<
class T,
class =
void>
145 type_sink_t<decltype(std::declval<T>().inDegree(
146 static_cast<const typename ArcTraits::ToType*>(nullptr)))>> : std::true_type
151 template<
class T,
class =
void>
158 type_sink_t<decltype(std::declval<T>().connect(
159 static_cast<typename ArcTraits::FromType*>(nullptr),
160 static_cast<typename ArcTraits::ToType*>(nullptr),
161 static_cast<typename ArcTraits::FromType*>(nullptr),
162 static_cast<typename ArcTraits::ToType*>(nullptr)))>> : std::true_type
167 template<
class T,
class =
void>
174 type_sink_t<decltype(std::declval<T>().disconnect(
175 static_cast<typename ArcTraits::FromType*>(nullptr),
176 static_cast<typename ArcTraits::ToType*>(nullptr)))>> : std::true_type
183 template<
class T,
class =
void>
189 : std::conditional<T::ForwardIndexOnly::value, std::true_type, std::false_type>::type
195 template<
class T,
class =
void>
203 static_assert(T::Immutable::value,
"Immutable must be true_type if present.");
211 static constexpr
bool value = type::value;
227 static constexpr
bool value = type::value;
239 static constexpr
bool value = type::value;
247 static constexpr
bool value = type::value;
262 static constexpr
bool value = type::value;
278 std::is_same<typename ArcTraits::FromType, typename ArcTraits::ToType>,
280 static constexpr
bool value = type::value;
284 template<
class T,
class =
void>
290 struct hasSemantics<T, type_sink_t<decltype(T::semantics)>> : std::true_type
323 template<
class T,
class =
void>
331 decltype(std::declval<T>().accepts(nullptr, nullptr, nullptr, nullptr))>> : std::true_type
339 template<
class T,
class =
void>
347 decltype(std::declval<T>().size())>> : std::true_type
354 template<
typename U = ArcTraits,
typename =
void>
365 template<
typename U = ArcTraits,
typename =
void>
370 struct hasToNodeSpecs<U, type_sink_t<decltype(std::declval<U>().m_toNodeSpecs)>> : std::true_type
379 typename std::enable_if<std::is_integral<decltype(T::MaxOutDegree)>::value, std::size_t>::type
382 return T::MaxOutDegree;
396 typename std::enable_if<std::is_integral<decltype(T::MaxInDegree)>::value, std::size_t>::type
399 return T::MaxInDegree;
413 typename std::enable_if<std::is_integral<decltype(T::MinOutDegree)>::value, std::size_t>::type
416 return T::MinOutDegree;
430 typename std::enable_if<std::is_integral<decltype(T::MinInDegree)>::value, std::size_t>::type
433 return T::MinInDegree;
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
Test whether an arc-traits object provides an "accepts()" method with the same signature as "connect(...
Definition: ArcProperties.h:324
OwnershipSemantics
Indicate whether one arc endpoint "owns" the other.
Definition: OwnershipSemantics.h:19
True when the order in which arcs are stored is significant.
Definition: ArcProperties.h:207
Check that a method exists to remove arcs.
Definition: ArcProperties.h:168
Check whether the traits object has been marked immutable.
Definition: ArcProperties.h:196
Check that a method exists to visit all nodes with outgoing arcs.
Definition: ArcProperties.h:84
Check whether the arc traits object allows traversal only in the foward direction.
Definition: ArcProperties.h:219
Check whether the arc has bidirectional indexing (the default) or has been marked as having only a fo...
Definition: ArcProperties.h:184
Check that a method exists to visit out-nodes given a "from" node.
Definition: ArcProperties.h:56
Check that a method exists to visit in-nodes given a "to" node.
Definition: ArcProperties.h:70
A "polyfill" for std::negation, introduced in c++17.
Definition: Metaprogramming.h:62
Check whether the traits object is undirected and has identical to/from types.
Definition: ArcProperties.h:274
constexpr std::enable_if< std::is_integral< decltype(T::MaxOutDegree)>::value, std::size_t >::type maxOutDegree(std::size_t)
Return the maximum out-degree of an arc type (or unconstrained() if unspecified).
Definition: ArcProperties.h:380
True when any template parameter is "truthy".
Definition: Metaprogramming.h:47
Check whether the arc traits object (1) is implicit and has methods to insert and remove arcs; or (2)...
Definition: ArcProperties.h:254
Checks that can be performed on arc trait-types.
Definition: ArcProperties.h:43
Test whether an arc-traits object provides a "size()" method that returns the number of arcs of its t...
Definition: ArcProperties.h:340
constexpr std::enable_if< std::is_integral< decltype(T::MinOutDegree)>::value, std::size_t >::type minOutDegree(std::size_t)
Return the minimum out-degree of an arc type (or 0 if unspecified).
Definition: ArcProperties.h:414
Check that a method exists to test existence of an arc.
Definition: ArcProperties.h:112
Does the traits object have a member named m_fromNodeSpecs?
Definition: ArcProperties.h:355
True when all template parameters are "truthy".
Definition: Metaprogramming.h:28
Check that a method exists to visit all nodes with incoming arcs.
Definition: ArcProperties.h:98
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
constexpr std::size_t unconstrained()
Return a constant used to indicate the maximimum degree of an arc endpoint is unconstrained.
Definition: ArcProperties.h:30
True when an arc class provides implementations of required methods; false otherwise.
Definition: ArcProperties.h:231
Definition: ArcProperties.h:285
False when an arc class provides implementations of required methods; true otherwise.
Definition: ArcProperties.h:243
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
Check that a method exists to compute the out-degree of an arc.
Definition: ArcProperties.h:126
Check that a method exists to insert arcs.
Definition: ArcProperties.h:152
Does the traits object have a member named m_toNodeSpecs?
Definition: ArcProperties.h:366
Check that a method exists to compute the in-degree of an arc.
Definition: ArcProperties.h:139
@ None
Neither endpoint owns its neighbor.
static constexpr OwnershipSemantics ownershipSemantics()
Check whether the traits object provides ownership semantics and return them.
Definition: ArcProperties.h:312