Calling context class functions in an operation path
Since context class functions mainly support event handling, the parameters and return values passed to and returned from context functions are strongly limited. The only reason to allow calling context functions in an operation path is, that sometimes important (maintenance) functionality is called via context class actions.
This makes a lot of sense in an OSI expression. Defining access paths in a program environment, you usually have simpler ways of doing this.
Let us suppose, a function CalculateAge() has been defined in the person context class sPerson. The example below shows, how one may calculate the age for all persons using an access path.
// using operation path for calculating the age
PropertyHandle p_age(obh,
"Person::Persons()->ExecuteInstanceAction('CalculateAge')");
p_age->Execute();
// using basic property handles for calculating the age
PropertyHandle persons(obh,"Person::Persons",PI_Update);
while ( persons.Next() )
persons.ExecuteInstanceAction("CalculateAge",NULL);