Reflex is ROOT's (or actually CINT's) reflection database. It knows everything about all classes, types, and members in the system. We are currently in the process of a major update of Reflex, including changes in the API and its internal structures. Bare with us - you will get proper documentation once this upgrade is finished. Until then this is what you need to know:

Filling Reflex

Reflex is a container - it does not know anything by itself. You can use genreflex, a python script wrapping GCCXML, or rootcint -reflex or regular rootcint and Cintex, by calling Cintex::Enable(). In the near future, CINT will use Reflex directly; any dictionary loaded by CINT will automatically populate Reflex.

Retrieving data

The main user interface to the Reflex data consists of

Reflex::Type
represents any type, from basic ones like int to e.g. Reflex::Type itself.
Reflex::Scope
represents a namespace, class, struct, union, etc - anything that can have members, e.g. the global scope :: or Reflex::Type.
Reflex::Member
represents a data or function member of a scope.

Note that conversions exist, e.g. Reflex::Member is both a scope and a type, thus a Reflex::Scope representing Reflex::Member can be converted to a Reflex::Type. Just check the list of member functions for these types - they are easy to understand.

Example

Once you have filled your reflection data into Reflex you can e.g. query it for the first parameter of the function Reflex::Scope::SubTypeByName():
using Reflex; // save typing
 
Scope s = Scope::ByName("Reflex::Scope"); // the scope containing the member we want to query
Member m = s.FunctionMemberByName("SubTypeByName"); // get the function member
Type mt = m.TypeOf(); // we need its type
Type arg = mt.FunctionParameterAt(0); // the type of the first function parameter
 
cout << arg.Name(SCOPED | QUALIFIED) << endl; // print the scoped and qualified name

 

Class reference