I have a DataType "OpcValue" -- its definition is
OpcValue
|
___|___
| |
_variant_t CCsTime
1.) I am reading datavalues and timestamps from a file and inserting points of type OpcValue into a CLIST object -- (total 1000 points will be read from the file). A last inserted position is calculated when adding each point.
2.) For every 100th point added, i am storing the position of the 100th point(last inserted position of the 100th point) into a seperate array -- CARRAY.
3.) Now when ever i have to display the values from the CList (may be 388th item) depending on the timestamp, i go through the CARRAy to get
the position of 300th point(3rd item of the CArray) and iterate from there to get the 388th point, thereby avoiding iteration of first 300 points. this saves time and is working excellent.
Now i have 3 scenarios:
i.) The first 400 points are removed from the CLIST (the points near to the tail), and if i am trying to display the remaining points, if i use the CArray's reference (CLIST's position reference stored), the positions are still valid and i am getting the result.
ii.) If i add more points to the CLIST and use the CArray reference, the whole operation is working fine too.
iii.) But in the third scenario, if i add more points and remove some points from the list, the CArray positions are no more valid.
Why is this happening?
Does adding or removing points in a CLIST makes all the positions invalid? If so how is it wroking in the first two cases?