advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Would persistence support in C++ make your job easier and more efficient? Or do you believe traditional frameworks such as CORBA work just fine as they are? Let us hear your response to this in our C++ discussion group.
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
Average Rating: 1.9/5 | Rate this item | 23 users have rated this item.
 

How to Create Persistent Objects

In this 10-Minute Solution, Danny Kalev shows you how to implement persistence without resorting to third-party frameworks such as DCOM and CORBA. 


advertisement
ames, distributed database systems, multimedia and graphic applications use persistent objects extensively. Yet presently, C++ doesn't support persistence directly (there are proposals for adding persistence and reflection to C++ in the future). Persistence support is not as trivial as it may seem at first. The size and memory layout of the same object may vary from one platform to another. Different byte ordering, or endian-ness, complicate matters even further.

In this article, I will show how to implement persistence without resorting to third-party frameworks such as DCOM and CORBA. For small and portable applications, this is an effective and satisfactory solution.

To make an object persistent, we have to reserve its state in a non-volatile storage device. Consider an application that records and plays MP3 files. Every clip is represented as an object that contains the title, album, performer, time, bit-rate, recording date and the matching MP3 file. The application displays recently played tracks on the track list.



We need to to implement object persistence without resorting to third-party frameworks such as DCOM and CORBA.



Write a persistent object to retain its state outside the scope of the program in which it was created.

  Next Page: Step 1: Serializing Built-in Datatypes
Page 1: IntroductionPage 3: Step 2: Serializing Objects
Page 2: Step 1: Serializing Built-in Datatypes 
Please rate this item (5=best)
 1  2  3  4  5
advertisement