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>;
47 template<
typename... Args>
49 const std::shared_ptr<IdSpace>& space,
56 , m_range(IdRange{ begin, end })
75 IdRange range()
const;
78 IdType
size()
const {
return m_range[1] - m_range[0]; }
80 bool empty()
const {
return this->size() > 0; }
82 std::shared_ptr<smtk::markup::IdSpace> space()
const;
84 bool setNature(
const IdNature& nature);
88 Component* node()
const {
return m_node; }
89 template<
typename NodeType>
90 NodeType* nodeAs()
const
92 return dynamic_cast<NodeType*
>(m_node);
97 std::weak_ptr<smtk::markup::IdSpace>
m_space;
109 #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:78
Definition: Component.h:51
@ Forward
The iterator traverses IDs from lowest to highest.
Definition: AssignedIds.h:70
std::weak_ptr< smtk::markup::IdSpace > m_space
The parent space from which our assigned IDs come.
Definition: AssignedIds.h:97
IdNature m_nature
The nature of the assignment (ownership or reference; exclusive or non-exclusive).
Definition: AssignedIds.h:101
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:103
IdRange m_range
The overall range of the assignment (used to accelerate intersection tests).
Definition: AssignedIds.h:99
Forwardness
The access-level of iteration (constant or mutable), used as a template parameter.
Definition: AssignedIds.h:68
bool empty() const
Return true when no IDs are assigned.
Definition: AssignedIds.h:80
Macros for dealing with shared-pointer classes.
#define smtkTypeMacroBase(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:55
std::size_t IdType
The type used for holding IDs in an IdSpace domain.
Definition: IdType.h:23