I have a class that picks up data from the serial port and I receive the amount of switches a LDR measures just 1 and 0.
Now I would like to store this in a class as long the program runs how can I accomplish this with managed variables?
Note the serial class runs every second so when I create open a class that I use now
StoreClass Store
Store.Value = LDR_Value; // LDR_Value is the value from the serial bus
When I do this there always will be a copy of StoreClass be created and that doesn’t do the trick.
Please help me out here.
If you want to accumulate your data in a container, use standard containers. I think
std::vectorwould suffice as a good container for your job: