Interesting! Are you looking at the C++ code? Assuming you are, some
comments inline.


On 24/08/06, Mark Trumbo <[EMAIL PROTECTED]> wrote:

Given some function

    int SomePropertyPlusTwoFunction(DataObjectPtr dc) { return
dc->getInteger("SomeProperty") + 2; }

I would like to write

    myDataFactory->addMethodToType(uri, "SomePropertyPlusTwo",
                                   "MyTypeWithSomeProperty",
                                   "SomePropertyPlusTwo", intType,
                                             SomePropertyPlusTwoFunction);

which would associate the function SomePropertyPlusTwoFunction with the
name SomePropertyPlusTwo and then


so this is a new method on DataFactory adding a "pseudo-property" to a type.
I assume the "intType" is the type of the value returned by the named
function?


   dc->getValue("SomePropertyPlusTwo");

which would invoke the function SomePropertyPlusTwoFunction


and this is a new method on DataObject? You'd need one method for each type
I think. Or... would you just code
    dc->getInteger(<pseudo-property-name>);

Everything else would behave as though this were a read-only attribute --
queries, serialization, etc -- but instead returning data using a name as a
key, the key would be associated with a function. Conceptually, the
intention is to a const member function that takes no arguments, which is
almost indistinguishable from read-only data.


So would you expect the serialization to include
   <sometypeelement      SomePropertyPlusTwo=23 >
in other words this is added as a "real property" as well. Would you expect
to be able to set the property using
  dc->setInteger("SomePropertyPlusTwo", 3) ... or whatever the syntax is!


Is there already a way to do what I want to do?


I don't think so


If not, is having such a facility inconsistent in any way with the rest of
SDO?


I guess the SDO spec folk would be better able to answer this. I think it's
quite an intersting idea.


If not, is any one working on this?


not that I know of

If not, I will.


feel free to experiment ;-)

Cheers,

--
Pete

Reply via email to