Reflex: access to class members

Hello everybody,
I’m playing with Reflex, now I’m able to look up the structure of my classes, but I have some problem to access the members of a real object via the Reflex system.

Let’s suppose I have a class named MyClass which has an int data member called MyType:
//I get the class type object

MyClass my;
Reflex::Type tt= Reflex::Type::ByName(“MyClass”);
// I get the oject decribing the data member
Member dm = tt.DataMemberByName(“MyType”);

Now from documentation (:? ) Member has a method Get( ) that can be used to access the real data member into the “my” object, but I do not understand how it works, especially about the type casting .

Can you provide an example.


Paolo Zuccon, Ph.D.
INFN – Sezione di Perugia


Sorry for the late reply! I totally did not see your posting… You should be able to use e.g.:

struct MyClass { Something MyType; };

MyClass myObj; Reflex::Object o = Object::Create(myObj); Reflex::Member oMem = o.Get("MyType"); Something* pMyClass_MyType = (Something*) oMem.Address(); pMyClass_MyType->Whatever();

Cheers, Axel.