Archived

This forum has been archived. Please start a new discussion on GitHub.

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.

mvh

Nis

Comments

  • 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.