accessing data with different views

T

toton

Hi,
once again. I have some data, and different ways to view them. The
data's are say points when one writes on the screen using stylus. They
forms certain character. I am reading the points in a deque and
removing older points (In sort I am storing only a portion of the data
in memory).
Now there are ways to view the datas.
Say Page-> Line -> Word -> Character -> Points
This can be done only when someone recognizes the characters.
Or alternatively Page -> Stroke (a single stroke) ->Points
Even say Page -> Stroke -> Segment (Up or down stroke) -> Points.

Thus what becomes necessary, NOT to store the Points in character,
character in word etc using contained relationship. Alternative I am
thinking is to store points in a deque, and Character stores 2
iterators pointing to the portion in the deque. Similarly Word stores a
pair of iterator for the deque of character. It will go similar way.
And when something pop_front from a deque, it will do so for all, to
make consistancy. Like if a line gets removed from its deque, it will
remove all words from word's deque, which in turn will remove all
characters from character deque. And it will go on. If something is
shared between two branches only one pop_front will be trigerred (Like
point is shared by all brunches, removing a Page won't remove points
twice from the deque)

Now the questions are,
1) Is this way is having any known problem? Any other way to share same
data with different viewes?
2) If Character wants to store pointer (iterator) a portion of the
points what will I store exactly? 2 int (or size_t) and construct a
range from them and return ? or two iterators directly ( at present I
can't do it as they are not default constructable and sometimes the
range is computed later, like a Stroke knows the range of points during
construction time, but knows range of segments after segment
computation). Or pointer to the iterator (quite crazy idea! )
3) How the removal can be made a synchronized one, ie. removal of one
level automatically removes its sub levels . An contained relationship
do that automatically, but do not support multiple hierarchical view
which I need. An alternative way is to store pointer (shared ) of the
data in the container, but not finding a proper way to implement it.

Any suggestions are welcome.
Thanks
abir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top