Solved

How to serialize multidimensional CArray objects?

Posted on 1998-01-27
7
469 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
zeroMAx challenge 20 114
Use of condition with 'serial' in ansible 2 71
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 104
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

830 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