Ignore:
Timestamp:
11/13/14 15:09:14 (9 years ago)
Author:
mhnguyen
Message:

Implementing buffer size auto-detection for mode client -server

+) Process xml tree in client side then send all the information to server
+) Only information enabled fields in enabled files are sent to server
+) Some important change in structure of code which must be refactored

Test
+) On Curie
+) Only mode client-server
+) Passed for all tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/xml_parser.cpp

    r501 r509  
    1313      /// ////////////////////// Définitions ////////////////////// /// 
    1414 
    15       void CXMLParser::ParseFile(const StdString & filename) 
     15      void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 
    1616      { 
    1717         StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
     
    2020                  <<endl<< "Can not open <"<<filename<<"> file" ); 
    2121 
    22          CXMLParser::ParseStream(ifs, filename); 
     22         CXMLParser::ParseStream(ifs, filename, parseContextList); 
    2323      } 
    2424 
     
    2626      { 
    2727         StdIStringStream iss ( xmlContent /*, StdIStringStream::in*/ ); 
    28          CXMLParser::ParseStream(iss,"string"); 
     28         std::set<StdString> contxtList; 
     29         CXMLParser::ParseStream(iss,"string", contxtList); 
    2930      } 
    3031 
    31       void CXMLParser::ParseStream(StdIStream & stream, const string& fluxId) 
     32      void CXMLParser::ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseContextList) 
    3233      { 
    3334         if (!stream.good()) 
     
    5051                     << node.getElementName() << "\')!"); 
    5152 
     53            std::set<StdString>::iterator it; 
     54            std::set<StdString>::const_iterator itE = parseContextList.end(); 
     55            bool isParseAll = (parseContextList.empty()); 
    5256            if (node.goToChildElement()) 
    5357            { 
     
    5559               { 
    5660                  CContextGroup* group_context = CContext::getRoot() ; 
    57   
     61 
    5862                  attributes = node.getAttributes(); 
    5963 
    6064                  if (attributes.end() == attributes.find("id")) 
    61                   {   
     65                  { 
    6266                     DEBUG("The context will not be processed because it is not identified (missing id)"); 
    63                      continue;  
     67                     continue; 
    6468                  } 
    6569 
     
    6973 
    7074                  if(hasctxt) 
    71                   {   
     75                  { 
    7276                     DEBUG("The context will not be processed because it exist an other context with the same id" ); 
    73                      continue;  
     77                     continue; 
    7478                  } 
    7579 
    76                   CContext* context = CContext::create(attributes["id"]); 
     80                  if (isParseAll) 
     81                  { 
     82                    CContext* context = CContext::create(attributes["id"]); 
    7783//                  if (!hasctxt)  group_context->addChild(context); 
    78                   context->parse(node); 
     84                    context->parse(node); 
    7985 
    80                   attributes.clear(); 
     86                    attributes.clear(); 
     87                  } 
     88                  else 
     89                  { 
     90                    it = parseContextList.find(attributes["id"]); 
     91                    if (itE != it) 
     92                    { 
     93                      CContext* context = CContext::create(*it); 
     94  //                  if (!hasctxt)  group_context->addChild(context); 
     95                      context->parse(node); 
    8196 
     97                      attributes.clear(); 
     98                    } 
     99                  } 
    82100               } while (node.goToNextElement()); 
    83101            } 
     
    93111            const char* line; 
    94112            const char* endLine; 
    95              
     113 
    96114            for(const char* i=content;i<content+pos; ++i, ++columnNumber) if (*i=='\n') { lineNumber++ ; line=i ; columnNumber=0 ;} 
    97115            for(endLine=content+pos; *endLine!='\n' && *endLine!='\0' ; ++endLine) ; 
    98116            string strLine(line,endLine-line) ; 
    99                    
     117 
    100118            ERROR("CXMLParser::ParseStream(StdIStream & stream)", << endl 
    101119                  << "Error is occuring when parsing XML flux from <"<<fluxId<<"> at character "<< pos<<" line "<<lineNumber<<" column "<< columnNumber<< endl 
Note: See TracChangeset for help on using the changeset viewer.