Files
speckle-cpp-connectors/SpeckleConnector/Connector/Database/Model/Card/ModelCard.h
T
2024-09-09 16:45:41 +01:00

106 lines
2.8 KiB
C++

#ifndef CONNECTOR_DATABASE_MODEL_CARD
#define CONNECTOR_DATABASE_MODEL_CARD
#include "Active/Container/Vector.h"
#include "Active/Serialise/Package/Package.h"
#include "Active/Utility/Cloner.h"
#include "Connector/Database/Model/Card/CardSetting.h"
#include "Speckle/Utility/String.h"
namespace connector::database {
/*!
A connector send filter
*/
class ModelCard : public active::serialise::Package, public active::utility::Cloner {
public:
// MARK: - Types
using base = active::serialise::Package;
//List of card settings
using SettingList = active::container::Vector<connector::database::CardSetting>;
// MARK: - Constructors
/*!
Default constructor
*/
ModelCard() {}
/*!
Record cloning
@return A clone of this record
*/
virtual ModelCard* clonePtr() const override { return new ModelCard(*this); };
// MARK: - Functions (const)
/*!
Get the card ID
@return The card ID
*/
const speckle::utility::String& getID() const { return m_ID; }
/*!
Get the model ID
@return The model ID
*/
const speckle::utility::String& getModelID() const { return m_modelID; }
/*!
Get the setting type
@return The setting type
*/
const speckle::utility::String& getProjectID() const { return m_projectID; }
/*!
Get the setting type
@return The setting type
*/
const speckle::utility::String& getAccountID() const { return m_accountID; }
/*!
Get the setting type
@return The setting type
*/
const speckle::utility::String& getServerURL() const { return m_serverURL; }
/*!
Get the card settings
@return The card settings
*/
const SettingList& getSettings() const { return m_settings; }
// MARK: - Serialisation
/*!
Fill an inventory with the package items
@param inventory The inventory to receive the package items
@return True if the package has added items to the inventory
*/
bool fillInventory(active::serialise::Inventory& inventory) const override;
/*!
Get the specified cargo
@param item The inventory item to retrieve
@return The requested cargo (nullptr on failure)
*/
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
/*!
Set to the default package content
*/
void setDefault() override;
private:
///A unique ID for the card (not the ID of the linked model)
speckle::utility::String m_ID;
///The model ID
speckle::utility::String m_modelID;
///The project ID
speckle::utility::String m_projectID;
///The user account ID
speckle::utility::String m_accountID;
///The server URL
speckle::utility::String m_serverURL;
///Settings for the model rendering, e.g. level of detail (LoD)
SettingList m_settings;
};
}
#endif //CONNECTOR_DATABASE_MODEL_CARD