Skip to main content

src/DataManager/utils/TableView/columns/IColumn.h

src/DataManager/utils/TableView/columns/IColumn.h

Classes

Name
class IColumn
Non-templated base interface for all column types.

Types

Name
enum class EntityIdStructure { None, Simple, Complex, Shared}
Enumeration of EntityID structures that columns can provide.
using std::vector< EntityId > EntityIdCollection
Type aliases for EntityID collections and sharing.
using std::shared_ptr< const EntityIdCollection > SharedEntityIdCollection
using std::variant< std::monostate, std::vector< EntityId >, std::vector< std::vector< EntityId > >, std::vector< SharedEntityIdCollection > > ColumnEntityIds
Variant type for different EntityID structures at the column level.

Types Documentation

enum EntityIdStructure

Enumerator Value Description
None No EntityIDs available.
Simple One EntityID per row (std::vector).
Complex Multiple EntityIDs per row (std::vector<std::vector>).
Shared Shared references to EntityID collections (std::vector).

Enumeration of EntityID structures that columns can provide.

using EntityIdCollection

using EntityIdCollection =  std::vector<EntityId>;

Type aliases for EntityID collections and sharing.

using SharedEntityIdCollection

using SharedEntityIdCollection =  std::shared_ptr<const EntityIdCollection>;

using ColumnEntityIds

using ColumnEntityIds =  std::variant<
    std::monostate,
    std::vector<EntityId>,
    std::vector<std::vector<EntityId>>,
    std::vector<SharedEntityIdCollection>
>;

Variant type for different EntityID structures at the column level.

None: No EntityIDs Simple: One EntityID per row Complex: Multiple EntityIDs per row Shared: References to shared collections

Source code

#ifndef ICOLUMN_H
#define ICOLUMN_H

#include "Entity/EntityTypes.hpp"

#include <memory>
#include <string>
#include <typeinfo>
#include <variant>
#include <vector>

class TableView;

enum class EntityIdStructure { 
    None,     
    Simple,   
    Complex,  
    Shared    
};

using EntityIdCollection = std::vector<EntityId>;
using SharedEntityIdCollection = std::shared_ptr<const EntityIdCollection>;

using ColumnEntityIds = std::variant<
    std::monostate,                              
    std::vector<EntityId>,                       
    std::vector<std::vector<EntityId>>,          
    std::vector<SharedEntityIdCollection>       
>;

class IColumn {
public:
    virtual ~IColumn() = default;

    // Make this class non-copyable and non-movable since it's a pure interface
    IColumn(IColumn const &) = delete;
    IColumn & operator=(IColumn const &) = delete;
    IColumn(IColumn &&) = delete;
    IColumn & operator=(IColumn &&) = delete;

    [[nodiscard]] virtual std::string getName() const = 0;

    [[nodiscard]] virtual std::type_info const & getType() const = 0;

    virtual void materialize(TableView * table) = 0;

    [[nodiscard]] virtual std::string getSourceDependency() const = 0;

    [[nodiscard]] virtual std::vector<std::string> getDependencies() const = 0;

    [[nodiscard]] virtual bool isMaterialized() const = 0;

    virtual void clearCache() = 0;

    [[nodiscard]] virtual EntityIdStructure getEntityIdStructure() const = 0;

    [[nodiscard]] virtual ColumnEntityIds getColumnEntityIds() const = 0;

    [[nodiscard]] virtual std::vector<EntityId> getCellEntityIds(size_t row_index) const = 0;

    [[nodiscard]] virtual bool hasEntityIds() const {
        return getEntityIdStructure() != EntityIdStructure::None;
    }

protected:
    // Protected constructor to prevent direct instantiation
    IColumn() = default;
};

#endif// ICOLUMN_H

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