Logo ROOT  
Reference Guide
ROOT::Internal::DictSelectionReader Class Reference

Definition at line 238 of file DictSelectionReader.h.

Classes

struct  TemplateInfo
 

Public Member Functions

 DictSelectionReader (cling::Interpreter &interp, SelectionRules &, const clang::ASTContext &, ROOT::TMetaUtils::TNormalizedCtxt &)
 Take the selection rules as input (for consistency w/ other selector interfaces) More...
 
bool shouldVisitTemplateInstantiations () const
 
bool VisitRecordDecl (clang::RecordDecl *)
 Visit the entities that needs to be selected. More...
 

Private Member Functions

template<class T >
unsigned int ExtractTemplateArgValue (const T &, const std::string &)
 Extract the value of the template parameter. More...
 
bool FirstPass (const clang::RecordDecl &)
 First pass on the AST. More...
 
void GetPointeeType (std::string &typeName)
 Get name of the pointee type. More...
 
const clang::TemplateArgumentList * GetTmplArgList (const clang::CXXRecordDecl &)
 Get the template arguments list if any. More...
 
bool InSelectionNamespace (const clang::RecordDecl &, const std::string &str="")
 Check if in the ROOT::Meta::Selection namespace. More...
 
void ManageBaseClasses (const clang::CXXRecordDecl &, const std::string &, bool &)
 Take care of the class bases. More...
 
void ManageFields (const clang::RecordDecl &, const std::string &, ClassSelectionRule &, bool)
 Take care of the class fields. More...
 
std::string PatternifyName (const std::string &className)
 Transform instance name in pattern for selection. More...
 
bool SecondPass (const clang::RecordDecl &)
 Second pass on the AST, using the information of the first one. More...
 

Private Attributes

llvm::StringMap< std::set< std::string > > fAutoSelectedClassFieldNames
 Collect the autoselected classes. More...
 
llvm::StringMap< ClassSelectionRulefClassNameSelectionRuleMap
 Map of the already built sel rules. More...
 
bool fIsFirstPass
 Keep trance of the number of passes through the AST. More...
 
llvm::StringMap< std::set< std::string > > fNoAutoSelectedClassFieldNames
 Collect the autoexcluded classes. More...
 
ROOT::TMetaUtils::TNormalizedCtxtfNormCtxt
 The reference to the normalized context. More...
 
std::set< const clang::RecordDecl * > fSelectedRecordDecls
 The pointers of the selected RecordDecls. More...
 
SelectionRulesfSelectionRules
 The selection rules to be filled. More...
 
std::set< std::string > fSpecialNames
 The names of the classes used for the selction syntax. More...
 
std::unordered_map< std::string, TemplateInfofTemplateInfoMap
 List template name - properties map. More...
 

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/core/dictgen/res/DictSelectionReader.h>

Inheritance diagram for ROOT::Internal::DictSelectionReader:
[legend]

Constructor & Destructor Documentation

◆ DictSelectionReader()

ROOT::Internal::DictSelectionReader::DictSelectionReader ( cling::Interpreter &  interp,
SelectionRules selectionRules,
const clang::ASTContext &  C,
ROOT::TMetaUtils::TNormalizedCtxt normCtxt 
)

Take the selection rules as input (for consistency w/ other selector interfaces)

Definition at line 22 of file DictSelectionReader.cxx.

Member Function Documentation

◆ ExtractTemplateArgValue()

template<class T >
unsigned int ROOT::Internal::DictSelectionReader::ExtractTemplateArgValue ( const T &  myClass,
const std::string &  pattern 
)
inlineprivate

Extract the value of the template parameter.

Extract the value of the integral template parameter of a CXXRecordDecl when it has a certain name.

If nothing can be extracted, the value of zero is returned.

Definition at line 121 of file DictSelectionReader.cxx.

◆ FirstPass()

bool ROOT::Internal::DictSelectionReader::FirstPass ( const clang::RecordDecl &  recordDecl)
inlineprivate

First pass on the AST.

Manage the first pass over the AST, inspecting only nodes which are within the selection namespace.

Selection rules are directly filled as well as data sructures re-used during the second pass.

Definition at line 250 of file DictSelectionReader.cxx.

◆ GetPointeeType()

void ROOT::Internal::DictSelectionReader::GetPointeeType ( std::string &  typeName)
inlineprivate

Get name of the pointee type.

Transform the name of the type eliminating the trailing & and *.

Definition at line 411 of file DictSelectionReader.cxx.

◆ GetTmplArgList()

const clang::TemplateArgumentList * ROOT::Internal::DictSelectionReader::GetTmplArgList ( const clang::CXXRecordDecl &  cxxRcrdDecl)
inlineprivate

Get the template arguments list if any.

Get the pointer to the template arguments list.

Return zero if not available.

Definition at line 102 of file DictSelectionReader.cxx.

◆ InSelectionNamespace()

bool ROOT::Internal::DictSelectionReader::InSelectionNamespace ( const clang::RecordDecl &  recordDecl,
const std::string &  className = "" 
)
inlineprivate

Check if in the ROOT::Meta::Selection namespace.

If it's not contained by 2 namespaces, drop it.

Check that the recordDecl is enclosed in the ROOT::Meta::Selection namespace, excluding the portion dedicated the definition of the syntax, which is part of ROOT, not of the user code. If performance is needed, an alternative approach to string comparisons could be adopted. One could use for example hashes of strings in first approximation.

