Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RConversionRuleParser.h
Go to the documentation of this file.
1 // @(#)root/core:$Id$
2 // author: Lukasz Janyst <ljanyst@cern.ch>
3 
4 #ifndef R__CONVERSION_RULE_PARSER_H
5 #define R__CONVERSION_RULE_PARSER_H
6 
7 #include <list>
8 #include <map>
9 #include <string>
10 #include <ostream>
11 #include <utility>
12 
13 #include "RConfigure.h"
14 
15 #include "TSchemaType.h"
16 #include "DllImport.h"
17 
18 namespace ROOT
19 {
20  //---------------------------------------------------------------------------
21  // Global variables
22  //---------------------------------------------------------------------------
23  typedef std::map<std::string, std::string> SchemaRuleMap_t;
24  typedef std::map<std::string, std::list<SchemaRuleMap_t> > SchemaRuleClassMap_t;
25  R__EXTERN SchemaRuleClassMap_t gReadRules;
26  R__EXTERN SchemaRuleClassMap_t gReadRawRules;
27 
28  typedef std::map<std::string, ROOT::Internal::TSchemaType> MembersTypeMap_t;
29 
30  //---------------------------------------------------------------------------
31  // Create the data member name-type map
32  //---------------------------------------------------------------------------
33  // void CreateNameTypeMap( const clang::CXXRecordDecl &cl, MembersTypeMap_t& members );
34 
35  //---------------------------------------------------------------------------
36  // Check if given rule contains references to valid data members
37  //---------------------------------------------------------------------------
38  bool HasValidDataMembers( SchemaRuleMap_t& rule, MembersTypeMap_t& members,
39  std::string& error_string);
40 
41  //---------------------------------------------------------------------------
42  // Write the conversion function for Read rule
43  //---------------------------------------------------------------------------
44  void WriteReadRuleFunc( SchemaRuleMap_t& rule, int index,
45  std::string& mappedName,
46  MembersTypeMap_t& members, std::ostream& output );
47 
48 
49  //---------------------------------------------------------------------------
50  // Write the conversion function for ReadRaw rule
51  //---------------------------------------------------------------------------
52  void WriteReadRawRuleFunc( SchemaRuleMap_t& rule, int index,
53  std::string& mappedName,
54  MembersTypeMap_t& members, std::ostream& output );
55 
56  //---------------------------------------------------------------------------
57  // Write schema rules
58  //---------------------------------------------------------------------------
59  void WriteSchemaList( std::list<SchemaRuleMap_t>& rules,
60  const std::string& listName, std::ostream& output );
61 
62  //---------------------------------------------------------------------------
63  // Get the list of includes defined in schema rules
64  //---------------------------------------------------------------------------
65  void GetRuleIncludes( std::list<std::string> &result );
66 
67  //---------------------------------------------------------------------------
68  // Parse read pragma
69  //---------------------------------------------------------------------------
70  bool ParseRule(std::string rule, ROOT::Internal::MembersMap_t &result, std::string &error_string );
71 
72  //---------------------------------------------------------------------------
73  // Parse read pragma
74  //---------------------------------------------------------------------------
75  void ProcessReadPragma( const char* args, std::string& error_string );
76 
77  //---------------------------------------------------------------------------
78  // Parse readraw pragma
79  //---------------------------------------------------------------------------
80  void ProcessReadRawPragma( const char* args, std::string& error_string );
81 }
82 
83 #endif // R__CONVERSION_RULE_PARSER_H
84