Solved

How to serialize multidimensional CArray objects?

Posted on 1998-01-27
7
467 Views
Last Modified: 2013-11-19
I have developped an application that uses multidimensional CArray objects. I need to save these arrays and I haven't found the way to do it. The CArrays contain mainly double numbers.
Tle arrays are initialized so;

typedef CArray <double,int> OneInPattern;
CArray <OneInPattern,OneInPattern&> InPattern;

Any cue?

Thanks

Marisol
0
Comment
Question by:Marisol
7 Comments
 

Author Comment

by:Marisol
ID: 1314930
Edited text of question
0
 
LVL 7

Expert Comment

by:galkin
ID: 1314931
CArray is actually derived from CObject so you can take advantage of Serialize function and << and >> operators
0
 

Author Comment

by:Marisol
ID: 1314932
I have that already and it didn't work.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Expert Comment

by:mikeblas
ID: 1314933
Your declaration is bogus.

You've declared a CArray that uses an index of integers to store doubles, which is natural enough. You've typedef'ed that to be called OneInPattern.  You can do things like this:

   OneInPattern array;
   array[3] = 3.1415929;

You've then declared a CArray that uses an index of references to CArrays and stores other CArrays. That's entirely bogus.

Don't you really mean to code:

   typedef CArray <double,int> OneInPattern;
   CArray <OneInPattern&, int> InPattern;

?  That way, you can do things like this:

   // set [3][5] to 2.17.
   InPattern[3].SetAt(5, 2.17);

.B ekiM

0
 
LVL 1

Expert Comment

by:atari
ID: 1314934
I have a full class developed for my own project called CDouble2dArray. With it you can simply create multidimensional double-arrays. If you change to int, word ... you can easily create new multidimensional arrays like CInt2dArray. I can also serialize this multidimensional arrays. If you want the complete .cpp-file send me an email at MKuelsh@aol.com.

Hope this helps
0
 
LVL 1

Accepted Solution

by:
atari earned 50 total points
ID: 1314935
I have put a new answer to this question, now you can grade if you like ?!

Haven't you got my email, I send to you the last days ?

Bye,
atari

0
 
LVL 1

Expert Comment

by:atari
ID: 1314936
How about grading, Marisol ?

Bye,
atari
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now