mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hadrons: proper metadata for eigenpacks
This commit is contained in:
		@@ -328,7 +328,7 @@ class GridLimeWriter : public BinaryIO
 | 
			
		||||
      {
 | 
			
		||||
	XmlWriter WR("","");
 | 
			
		||||
	write(WR,object_name,object);
 | 
			
		||||
	xmlstring = WR.XmlString();
 | 
			
		||||
	xmlstring = WR.docString();
 | 
			
		||||
      }
 | 
			
		||||
      //    std::cout << "WriteLimeObject" << record_name <<std::endl;
 | 
			
		||||
      uint64_t nbytes = xmlstring.size();
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ THE SOFTWARE.
 | 
			
		||||
#define GRID_MACRO_WRITE_MEMBER(A,B) Grid::write(WR,#B,obj. B);
 | 
			
		||||
 | 
			
		||||
#define GRID_SERIALIZABLE_CLASS_MEMBERS(cname,...)\
 | 
			
		||||
  std::string SerialisableClassName(void) {return std::string(#cname);}	\
 | 
			
		||||
  std::string SerialisableClassName(void) const {return std::string(#cname);}	\
 | 
			
		||||
GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_MEMBER,__VA_ARGS__))\
 | 
			
		||||
template <typename T>\
 | 
			
		||||
static inline void write(Writer<T> &WR,const std::string &s, const cname &obj){ \
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ XmlWriter::XmlWriter(const std::string &fileName, std::string toplev) : fileName
 | 
			
		||||
XmlWriter::~XmlWriter(void)
 | 
			
		||||
{
 | 
			
		||||
  if ( fileName_ != std::string("") ) { 
 | 
			
		||||
    doc_.save_file(fileName_.c_str(), "  ");
 | 
			
		||||
    doc_.save_file(fileName_.c_str(), indent_.c_str());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -57,10 +57,18 @@ void XmlWriter::pop(void)
 | 
			
		||||
{
 | 
			
		||||
  node_ = node_.parent();
 | 
			
		||||
}
 | 
			
		||||
std::string XmlWriter::XmlString(void)
 | 
			
		||||
 | 
			
		||||
std::string XmlWriter::docString(void)
 | 
			
		||||
{
 | 
			
		||||
  std::ostringstream oss; 
 | 
			
		||||
  doc_.save(oss);
 | 
			
		||||
  doc_.save(oss, indent_.c_str());
 | 
			
		||||
  return oss.str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string XmlWriter::string(void)
 | 
			
		||||
{
 | 
			
		||||
  std::ostringstream oss; 
 | 
			
		||||
  doc_.save(oss, indent_.c_str(), pugi::format_default | pugi::format_no_declaration);
 | 
			
		||||
  return oss.str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,8 +55,10 @@ namespace Grid
 | 
			
		||||
    void writeDefault(const std::string &s, const U &x);
 | 
			
		||||
    template <typename U>
 | 
			
		||||
    void writeDefault(const std::string &s, const std::vector<U> &x);
 | 
			
		||||
    std::string XmlString(void);
 | 
			
		||||
    std::string docString(void);
 | 
			
		||||
    std::string string(void);
 | 
			
		||||
  private:
 | 
			
		||||
    const std::string  indent_{"  "};
 | 
			
		||||
    pugi::xml_document doc_;
 | 
			
		||||
    pugi::xml_node     node_;
 | 
			
		||||
    std::string        fileName_;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user