Serializing CMAPSTRINGTOOBJECT TYPE Object Pointer

How Can I serialize the CMapStringtoOb Type Pointer Object Using Carchieve Type Object.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi kakamna
check this
before doing this U should put in UR class

and in implementation U should do
to hook the Serialize
                  CObject      ::      Serialize(ar);
                  CUserMain::      Serialize(ar);

in Serialize function implementation

            if (ar.IsStoring())
                  nSize = m_strArrUcsScript.GetCount() ;
                  ar            <<            nSize ;
                  for (nIndex = m_strArrUcsScript.GetStartPosition(); nIndex != NULL;)
                        m_strArrUcsScript.GetNextAssoc(nIndex, strCommand, (CObject*&)myClass) ;
                        ar            <<            strCommand ;
                        ar            <<            myClass ;
                  ar            >>            nSize ;
                  for (int nIndex = 0; nIndex < nSize ; nIndex++)
                        ar            >>            strCommand ;
                        ar            >>            myClass ;
                        m_strArrUcsScript.SetAt(strCommand, new CMyClass(myClass)) ;

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kakamnaAuthor Commented:
Hi Inpras
Thank You For U  R reply
can u Please explain why all this is necessary. Because I have red that all the classes drived from cobject support Seialization but when I use the statement
ar << mp;
where mp is Pointer Object of CMaptoStringtoOb class. The result is in the form of an exception. But when I try to use
ar << rc;
where rc is the Object of CRect class It works fine.
Waiting for U r reply
Thanx Again
Hi kakamna
True all object derived from CObject can
be serialized

"CMapStringToOb incorporates the IMPLEMENT_SERIAL macro to support serialization and dumping of its elements. Each element is serialized in turn if a map is stored to an archive, either with the overloaded insertion (<<) operator or with the Serialize member function."

But CArchive class doesnot support Collection classes properly though every help says U can serialize collection classes having micro IMPLEMENT_SERIAL but U need to do it on UR own take the example of CStringArray one more in the path of UR example.

kakamnaAuthor Commented:
Thank U Inparse
I was able to serialize the objects one by one can you send me
your ifo thrigh mail my mail address is
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.