00001 // @(#)root/core:$Id: RConversionRuleParser.h 34659 2010-07-29 16:33:47Z pcanal $ 00002 // author: Lukasz Janyst <ljanyst@cern.ch> 00003 00004 #ifndef R__R_CONVERSION_RULE_PARSER_H 00005 #define R__R_CONVERSION_RULE_PARSER_H 00006 00007 #if !defined(__CINT__) 00008 // Avoid clutering the dictionary (in particular with the STL declaration) 00009 00010 #include <list> 00011 #include <map> 00012 #include <string> 00013 #include <ostream> 00014 #include <utility> 00015 00016 #ifndef __MAKECINT__ 00017 #include "Api.h" 00018 #include "Shadow.h" 00019 #else 00020 class G__ClassInfo; 00021 #endif 00022 00023 #ifndef R__TSCHEMATYPE_H 00024 #include "TSchemaType.h" 00025 #endif 00026 00027 namespace ROOT 00028 { 00029 //--------------------------------------------------------------------------- 00030 // Global variables 00031 //--------------------------------------------------------------------------- 00032 typedef std::map<std::string, std::string> SchemaRuleMap_t; 00033 typedef std::map<std::string, std::list<SchemaRuleMap_t> > SchemaRuleClassMap_t; 00034 extern SchemaRuleClassMap_t G__ReadRules; 00035 extern SchemaRuleClassMap_t G__ReadRawRules; 00036 00037 typedef std::map<std::string, ROOT::TSchemaType> MembersTypeMap_t; 00038 typedef std::map<std::string, std::string> MembersMap_t; 00039 00040 //--------------------------------------------------------------------------- 00041 // Create the data member name-type map 00042 //--------------------------------------------------------------------------- 00043 void CreateNameTypeMap( G__ClassInfo &cl, MembersTypeMap_t& members ); 00044 00045 //--------------------------------------------------------------------------- 00046 // Check if given rule contains references to valid data members 00047 //--------------------------------------------------------------------------- 00048 bool HasValidDataMembers( SchemaRuleMap_t& rule, MembersTypeMap_t& members ); 00049 00050 //--------------------------------------------------------------------------- 00051 // Write the conversion function for Read rule 00052 //--------------------------------------------------------------------------- 00053 void WriteReadRuleFunc( SchemaRuleMap_t& rule, int index, 00054 std::string& mappedName, 00055 MembersTypeMap_t& members, std::ostream& output ); 00056 00057 00058 //--------------------------------------------------------------------------- 00059 // Write the conversion function for ReadRaw rule 00060 //--------------------------------------------------------------------------- 00061 void WriteReadRawRuleFunc( SchemaRuleMap_t& rule, int index, 00062 std::string& mappedName, 00063 MembersTypeMap_t& members, std::ostream& output ); 00064 00065 //--------------------------------------------------------------------------- 00066 // Write schema rules 00067 //--------------------------------------------------------------------------- 00068 void WriteSchemaList( std::list<SchemaRuleMap_t>& rules, 00069 const std::string& listName, std::ostream& output ); 00070 00071 //--------------------------------------------------------------------------- 00072 // Get the list of includes defined in schema rules 00073 //--------------------------------------------------------------------------- 00074 void GetRuleIncludes( std::list<std::string> &result ); 00075 00076 //--------------------------------------------------------------------------- 00077 // Parse read pragma 00078 //--------------------------------------------------------------------------- 00079 bool ParseRule( std::string rule, MembersMap_t &result, std::string &error_string ); 00080 00081 //--------------------------------------------------------------------------- 00082 // Parse read pragma 00083 //--------------------------------------------------------------------------- 00084 void ProcessReadPragma( char* args ); 00085 00086 //--------------------------------------------------------------------------- 00087 // Parse readraw pragma 00088 //--------------------------------------------------------------------------- 00089 void ProcessReadRawPragma( char* args ); 00090 } 00091 #endif // !defined(__CINT__) 00092 00093 #endif // R__R_CONVERSION_RULE_PARSER_H 00094