MCPcopy Create free account
hub / github.com/christophhart/HISE / copyTo

Method copyTo

hi_scripting/scripting/api/ScriptingApiObjects.cpp:6444–6518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6442
6443
6444bool ScriptingObjects::ScriptUnorderedStack::copyTo(var target)
6445{
6446 if (target.isArray())
6447 {
6448 target.getArray()->clear();
6449 target.getArray()->ensureStorageAllocated(size());
6450
6451 if (isEventStack)
6452 {
6453 for (const auto& e : eventData)
6454 {
6455 auto m = new ScriptingMessageHolder(getScriptProcessor());
6456 m->setMessage(e);
6457 target.append(var(m));
6458 }
6459 }
6460 else
6461 {
6462 for (const auto& v : data)
6463 target.append(var(v));
6464 }
6465
6466 return true;
6467 }
6468
6469 if (target.isBuffer())
6470 {
6471 if (isEventStack)
6472 {
6473 reportScriptError("Can't copy event stack to buffer");
6474 return false;
6475 }
6476 else
6477 {
6478 auto b = target.getBuffer();
6479
6480 if (isPositiveAndBelow(data.size(), b->size))
6481 {
6482 b->buffer.clear();
6483 FloatVectorOperations::copy(b->buffer.getWritePointer(0), data.begin(), data.size());
6484 return true;
6485 }
6486
6487 return false;
6488 }
6489 }
6490
6491 if (auto otherStack = dynamic_cast<ScriptUnorderedStack*>(target.getObject()))
6492 {
6493 if (isEventStack == otherStack->isEventStack)
6494 {
6495 if (isEventStack)
6496 {
6497 otherStack->eventData.clearQuick();
6498
6499 for (const auto& e : eventData)
6500 otherStack->eventData.insertWithoutSearch(e);
6501

Callers 1

processFrameInternalMethod · 0.45

Calls 15

varFunction · 0.85
isPositiveAndBelowFunction · 0.85
insertWithoutSearchMethod · 0.80
sizeFunction · 0.50
copyFunction · 0.50
isArrayMethod · 0.45
clearMethod · 0.45
getArrayMethod · 0.45
setMessageMethod · 0.45
appendMethod · 0.45
isBufferMethod · 0.45

Tested by

no test coverage detected