SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing > Class Template Reference

An object that a node instance can present to access/edit its outgoing/incoming arcs. More...

#include <ArcImplementation.h>

Classes

struct  Connector
 Edit methods (only enabled for non-const interfaces). More...
 
struct  Connector< false, Outgoingness, Dummy >
 
struct  Connector< true, false, Dummy >
 
struct  ContainsEndpoint
 
struct  ContainsEndpoint< false, Dummy >
 
struct  Degree
 
struct  Degree< false, Dummy >
 
struct  Disconnector
 
struct  Disconnector< false, Outgoingness, Dummy >
 
struct  Disconnector< true, false, Dummy >
 
struct  VisitEndpoints
 
struct  VisitEndpoints< false, Functor >
 

Public Types

using Traits = TraitsType
 
using FromType = typename TraitsType::FromType
 
using ToType = typename TraitsType::ToType
 
using Directed = typename TraitsType::Directed
 
using Mutable = typename ArcProperties< TraitsType >::isMutable
 
using Ordered = typename ArcProperties< TraitsType >::isOrdered
 
using ImplType = ArcImplementation< TraitsType >
 
using ThisType = typename std::conditional< Outgoing::value, typename ImplType::FromType, typename ImplType::ToType >::type
 
using OtherType = typename std::conditional< Outgoing::value, typename ImplType::ToType, typename ImplType::FromType >::type
 
using Constness = Const
 
using SelfEndpoint = ArcEndpointInterface< TraitsType, Const, Outgoing >
 

Public Member Functions

 ArcEndpointInterface ()
 This is a dummy constructor that is not used by valid code. More...
 
 ArcEndpointInterface (const ArcEndpointInterface< TraitsType, Const, Outgoing > &)=default
 Provide a default copy constructor.
 
std::conditional< Const::value, const ThisType *, ThisType * >::type self ()
 Return this endpoint's endpoint.
 
constexpr std::size_t maxDegree () const
 
constexpr std::size_t minDegree () const
 
template<typename Functor >
smtk::common::Visited visit (Functor visitor) const
 Visit nodes attached to the endpoint by arcs of this type.
 
bool contains (const OtherType *node) const
 Return true if this endpoint is connected to node.
 
bool empty () const
 Return whether this endpoint has zero arcs.
 
const OtherType * node () const
 Return the first destination endpoint. More...
 
const OtherType * front () const
 STL-container synonym for node():
 
std::size_t degree () const
 Return the number of arcs of this type that terminate at this endpoint. More...
 
std::size_t size () const
 Return the number of arcs of this type that terminate at this endpoint. More...
 
bool connect (const OtherType *other)
 Connect the other node to this node.
 
bool connect (const std::shared_ptr< OtherType > &other)
 A convenience version of connect() that accepts shared pointers.
 
bool insert (const OtherType *other, const OtherType *beforeOther=nullptr, const ThisType *beforeThis=nullptr)
 Insert a new arc connecting this endpoint to the other.
 
bool disconnect (const OtherType *other)
 Disconnect the other node from this one (i.e., erase an arc).
 
bool erase (const OtherType *other)
 Connect the other node to this node.
 
bool disconnect (const std::shared_ptr< OtherType > &other)
 A convenience version of disconnect() that accepts shared pointers.
 
bool erase (const std::shared_ptr< OtherType > &other)
 A convenience version of erase() that accepts shared pointers.
 

Protected Member Functions

 ArcEndpointInterface (const ArcImplementation< TraitsType > *arcs, typename std::conditional< Const::value, const ThisType *, ThisType * >::type endpoint)
 

Protected Attributes

ArcImplementation< TraitsType > * m_arcs
 
std::conditional< Const::value, const ThisType *, ThisType * >::type m_endpoint
 

Friends

class ArcImplementation< TraitsType >
 Use connect and disconnect to edit all attached arcs until they match destNodes. More...
 

Detailed Description

template<typename TraitsType, typename Const, typename Outgoing>
class smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing >

An object that a node instance can present to access/edit its outgoing/incoming arcs.

If Outgoing is true, then instances of this class should be constructed with a "from" node's pointer and will act like a container of "to" nodes for the arc type.

If Outgoing is false, then instances of this class should be constructed with a "to" node's pointer and will act like a container of "from" nodes for the arc type, assuming the arc type provides reverse indexing.

Constructor & Destructor Documentation

◆ ArcEndpointInterface()

template<typename TraitsType , typename Const , typename Outgoing >
smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing >::ArcEndpointInterface ( )
inline

This is a dummy constructor that is not used by valid code.

Methods that must return a container return instances created with this constructor, but only after throwing an exception.

Member Function Documentation

◆ degree()

template<typename TraitsType , typename Const , typename Outgoing >
std::size_t smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing >::degree ( ) const
inline

Return the number of arcs of this type that terminate at this endpoint.

The variant named size() exists so the endpoint behaves like an STL container.

◆ node()

template<typename TraitsType , typename Const , typename Outgoing >
const OtherType* smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing >::node ( ) const
inline

Return the first destination endpoint.

This is a convenience method, generally intended for the case when maxDegree() == 1.

If no arcs exist, this will return a null pointer.

This may eventually return a reference to a pointer to allow users to replace the destination node with another, but currently it returns only a value.

◆ size()

template<typename TraitsType , typename Const , typename Outgoing >
std::size_t smtk::graph::ArcEndpointInterface< TraitsType, Const, Outgoing >::size ( ) const
inline

Return the number of arcs of this type that terminate at this endpoint.

The variant named size() exists so the endpoint behaves like an STL container.

Friends And Related Function Documentation

◆ ArcImplementation< TraitsType >

template<typename TraitsType , typename Const , typename Outgoing >
friend class ArcImplementation< TraitsType >
friend

Use connect and disconnect to edit all attached arcs until they match destNodes.

Return true if modified and false otherwise.


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