Object Handler - value object and object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Object Handler - value object and object

Candy Chiu
Hi,

I noticed in the account example that two objects were created per entity.   For example, to create a Customer,

    boost::shared_ptr <ObjectHandler::ValueObject> valueObject(
        new AccountExample::CustomerValueObject(objectID, name, age, false));

    boost::shared_ptr<ObjectHandler::Object> object(
        new AccountExample::CustomerObject(valueObject, name, age, false));

first creates a ValueObject, then later passes it to an Object.

Would any one provide a quick explanation of the design philosophy behind creating two objects per entity?

Thank you very much.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Object Handler - value object and object

Eric Ehlers-2
Hello,

> Would any one provide a quick explanation of the design philosophy behind
> creating two objects per entity?

The ValueObject captures the inputs to the Object's constructor.  The  
main use of the ValueObject is to support serialization.  The  
ValueObject is compatible with the boost::serialization and can be  
serialized natively and after serialization can be used to reconstruct  
the original Object.

Regards,
Eric


------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users