#ifndef CONNECTOR_DATABASE_MODEL_CARD_DATABASE #define CONNECTOR_DATABASE_MODEL_CARD_DATABASE #include "Connector/Record/Model/ModelCard.h" namespace active::event { class Subscriber; } namespace connector::database { /*! Database of model cards relating to a specific project */ class ModelCardDatabase { public: // MARK: - Constructors /*! Constructor */ ModelCardDatabase(); ModelCardDatabase(const ModelCardDatabase&) = delete; /*! Destructor */ ~ModelCardDatabase(); // MARK: - Functions (const) /*! Get a specified card from the database @return The requested card (nullptr on failure) */ record::ModelCard::Unique getCard(const speckle::utility::String& cardID) const; /*! Get all model cards @return All the cards */ active::container::Vector getCards() const; /*! Write a card to storage @param card The card to write */ void write(record::ModelCard& card) const; /*! Erase a card @param cardID The ID of the card to erase */ void erase(const speckle::utility::String& cardID) const; /*! Get a serialisation wrapper for the database @return A database wrapper */ std::unique_ptr wrapper() const; /*! Get the unique ID of the engine storage @return The database unique ID */ speckle::database::RecordID getStoreID() const; // MARK: - Functions (mutating) /*! Get the database subscription (the content is document-based, and must react to document operations) @return The database subscription (add weakly to publisher) */ std::shared_ptr getSubscription(); private: class Engine; class Store; ///Model card database storage std::shared_ptr m_engine; std::shared_ptr m_store; }; } #endif //CONNECTOR_DATABASE_MODEL_CARD_DATABASE