Definition at line 63 of file DictSelectionReader.cxx.

◆ ManageBaseClasses()

void ROOT::Internal::DictSelectionReader::ManageBaseClasses ( const clang::CXXRecordDecl &  cxxRcrdDecl,
const std::string &  className,
bool &  autoselect 
)
inlineprivate

Take care of the class bases.

Check the traits of the class.

Useful information may be there extract mothers, make a switchcase: 1) templates args are to be skipped 2) There are properties. Make a loop. make a switch: 2a) Is splittable Manage the loop over the base classes. Initially, the class attributes are identified and selection rules filled if:

  1. The class is not splittable Then we look for the traits pointing to the need of hiding template arguments. This information is stored in the form of a list of pairs, where the first argument is the pattern of the template instance to match and the second one the number of arguments to be skipped. This information is used during the second pass.

Definition at line 217 of file DictSelectionReader.cxx.

◆ ManageFields()

void ROOT::Internal::DictSelectionReader::ManageFields ( const clang::RecordDecl &  recordDecl,
const std::string &  className,
ClassSelectionRule csr,
bool  autoselect 
)
inlineprivate

Take care of the class fields.

Iterate on the members to see if 1) They are transient 2) They imply further selection.

Loop over the class filelds and take actions according to their properties

  1. Insert a field selection rule marking a member transient
  2. Store in a map the name of the field the type of which should be autoselected. The key is the name of the class and the value the name of the field. This information is used in the second pass.

Definition at line 152 of file DictSelectionReader.cxx.

◆ PatternifyName()

std::string ROOT::Internal::DictSelectionReader::PatternifyName ( const std::string &  className)
inlineprivate

Transform instance name in pattern for selection.

Transform a name of a class instance into a pattern for selection e.g.

myClass<double, int, ...> in the selection namespace will translate into a pattern of the type myClass<*>

Definition at line 400 of file DictSelectionReader.cxx.

◆ SecondPass()

bool ROOT::Internal::DictSelectionReader::SecondPass ( const clang::RecordDecl &  recordDecl)
inlineprivate

Second pass on the AST, using the information of the first one.

Second pass through the AST.

Two operations are performed:

  1. Selection rules for classes to be autoselected are created. The algorithm works as follows: the members of the classes matching the name of the classes which contained autoselected members in the selection namespace are inspected. If a field with the same name of the one which was autoselected a selection rule based on its typename is built.
  2. If a class is found which is a TemplateSpecialisationDecl its name is checked to match one of the patterns identified during the first pass. If a match is found, a property is added to the selection rule with the number of template arguments to keep in order to percolate this information down to the AnnotatedRecordDecl creation which happens in the RScanner .

Definition at line 307 of file DictSelectionReader.cxx.

◆ shouldVisitTemplateInstantiations()

bool ROOT::Internal::DictSelectionReader::shouldVisitTemplateInstantiations ( ) const
inline

Definition at line 248 of file DictSelectionReader.h.

◆ VisitRecordDecl()

bool ROOT::Internal::DictSelectionReader::VisitRecordDecl ( clang::RecordDecl *  recordDecl)

Visit the entities that needs to be selected.

Definition at line 385 of file DictSelectionReader.cxx.

Member Data Documentation

◆ fAutoSelectedClassFieldNames

llvm::StringMap<std::set<std::string> > ROOT::Internal::DictSelectionReader::fAutoSelectedClassFieldNames
private

Collect the autoselected classes.

Definition at line 292 of file DictSelectionReader.h.

◆ fClassNameSelectionRuleMap

llvm::StringMap<ClassSelectionRule> ROOT::Internal::DictSelectionReader::fClassNameSelectionRuleMap
private

Map of the already built sel rules.

Definition at line 297 of file DictSelectionReader.h.

◆ fIsFirstPass

bool ROOT::Internal::DictSelectionReader::fIsFirstPass
private

Keep trance of the number of passes through the AST.

Definition at line 298 of file DictSelectionReader.h.

◆ fNoAutoSelectedClassFieldNames

llvm::StringMap<std::set<std::string> > ROOT::Internal::DictSelectionReader::fNoAutoSelectedClassFieldNames
private

Collect the autoexcluded classes.

Definition at line 294 of file DictSelectionReader.h.

◆ fNormCtxt

ROOT::TMetaUtils::TNormalizedCtxt& ROOT::Internal::DictSelectionReader::fNormCtxt
private

The reference to the normalized context.

Definition at line 299 of file DictSelectionReader.h.

◆ fSelectedRecordDecls

std::set<const clang::RecordDecl *> ROOT::Internal::DictSelectionReader::fSelectedRecordDecls
private

The pointers of the selected RecordDecls.

Definition at line 288 of file DictSelectionReader.h.

◆ fSelectionRules

SelectionRules& ROOT::Internal::DictSelectionReader::fSelectionRules
private

The selection rules to be filled.

Definition at line 286 of file DictSelectionReader.h.

◆ fSpecialNames

std::set<std::string> ROOT::Internal::DictSelectionReader::fSpecialNames
private

The names of the classes used for the selction syntax.

Definition at line 290 of file DictSelectionReader.h.

◆ fTemplateInfoMap

std::unordered_map<std::string, TemplateInfo> ROOT::Internal::DictSelectionReader::fTemplateInfoMap
private

List template name - properties map.

Definition at line 295 of file DictSelectionReader.h.


The documentation for this class was generated from the following files: