e92729e10f
Added ArchicadEverythingFilter Added ArchicadSelectionFilter Added EverythingSendFilter Updated SendFilter bridge method with defined filter types Updated FilterMover with defined filter types Implemented SendFilter::checkExpiry Updated CardMover with ReceiverModelCard Updated all bridge method args as const reference
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
#include "Speckle/Interface/Browser/Bridge/Functions/GetCallResult.h"
|
|
|
|
#include "Active/Serialise/Item/Wrapper/ItemWrap.h"
|
|
#include "Active/Serialise/JSON/JSONTransport.h"
|
|
#include "Active/Utility/BufferOut.h"
|
|
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
|
|
|
#include <utility>
|
|
|
|
#ifdef ARCHICAD
|
|
#include <ACAPinc.h>
|
|
#include <MessageLoopExecutor.hpp>
|
|
#endif
|
|
|
|
using namespace active::serialise;
|
|
using namespace speckle::serialise::jsbase;
|
|
using namespace speckle::interfac::browser;
|
|
using namespace speckle::interfac::browser::bridge;
|
|
using namespace speckle::utility;
|
|
|
|
/*--------------------------------------------------------------------
|
|
Constructor
|
|
--------------------------------------------------------------------*/
|
|
GetCallResult::GetCallResult() : JSFunction{"GetCallResult", [&](const auto& args) {
|
|
return getResult(args);
|
|
}} {
|
|
} //GetCallResult::GetCallResult
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
Get the result for a specified call
|
|
|
|
argument: The method arguments specifying the target bridge and requestID
|
|
|
|
return: The requested result (nullptr on failure)
|
|
--------------------------------------------------------------------*/
|
|
std::unique_ptr<WrappedResultArg> GetCallResult::getResult(const WrappedResultArg& argument) const {
|
|
if (!hasBridge())
|
|
return nullptr;
|
|
//Retrieve the requested result
|
|
using namespace json;
|
|
auto result = getBridge()->releaseResult(argument);
|
|
auto item = dynamic_cast<Cargo*>(result.get());
|
|
if (!item)
|
|
return nullptr;
|
|
String jsonOutput;
|
|
JSONTransport().send(std::forward<Cargo&&>(*item), Identity{}, jsonOutput);
|
|
return std::make_unique<WrappedResultArg>(jsonOutput);
|
|
} //GetCallResult::getResult
|