SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_markup_IdSpace_h
11 #define smtk_markup_IdSpace_h
13 #include "smtk/markup/Domain.h"
15 #include "smtk/markup/IdNature.h"
16 #include "smtk/markup/IdType.h"
18 #include "boost/icl/split_interval_map.hpp"
45 using IntervalTree = boost::icl::split_interval_map<IdType, std::set<AssignedIds*>>;
53 static constexpr
IdType Invalid = ~0ull;
57 IdSpace(
const nlohmann::json& data);
60 const std::array<IdSpace::IdType, 2>& range()
const;
61 std::array<IdSpace::IdType, 2>& range();
64 static shared_ptr<AssignedIds> defaultAssignment(
65 const std::shared_ptr<IdSpace>& space,
110 std::shared_ptr<AssignedIds> requestRange(
112 std::size_t rangeSize,
113 std::size_t offset = Invalid,
124 void insertAssignment(
const AssignedIds* assignedIds);
131 std::set<std::shared_ptr<AssignedIds>>
168 bool rangeHasPrimaryIds(
IdType begin,
IdType end)
const;
176 IdType numberOfIdsInRangeOfNature(
179 IdNature nature = IdNature::Unassigned)
const;
187 static std::array<IdSpace::IdType, 2>
188 clampedRange(
const std::array<IdType, 2>& unclamped,
IdType begin,
IdType end);
190 std::array<IdSpace::IdType, 2> m_range{ Invalid, Invalid };
202 #endif // smtk_markup_IdSpace_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
boost::icl::interval_set< IdType > IntervalMerge
A structure that simplifies determining whether assignments cover a range.
Definition: IdSpace.h:47
An API for querying the IDs allotted to a component in an IdSpace.
Definition: AssignedIds.h:31
IntervalTree m_entries
A container to hold all the assigned IDs within the space.
Definition: IdSpace.h:196
boost::icl::split_interval_map< IdType, std::set< AssignedIds * > > IntervalTree
The search structure used to index assignments in the space of IDs.
Definition: IdSpace.h:45
smtk::markup::IdType IdType
The plain-old-data type used to hold an identifier.
Definition: IdSpace.h:43
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
#define smtkTypeMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:128
static shared_ptr< AssignedIds > defaultAssignment(const std::shared_ptr< IdSpace > &space, IdNature nature, IdType begin, IdType end)
Create a default instance of AssignedIds from a specification.
Definition: IdSpace.cxx:42
std::function< std::shared_ptr< AssignedIds >(const std::shared_ptr< IdSpace > &, IdNature, IdType, IdType)> AssignedIdCtor
Signature of a function to create an assigned-IDs object.
Definition: IdSpace.h:50
#define smtkSuperclassMacro(...)
Add a typedef to the superclass of this class.
Definition: SharedFromThis.h:147
A string token identified by an integer.
Definition: Token.h:29
std::size_t IdType
The type used for holding IDs in an IdSpace domain.
Definition: IdType.h:23
The domain of a discrete or parameterized dataset.
Definition: Domain.h:28