1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Compiles after merging

This commit is contained in:
Guido Cossu 2017-01-25 12:11:58 +00:00
parent 17629b8d9e
commit f7fbbaaca3
4 changed files with 39 additions and 14 deletions

View File

@ -8,6 +8,7 @@
Author: Antonin Portelli <antonin.portelli@me.com>
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -182,6 +183,16 @@ namespace Grid {
T *upcast;
};
// What is the vtype
template<typename T> struct isReader {
static const bool value = false;
};
template<typename T> struct isWriter {
static const bool value = false;
};
// Generic writer interface
// serializable base class
class Serializable
@ -326,7 +337,6 @@ namespace Grid {
}
// Generic writer interface //////////////////////////////////////////////////
>>>>>>> develop
template <typename T>
inline void push(Writer<T> &w, const std::string &s) {
w.push(s);

View File

@ -68,15 +68,22 @@ void JSONWriter::delete_comma()
ss_.str(dlast);
}
template<>
void JSONWriter::writeDefault(const std::string &s, const std::string &x){
if (s.size())
ss_ << "\""<< s << "\" : \"" << x << "\" ," ;
else
ss_ << "\"" << x << "\" ," ;
}
// here we are hitting a g++ bug (Bug 56480)
// compiles fine with clang
// have to wrap in the Grid namespace
// annoying, but necessary for TravisCI
namespace Grid
{
template<>
void JSONWriter::writeDefault(const std::string &s,
const std::string &x)
{
if (s.size())
ss_ << "\""<< s << "\" : \"" << x << "\" ," ;
else
ss_ << "\"" << x << "\" ," ;
}
}// namespace Grid
// Reader implementation ///////////////////////////////////////////////////////

View File

@ -88,6 +88,16 @@ namespace Grid
json::iterator it_end_;
};
template <>
struct isReader< JSONReader > {
static const bool value = true;
};
template <>
struct isWriter< JSONWriter > {
static const bool value = true;
};
// Writer template implementation ////////////////////////////////////////////
template <typename U>
void JSONWriter::writeDefault(const std::string &s, const U &x)

View File

@ -89,8 +89,6 @@ namespace Grid
static const bool value = true;
};
// Writer template implementation ////////////////////////////////////////////
template <typename U>
void XmlWriter::writeDefault(const std::string &s, const U &x)