22.214.171.124. C++ Support within GEL Expressions¶
The following C++ enhancements have been added to the GEL expression syntax.
Access to data members
The '.' and '->' operators (direct and indirect member selection) have been extended to allow access to data members of classes. All data members are accessible, regardless of C++ access type (public, protected, or private). Data members of base classes are also available (unless shadowed by members of the derived class with the same name). Member names that would be considered ambiguous by a C++ compiler are resolved by Code Composer Studio to one of the possible matches.
Variable identifiers may be fully or partially-qualified. Global or class static functions or variables are accessible using the :: scope operator (for instance,
MyClass::static_var). The current scope is determined by the Program Counter (PC), and inner scopes take precedence over outer.
For example, if the PC is currently in the function:
and the identifier
C1::b is evaluated, it will match any of these fully-qualified identifiers (in order of precedence)
Nested types must be referred to by their fully-qualified name.
When the PC is in a member function, the this pointer to the associated object is available.
Implicit access to class members
When the PC is in a member function, any data members of the class (or base classes) are available directly, without needing to be explicitly indirected from this. For example,
m_x will resolve to
this->m_x (assuming no local variable shadows it).
Casting object pointers
The C/C++ pointer cast operation
(Type \*) value can be used to navigate class hierarchies, adjusting pointers where necessary. Similar to the C++ compiler, a static_cast is performed where possible, otherwise a reinterpret_cast is performed.
(Derived \*) base and
(Base \*) derived perform correctly even in the presence of multiple inheritance or virtual inheritance.