SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Protected Member Functions | List of all members
smtk::graph::ArcMap Class Reference

A container for arcs held by a resource. More...

#include <ArcMap.h>

Public Types

using key_type = smtk::common::UUID
 

Public Member Functions

 smtkTypeMacroBase (smtk::graph::ArcMap)
 
 smtkSuperclassMacro (smtk::common::TypeMap< smtk::common::UUID >)
 
template<typename List >
 ArcMap (identity< List >)
 
 ArcMap (const ArcMap &)=delete
 Do not allow the map to be copied:
 
ArcMapoperator= (const ArcMap &)=delete
 
template<typename ArcTraits >
const ArcImplementation< ArcTraits > * at () const
 Return the arc's implementation object given its trait type. More...
 
template<typename ArcTraits >
ArcImplementation< ArcTraits > * at ()
 
template<typename ImplementationType >
const ImplementationType * at (smtk::string::Token declaredType) const
 
template<typename ImplementationType >
ImplementationType * at (smtk::string::Token declaredType)
 
template<typename Tuple , typename Functor , typename... Args>
void invoke (Args &&... args) const
 Invoke a Functor (which accepts args) on each arc type in the Tuple. More...
 
template<typename Tuple , typename Functor , typename... Args>
void invoke (Args &&... args)
 
template<typename Functor , typename... Args>
void invokeRuntime (Args &&... args) const
 Invoke a Functor (which accepts args) on each run-time arc type in the Tuple. More...
 
template<typename Functor , typename... Args>
void invokeRuntime (Args &&... args)
 
const std::set< smtk::string::Token > & types () const
 Return the type-names of the arc types accepted by this ArcMap instance.
 
bool insertRuntimeArcType (smtk::graph::ResourceBase *resource, smtk::string::Token arcType, std::unordered_set< smtk::string::Token > fromNodeSpecs, std::unordered_set< smtk::string::Token > toNodeSpecs, Directionality isDirected)
 Insert a run-time arc type. More...
 
std::unordered_set< smtk::string::TokenruntimeBaseTypes () const
 Return the set of object-types that hold run-time arcs. More...
 
const std::unordered_set< smtk::string::Token > & runtimeTypeNames (smtk::string::Token baseType) const
 Return the set of run-time arcs given a base object-type. More...
 
template<typename ArcImplementationType >
const ArcImplementationType & getRuntime (smtk::string::Token arcType) const
 Return a reference to an arc-type's storage.
 
template<typename ArcImplementationType >
ArcImplementationType & getRuntime (smtk::string::Token arcType)
 

Protected Member Functions

template<typename Type >
void insertArcImplementation ()
 
template<typename Entry , typename Functor , typename... Args>
void invokeFunctor (Args &&... args) const
 
template<typename Entry , typename Functor , typename... Args>
void invokeFunctor (Args &&... args)
 
template<typename Tuple >
void insertArcImplementations ()
 

Detailed Description

A container for arcs held by a resource.

This class extends RuntimeTypeContainer in two ways:

Member Function Documentation

◆ at()

template<typename ArcTraits >
const ArcImplementation<ArcTraits>* smtk::graph::ArcMap::at ( ) const
inline

Return the arc's implementation object given its trait type.

This will return null when the arc map does not hold arcs of the given trait-type.

◆ insertRuntimeArcType()

bool smtk::graph::ArcMap::insertRuntimeArcType ( smtk::graph::ResourceBase resource,
smtk::string::Token  arcType,
std::unordered_set< smtk::string::Token fromNodeSpecs,
std::unordered_set< smtk::string::Token toNodeSpecs,
Directionality  isDirected 
)

Insert a run-time arc type.

The arcType will be used as a "declared typename". If directed is true, arcs will be directed.

The fromNodeSpecs and toNodeSpecs are sets of query-filters that specify components within the resource which may serve as the arc's endpoints. Note that if directed is false, then the union of both node specs is used but a warning will be emitted if they are not identical.

This method will return false if your graph-resource's type traits object does not include the RuntimeArc in its ArcTypes tuple.

This method requires a resource in order to call queryOperation() on the endpoint type-specifiers. (Note that each graph resource's traits object may have a different set of node and arc types which affect the grammar of type-specifier strings.)

◆ invoke()

template<typename Tuple , typename Functor , typename... Args>
void smtk::graph::ArcMap::invoke ( Args &&...  args) const
inline

Invoke a Functor (which accepts args) on each arc type in the Tuple.

For each arc type, the functor is passed the input arguments (which it may modify). Note that the object passed to each functor will be an ArcImplementation<ArcTraits>, where each ArcTraits is drawn from the Tuple.

◆ invokeRuntime()

template<typename Functor , typename... Args>
void smtk::graph::ArcMap::invokeRuntime ( Args &&...  args) const
inline

Invoke a Functor (which accepts args) on each run-time arc type in the Tuple.

For each RuntimeArc instance, the functor is passed the input arguments (which it may modify). Note that the object passed to each functor will be an ArcImplementationBase (a pure virtual base class for ArcImplementation<T>). This is less efficient than the compile-time arc support, but is more flexible.

◆ runtimeBaseTypes()

std::unordered_set< smtk::string::Token > smtk::graph::ArcMap::runtimeBaseTypes ( ) const

Return the set of object-types that hold run-time arcs.

Each object-type may have multiple corresponding run-time arcs.

See also
runtimeTypeNames

◆ runtimeTypeNames()

const std::unordered_set< smtk::string::Token > & smtk::graph::ArcMap::runtimeTypeNames ( smtk::string::Token  baseType) const

Return the set of run-time arcs given a base object-type.

See also
runtimeBaseTypes

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