Home Help Center

Object Factories and object initialisation

As far as I have been able to determine, then when you create an object with an Object Factory, the object factory will first call the constructor of the implementation class specified in the factory, and then all the public members specified in the slice definition are set.

Now my question is - Is there anyway I can setup some kind of initialisation function which is called by the object factory (Or something similar) _after_ all the public members have been set, so that I can do my initialisation based on the data that was actually transmitted.

Of course I could call such an initialisation function in all the slice functions where I receive an object, but it just isn't as elegant as an extension of the object factory would be.




  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Yes, you can overload ice_postUnmarshal(), which will be called after all data members have been initialized. For an example, have a look at test/Ice/object.

    Apparently we have this not documented in the Ice manual. We will fix this with the next release.
Sign In or Register to comment.