SendObject now holds and sends a Record

This commit is contained in:
Ralph Wessel
2024-10-03 13:12:57 +01:00
parent 8539129e7c
commit a0413d0d3a
2 changed files with 6 additions and 8 deletions
@@ -2,8 +2,8 @@
#define CONNECTOR_INTERFACE_BRIDGE_SEND_OBJECT
#include "Active/Serialise/CargoHold.h"
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
#include "Speckle/Database/Content/Record.h"
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
namespace connector::interfac::browser::bridge {
@@ -20,15 +20,14 @@ namespace connector::interfac::browser::bridge {
/*!
Default constructor
@param objID The ID of the object to send
@param object The object to send
*/
SendObject(const speckle::utility::String& objID, std::unique_ptr<active::serialise::Package> object) : m_object{std::move(object)} {}
SendObject(std::unique_ptr<speckle::database::Record> object) : m_object{std::move(object)} { id = m_object->getID(); }
// MARK: - Public variables
///The root object id which should be used for creating the version
speckle::utility::String id = "1234";
speckle::utility::String id;
// MARK: - Serialisation
@@ -47,7 +46,7 @@ namespace connector::interfac::browser::bridge {
private:
///The object to send
std::unique_ptr<active::serialise::Package> m_object;
std::unique_ptr<speckle::database::Record> m_object;
};
}
@@ -63,8 +63,7 @@ void Send::run(const String& modelCardID) const {
//We currently collect all detached object serialised data into a memory-based store - in future may be able to batch send and cache locally
DetachedMemoryStore detachedObjects;
//Collect targeted elements here
auto placeholder = std::make_unique<Record>(); //Using a placeholder as a test for now
SendObject toSend{placeholder->getID(), std::move(placeholder)};
SendObject toSend{std::make_unique<Record>()}; //NB: Using a placeholder object for now
auto result = std::make_unique<SendViaBrowserArgs>(*modelCard, *account, std::move(toSend));
getBridge()->sendEvent("sendByBrowser", std::move(result));
getBridge()->sendEvent("sendByBrowser", std::move(result));
} //Send::run