Changeset 277
- Timestamp:
- 09/20/11 18:10:41 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.cpp
r206 r277 96 96 it != attributes.end(); 97 97 it ++) 98 { 98 99 if ((*it).first.compare(StdString("id")) != 0 && 99 100 (*it).first.compare(StdString("src"))!= 0) … … 102 103 CAttributeMap::operator[]((*it).first)->fromString((*it).second); 103 104 } 105 } 104 106 } 105 107 -
XMLIO_V2/dev/dev_rv/src/xmlio/group_factory.hpp
r152 r277 10 10 #include "object_factory.hpp" 11 11 #include "group_template.hpp" 12 #include "xml_parser.hpp" 12 13 13 14 namespace xmlioserver -
XMLIO_V2/dev/dev_rv/src/xmlio/group_parser.hpp
r152 r277 13 13 14 14 StdString name = node.getElementName(); 15 xml::THashAttributes attributes = node.getAttributes(); 15 16 if (withAttr) 17 { 16 18 CGroupTemplate<U, V, W>::SuperClass::parse(node); 19 if (attributes.end() != attributes.find("src")) 20 { 21 StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 22 if (!ifs.good()) 23 ERROR("CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node, bool withAttr)", 24 << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 25 xml::CXMLParser::ParseInclude(ifs, *this); 26 } 27 } 17 28 18 29 // PARSING POUR GESTION DES ENFANTS 19 xml::THashAttributes attributes;20 30 boost::shared_ptr<V> group_ptr = (this->hasId()) 21 31 ? CObjectFactory::GetObject<V>(this->getId()) … … 61 71 << "\' ne peut contenir qu'un objet de type \'" << V::GetName() 62 72 << "\' ou de type \'" << U::GetName() 63 << "\' !");73 << "\' (reçu : " << name << ") !"); 64 74 65 75 } while (node.goToNextElement()); -
XMLIO_V2/dev/dev_rv/src/xmlio/main_server.cpp
r276 r277 35 35 CMPIManager ::DispatchClient(false, comm_client, comm_client_server, comm_server); 36 36 CTreeManager::ParseFile("iodef.xml"); 37 CTreeManager::SetCurrentContextId("context1"); 37 38 boost::shared_ptr<CContext> context = 38 39 CObjectFactory::GetObject<CContext>("context1"); 39 40 xios_set_timestep(0, 0, 0, 1, 0, 0); 40 41 xios_dtreatment_start(context.get(), 0, comm_client_server, -1); 42 41 43 for (int i = 0; i < 200; i++) 42 44 { -
XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp
r276 r277 107 107 108 108 // PARSING POUR GESTION DES ENFANTS 109 xml::THashAttributes attributes; 109 xml::THashAttributes attributes = node.getAttributes(); 110 111 if (attributes.end() != attributes.find("src")) 112 { 113 StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 114 if (!ifs.good()) 115 ERROR("CContext::parse(xml::CXMLNode & node)", 116 << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 117 xml::CXMLParser::ParseInclude(ifs, *this); 118 } 110 119 111 120 if (node.getElementName().compare(CContext::GetName())) -
XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp
r276 r277 519 519 ni_cl = iend_sub[k] - ibegin_sub[k] + 1; 520 520 521 for (int i = zoom_ibegin_cl - 1; i < zoom_ibegin_cl + zoom_ni_cl - 1; i++)521 for (int i = 0; i < zoom_ni_cl; i++) 522 522 { 523 for (int j = zoom_jbegin_cl-1; j < zoom_jbegin_cl + zoom_nj_cl - 1; j++)523 for (int j = 0; j < zoom_nj_cl; j++) 524 524 { 525 int ii = i - (ibegin_serv - 1)+ (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1);526 int jj = j - (jbegin_serv - 1)+ (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1);525 int ii = i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 526 int jj = j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 527 527 (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 528 (*lonvalue_loc)[i + j * ni_cl];528 (*lonvalue_loc)[i + j * zoom_ni_cl]; 529 529 (*latvalue_temp)[ii + jj * zoom_ni_serv] = 530 (*latvalue_loc)[i + j * ni_cl];530 (*latvalue_loc)[i + j * zoom_ni_cl]; 531 531 } 532 532 } … … 547 547 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 548 548 549 for (int i = zoom_ibegin_cl - 1; i < zoom_ibegin_cl + zoom_ni_cl - 1; i++)550 (*lonvalue_temp)[i - (ibegin_serv - 1)+ (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] =549 for (int i = 0; i < zoom_ni_cl; i++) 550 (*lonvalue_temp)[i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 551 551 (*lonvalue_loc)[i]; 552 552 553 for (int j = zoom_jbegin_cl-1; j < zoom_jbegin_cl + zoom_nj_cl - 1; j++)554 (*latvalue_temp)[j - (jbegin_serv - 1)+ (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] =553 for (int j = 0; j < zoom_nj_cl; j++) 554 (*latvalue_temp)[j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 555 555 (*latvalue_loc)[j]; 556 556 } -
XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp
r276 r277 477 477 (*storeIndex_srv)[n] = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 478 478 (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 479 /*+ (ibegin_cl - 1) */ - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);479 /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 480 480 (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 481 /*+ (jbegin_cl - 1) */ - (jbegin_srv - 1)+ (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1);481 /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 482 482 (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 483 483 } -
XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp
r276 r277 77 77 StdString lonid = StdString("lon_").append(domid); 78 78 StdString latid = StdString("lat_").append(domid); 79 StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 80 StdString latid_loc = StdString("lat_").append(domid).append("_local"); 79 StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 80 ? StdString("lon_").append(domid).append("_local") 81 : lonid; 82 StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 83 ? StdString("lat_").append(domid).append("_local") 84 : latid; 81 85 StdString maskid = StdString("mask_").append(domid).append("_local"); 82 86 … … 86 90 bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 87 91 88 SuperClassWriter::addDimension(lonid, domain->ni_glo.getValue()); 89 SuperClassWriter::addDimension(latid, domain->nj_glo.getValue()); 92 if (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 93 { 94 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue()); 95 SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue()); 96 } 90 97 91 98 if (isCurvilinear) … … 229 236 StdString lonid = StdString("lon_").append(domid); 230 237 StdString latid = StdString("lat_").append(domid); 231 StdString lonid_loc = StdString("lon_").append(domid).append("_local"); 232 StdString latid_loc = StdString("lat_").append(domid).append("_local"); 238 StdString lonid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 239 ? StdString("lon_").append(domid).append("_local") 240 : lonid; 241 StdString latid_loc = (comm::CMPIManager::GetCommSize(CXIOSManager::Comm_Server) > 1) 242 ? StdString("lat_").append(domid).append("_local") 243 : latid; 233 244 StdString fieldid = (!field->name.isEmpty()) 234 245 ? field->name.getValue() : field->getBaseFieldReference()->getId(); -
XMLIO_V2/dev/dev_rv/src/xmlio/xml_node.cpp
r272 r277 11 11 CXMLNode::CXMLNode(rapidxml::xml_node<char> * const root) 12 12 : node(root) 13 , level(0) 13 14 { /* Ne rien faire de plus */ } 14 15 … … 48 49 else if (nextElement->type() == rapidxml::node_element) 49 50 { 50 node = nextElement; 51 node = nextElement; 52 level++; 51 53 return (!retvalue); 52 54 } … … 59 61 { 60 62 bool retvalue = false; 61 if (!(this->getElementName().compare(CXMLNode::RootName)) )63 if (!(this->getElementName().compare(CXMLNode::RootName)) || (level == 0)) 62 64 return (retvalue); 63 65 node = node->parent(); 66 level--; 64 67 return (!retvalue); 65 68 } -
XMLIO_V2/dev/dev_rv/src/xmlio/xml_node.hpp
r272 r277 46 46 47 47 rapidxml::xml_node<char> * node; 48 int level; 48 49 49 50 static StdString RootName; -
XMLIO_V2/dev/dev_rv/src/xmlio/xml_parser.cpp
r173 r277 1 1 #include "xml_parser.hpp" 2 3 #include "context.hpp" 2 4 3 5 #include "attribute_template_impl.hpp" … … 12 14 13 15 void CXMLParser::ParseFile(const StdString & filename) 14 { StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 15 CXMLParser::ParseStream(ifs); } 16 { 17 StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 18 CXMLParser::ParseStream(ifs); 19 } 16 20 17 21 void CXMLParser::ParseString(const StdString & xmlContent) … … 86 90 } 87 91 } 92 88 93 }// namespace xml 89 94 } // namespace xmlioserver -
XMLIO_V2/dev/dev_rv/src/xmlio/xml_parser.hpp
r157 r277 4 4 /// xmlioserver headers /// 5 5 #include "xmlioserver_spl.hpp" 6 #include "exception.hpp" 6 7 #include "xml_node.hpp" 7 #include "context.hpp" 8 8 9 9 10 namespace xmlioserver … … 19 20 static void ParseString(const StdString & xmlContent); 20 21 static void ParseStream(StdIStream & stream); 22 template <class T> 23 static inline void ParseInclude(StdIStream & stream, T & object); 21 24 22 25 }; //class CXMLParser 26 27 template <class T> 28 void CXMLParser::ParseInclude(StdIStream & stream, T& object) 29 { 30 StdOStringStream oss; 31 while(!stream.eof() && !stream.fail ()) 32 oss.put(stream.get()); 33 try 34 { 35 const StdString xmlcontent( oss.str(), 0, oss.str().size()-1 ); 36 rapidxml::xml_document<char> doc; 37 doc.parse<0>(const_cast<char*>(xmlcontent.c_str())); 38 CXMLNode node(doc.first_node()); 39 object.parse(node); 40 } 41 catch (rapidxml::parse_error & exc) 42 { 43 ERROR("CXMLParser::ParseStream(StdIStream & stream)", 44 << "RapidXML error : " << exc.what() << " !"); 45 } 46 } 23 47 24 48 }// namespace xml
Note: See TracChangeset
for help on using the changeset viewer.