SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_markup_AssignedIds_h
11 #define smtk_markup_AssignedIds_h
14 #include "smtk/markup/Exports.h"
15 #include "smtk/markup/IdNature.h"
16 #include "smtk/markup/IdType.h"
18 #include "smtk/string/Token.h"
31 class SMTKMARKUP_EXPORT
AssignedIds :
public std::enable_shared_from_this<AssignedIds>
37 using IdIterator =
struct
45 std::array<IdType, 2>;
46 using AssignedIdCtor = std::function<
47 std::shared_ptr<AssignedIds>(
const std::shared_ptr<IdSpace>&,
IdNature, IdType, IdType)>;
49 template<
typename... Args>
51 const std::shared_ptr<IdSpace>& space,
58 , m_range(IdRange{ begin, end })
67 virtual AssignedIdCtor cloneFunctor()
const;
80 IdRange range()
const;
83 IdType
size()
const {
return m_range[1] - m_range[0]; }
85 bool empty()
const {
return this->size() > 0; }
87 std::shared_ptr<smtk::markup::IdSpace> space()
const;
89 bool setNature(
const IdNature& nature);
93 Component* node()
const {
return m_node; }
94 template<
typename NodeType>
95 NodeType* nodeAs()
const
97 return dynamic_cast<NodeType*
>(m_node);
114 #endif // smtk_markup_AssignedIds_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
An API for querying the IDs allotted to a component in an IdSpace.
Definition: AssignedIds.h:31
IdType size() const
Return the number of allotted IDs.
Definition: AssignedIds.h:83
Definition: Component.h:56
@ Forward
The iterator traverses IDs from lowest to highest.
Definition: AssignedIds.h:75
std::weak_ptr< smtk::markup::IdSpace > m_space
The parent space from which our assigned IDs come.
Definition: AssignedIds.h:102
IdNature m_nature
The nature of the assignment (ownership or reference; exclusive or non-exclusive).
Definition: AssignedIds.h:106
IdNature
The nature of how identifiers in an instance of AssignedIds are used.
Definition: IdNature.h:23
A numbering used in a context.
Definition: IdSpace.h:36
Component * m_node
The graph node which owns the assignment (if any).
Definition: AssignedIds.h:108
IdRange m_range
The overall range of the assignment (used to accelerate intersection tests).
Definition: AssignedIds.h:104
Forwardness
The access-level of iteration (constant or mutable), used as a template parameter.
Definition: AssignedIds.h:73
bool empty() const
Return true when no IDs are assigned.
Definition: AssignedIds.h:85
Macros for dealing with shared-pointer classes.
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:131
std::size_t IdType
The type used for holding IDs in an IdSpace domain.
Definition: IdType.h:23