Results 1 to 5 of 5

Thread: Saving objects

  1. #1
    Aragorn
    Guest

    Question Saving objects

    I wonder if there is any way to save instances of objects keeping all the relations self-consistent after loading them back.
    The problem i see is that pointers would become corrupted after the objects being reloaded into memory. Is there a way to get over that? or do i have to write my own algorithms?

    Thanks in advance

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could 1) index your objects and store the indexes with them. 2) sort your objects by pointer and then have each objects look up their reference's order.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Aragorn
    Guest

    Thumbs up

    thanks. I assume that there is no such automated method. I will use your 1rst) option
    thankye!!

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    no problemo the first will use some extra memory under runtime, so if you don't have too many possible solution for some object references, always try find it in it's array and store the index instead.
    Good luck
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    jim mcnamara
    Guest
    As a note - if you're using MFC:

    DECLARE_SERIAL and IMPLEMENT_SERIAL allow you to use CArchive which handles all the overhead of reading/writing any object to/from disk.

    SDK - stick with Kedaman's ideas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width