Public Functions Documentation
function DigitalEventSeries
Default constructor creating an empty series with owning storage.
function DigitalEventSeries
explicit DigitalEventSeries(
std:: vector< TimeFrameIndex > event_vector
)
Construct from a vector of event times.
Parameters :
event_vector Vector of event times (will be sorted/deduplicated)
Events are sorted and de-duplicated during construction.
function view
Get a std::ranges compatible view of the series in clock-tick time.
See :
Precondition : For absolute-time series, getTimeFrame() must be non-null
For absolute-time series, returns ClockTicks mapped through the series TimeFrame . For relative-time series, returns stored relative ClockTicks directly (no TimeFrame ).
function getStoredEvent
inline TimeFrameIndex getStoredEvent(
size_t index
) const
Get the stored event time at a flat storage index in TimeFrameIndex space.
Parameters :
index Flat index in [0, size() )
Exceptions :
std::runtime_error if storage uses relative ClockTicks
Return : TimeFrameIndex from internal storage
Use for save/export and other persistence paths that must write index coordinates.
function getStoredRelativeEvent
inline ClockTicks getStoredRelativeEvent(
size_t index
) const
Get the stored relative event time at a flat storage index.
Parameters :
index Flat index in [0, size() )
Return : ClockTicks from internal relative storage
function getStoredEntityId
inline EntityId getStoredEntityId(
size_t index
) const
Get the stored EntityId at a flat storage index.
Parameters :
index Flat index in [0, size() )
Return : EntityId from internal storage
function addEvent
void addEvent(
TimeFrameIndex event_time
)
Add a new event at the specified time.
Parameters :
event_time The time index for the new event
Exceptions :
std::runtime_error if storage is View or Lazy (read-only)
Maintains sorted order. Duplicate times are rejected (no-op).
function removeEvent
bool removeEvent(
TimeFrameIndex event_time
)
Remove an event at the specified time.
Parameters :
event_time The time index of the event to remove
Exceptions :
std::runtime_error if storage is View or Lazy (read-only)
Return : true if an event was removed, false if no event existed at that time
function size
inline size_t size() const
Get the number of events in the series.
Return : Number of events
function addEvent
void addEvent(
TimeFrameIndex event_time,
EntityId entity_id,
NotifyObservers notify
)
Add a new event at the specified time with a specific EntityId .
Parameters :
event_time The time index for the new event
entity_id The EntityId to assign to the event
notify Whether to notify observers after the operation
Exceptions :
std::runtime_error if storage is View or Lazy (read-only)
Maintains sorted order. Duplicate times are rejected (no-op). Used internally for move operations to preserve entity IDs.
function clear
Remove all events from the series.
Exceptions :
std::runtime_error if storage is View or Lazy (read-only)
function moveByEntityIds
std:: size_t moveByEntityIds(
DigitalEventSeries & target,
std:: unordered_set< EntityId > const & entity_ids,
NotifyObservers notify
)
Move events with specific EntityIds to another DigitalEventSeries .
Parameters :
target The target series to move events to
entity_ids Set of EntityIds to move
notify If Yes, both source and target notify observers after the operation
Exceptions :
std::runtime_error if either source or target storage is View or Lazy
Return : The number of events actually moved
Moves all events matching the given EntityIds to the target series. Moved events preserve their EntityIds in the target and are removed from this series.
function copyByEntityIds
std:: size_t copyByEntityIds(
DigitalEventSeries & target,
std:: unordered_set< EntityId > const & entity_ids,
NotifyObservers notify
)
Copy events with specific EntityIds to another DigitalEventSeries .
Parameters :
target The target series to copy events to
entity_ids Set of EntityIds to copy
notify If Yes, the target notifies observers after the operation
Return : The number of events actually copied
Copies all events matching the given EntityIds to the target series. Copied events get new EntityIds in the target based on the target’s identity context (via addEvent which auto-assigns EntityIds).
function deleteByEntityIds
std:: size_t deleteByEntityIds(
std:: unordered_set< EntityId > const & entity_ids,
NotifyObservers notify
)
Delete events with specific EntityIds from this series.
Parameters :
entity_ids Set of EntityIds to delete
notify If Yes, observers are notified after the operation
Exceptions :
std::runtime_error if storage is View or Lazy (read-only)
Return : The number of events actually deleted
Removes all events matching the given EntityIds.
function viewInRange
inline auto viewInRange(
TimeFrameIndex start_index,
TimeFrameIndex stop_index,
TimeFrame const & source_time_frame
) const
Get events in a time range as a lazy view of ClockTicksWithId objects.
Parameters :
start_index Start time index (inclusive)
stop_index Stop time index (inclusive)
source_time_frame The time frame that start_index/stop_index are expressed in
Return : Lazy view of ClockTicksWithId objects in the range
Precondition : series time frame must be set (getTimeFrame() non-null)
This is the primary range query interface. It requires a source TimeFrame parameter to enable proper time conversion when the query time base differs from the series’ internal time base.
function viewInRelativeRange
inline auto viewInRelativeRange(
ClockTicks start,
ClockTicks end
) const
Get events in a relative ClockTicks range as a lazy view of ClockTicksWithId objects.
Parameters :
start Start relative time (inclusive)
end End relative time (inclusive)
Return : Lazy view of ClockTicksWithId objects in the range
Precondition : storesRelativeTimes() == true
function viewTimesInRange
inline auto viewTimesInRange(
TimeFrameIndex start_index,
TimeFrameIndex stop_index,
TimeFrame const & source_time_frame
) const
Get event times in a range as a lazy view of clock ticks.
Parameters :
start_index Start time index (inclusive)
stop_index Stop time index (inclusive)
source_time_frame The time frame that start_index/stop_index are expressed in
Return : Lazy view of ClockTicks values in the range
Precondition : series time frame must be set (getTimeFrame() non-null)
function setTimeFrame
inline void setTimeFrame(
std:: shared_ptr< TimeFrame > time_frame
)
Set the time frame.
Parameters :
time_frame The time frame to set
function getTimeFrame
inline std:: shared_ptr< TimeFrame > getTimeFrame() const
Get the time frame.
Return : std::shared_ptr The current time frame
function setIdentityContext
inline void setIdentityContext(
std:: string const & data_key,
EntityRegistry * registry
)
Set the identity context for automatic EntityId assignment.
Parameters :
data_key The key identifying this data in the registry
registry Pointer to the EntityRegistry (must outlive this series)
When set, new events added via addEvent() will automatically be assigned unique EntityIds from the registry.
function rebuildAllEntityIds
void rebuildAllEntityIds()
Rebuild all EntityIds for existing events.
Assigns new unique EntityIds to all events using the current identity context. Requires setIdentityContext() to have been called first.
function isView
inline bool isView() const
Check if storage is a view (doesn’t own data).
function isLazy
inline bool isLazy() const
Check if storage is lazy-evaluated.
function storesRelativeTimes
inline bool storesRelativeTimes() const
Check if events are stored as relative ClockTicks (no TimeFrame required for view() ).
function getStorageType
inline DigitalEventStorageType getStorageType() const
Get the underlying storage type.
function materialize
std:: shared_ptr< DigitalEventSeries > materialize() const
Materialize a lazy or view series into owning storage.
Return : New series with owning storage containing all events
Copies all events from the current storage into a new series with owning storage. Useful when lazy evaluation is no longer desirable.
function createFromRelativeClockTicks
static std:: shared_ptr< DigitalEventSeries > createFromRelativeClockTicks(
std:: vector< ClockTicks > events,
std:: vector< EntityId > entity_ids ={}
)
Create a series with immutable relative ClockTicks storage.
Parameters :
events Relative event times (sorted and deduplicated on construction)
entity_ids Optional entity IDs aligned with events before sorting
Return : New series backed by relative owning storage
The resulting series has no TimeFrame and does not support mutation or createView() .
function createView
static std:: shared_ptr< DigitalEventSeries > createView(
std:: shared_ptr< DigitalEventSeries const > const & source,
TimeFrameIndex start,
TimeFrameIndex end
)
Create a view-based series filtering by time range.
Parameters :
source Source series to create view from
start Start time (inclusive)
end End time (inclusive)
Return : New series backed by view storage
function createView
static std:: shared_ptr< DigitalEventSeries > createView(
std:: shared_ptr< DigitalEventSeries const > const & source,
std:: unordered_set< EntityId > const & entity_ids
)
Create a view-based series filtering by EntityIds.
Parameters :
source Source series to create view from
entity_ids Set of EntityIds to include
Return : New series backed by view storage
function createFromView
template < typename ViewType >
static std:: shared_ptr< DigitalEventSeries > createFromView(
ViewType view,
size_t num_elements,
std:: shared_ptr< TimeFrame > time_frame = nullptr
)
Create a lazy-evaluated series from a transform view.
Parameters :
view The transform view
num_elements Number of elements in the view
time_frame Optional time frame for the new series
Template Parameters :
ViewType Random-access range type yielding EventWithId-like objects
Return : New series backed by lazy storage
Updated on 2026-11-13 at 20:25:41 +0000