RogueWave's RWCollectable

N

Naresh

Hi Experts,

I am migrating from RogueWave to STL. I am facing some
problem over RWCollectable class.

Some Background:

Since RWCollectable is a base class implementing polymorpic
persistency, any class derived from RWCollectable will also have this
feature.RWOrdered is also derived from RWCollectable.


Now I have following code snippest:

main()
{
RWOrdered collection;

RWCollectableString* george;
george = new RWCollectableString("George");

collection.insert(george); // Add the string once
collection.insert(george); // Add the string twice
collection.insert(new RWCollectableInt(100));
collection.insert(new RWCollectableDate(3, "May", 1959));

// "Store" to cout using portable stream:
RWpostream ostr(cout);
ostr << collection;

collection.clearAndDestroy();

return 0;
}

Above code maintains polymorphic persistency (i.e. string george will
be inserted only once to the stream and while we resore, we will have
same object morph.).

My Questions are:

1> Persistency should be the functionality of RWOrdered and not
RWCollectableString. Why we use RWCollectableString ?. If I dont use
RWCollectableSting and simply use RWCSting what would have happened
fundamentaly ?

2> What will be the design of RWCollectableString to maintain
polymorphic persistency ?


3> I found lots of code as follow:

main(){
RWOrdered od;
od.insert(new RWCollectableInt(0)); // 0
od.insert(new RWCollectableInt(1)); // 0 1
od.insert(new RWCollectableInt(2)); // 0 1 2

delete od(1); // Use variant available for RWOrdered
od.at(1) = new RWCollectableInt(3); // 0 3 2
}

Is there any used of RWCollectableInt there ?


I dont have any RogueWave library with me, So I am not able to conclude
over above questions by some trial and run bases.

Thanks
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top