Solved

How to serialize multidimensional CArray objects?

Posted on 1998-01-27
7
468 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 82
abstract class with all non abstract mentods 6 76
changeXy challenge 13 81
Problem to App 4 78
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

815 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

6 Experts available now in Live!

Get 1:1 Help Now