Login Page - Create Account

Support Board


Date/Time: Thu, 19 Sep 2024 23:53:10 +0000



Post From: Storing values in containers when using manual looping?

[2013-07-19 00:21:52]
User45685 - Posts: 36
Dear Support,

A couple of days ago I asked about data retention while using sc.autoloop=1 and you refered me to persistent variables. This is fine and I have a working solution in place.

From a theoretical standpoint i have a different question; Assuming I'm using a manual for loop instead of autolooping and i place the std::list storage container outside of the for loop, will the data be retained?

SCSFExport scsf_Example(SCStudyInterfaceRef sc)
{

if (sc.SetDefaults)
{
// Set the configuration and defaults
Settings here

}

//Storage of information needed between calls
std::list<int> Container1;
std::list<float> Container2;

//Dataprocessing here
for (int i = sc.UpdateStartIndex; i < sc.ArraySize; i++)
{
//Calculation/Drawing code in here
Container1.push_back(calculatedvaluehere);
}


//END

}


As per this (crude) example, would Container1 and Container2 retain the data that are inserted into it within the for loop retain their data or does the way manual looping work also include the flushing of everything outside of the for loop as it does with autoloop=1 ?