Solved

How to serialize multidimensional CArray objects?

Posted on 1998-01-27
7
466 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

13 Experts available now in Live!

Get 1:1 Help Now