Skip to main content

src/DataObjects/DigitalTimeSeries/storage/DigitalIntervalStorageCache.hpp

src/DataObjects/DigitalTimeSeries/storage/DigitalIntervalStorageCache.hpp

Classes

Name
struct DigitalIntervalStorageCache
Cache structure for fast-path access to contiguous digital interval storage.

Types

Name
enum class DigitalIntervalStorageType { Owning, View, Lazy}
Storage type enumeration for digital interval storage.

Types Documentation

enum DigitalIntervalStorageType

Enumerator Value Description
Owning Owns the data in SoA layout.
View References another storage via indices.
Lazy Lazy-evaluated transform.

Storage type enumeration for digital interval storage.

Source code

#ifndef DIGITAL_INTERVAL_STORAGE_CACHE_HPP
#define DIGITAL_INTERVAL_STORAGE_CACHE_HPP

#include "Entity/EntityId.hpp"        // EntityID
#include "TimeFrame/interval_data.hpp"// Interval struct

#include <cstddef>  // size_t

enum class DigitalIntervalStorageType {
    Owning,
    View,  
    Lazy   
};

// =============================================================================
// Cache Optimization Structure
// =============================================================================

struct DigitalIntervalStorageCache {
    TimeFrameInterval const * intervals_ptr = nullptr;
    EntityId const * entity_ids_ptr = nullptr;
    size_t cache_size = 0;
    bool is_contiguous = false;

    [[nodiscard]] constexpr bool isValid() const noexcept {
        return is_contiguous;
    }

    // Convenience accessors for cached data
    [[nodiscard]] TimeFrameInterval const & getInterval(size_t idx) const noexcept {
        return intervals_ptr[idx];
    }

    [[nodiscard]] EntityId getEntityId(size_t idx) const noexcept {
        return entity_ids_ptr[idx];
    }
};

#endif// DIGITAL_INTERVAL_STORAGE_CACHE_HPP

Updated on 2026-11-13 at 20:25:43 +0000