diff --git a/src/colvarbias.cpp b/src/colvarbias.cpp index 451d82aac..169fc073b 100644 --- a/src/colvarbias.cpp +++ b/src/colvarbias.cpp @@ -540,7 +540,7 @@ void raise_error_rewind(IST &is, SPT start_pos, std::string const &bias_type, } -template IST & colvarbias::read_state_from_stream(IST &is) +template IST & colvarbias::read_state_template_(IST &is) { auto const start_pos = is.tellg(); @@ -603,13 +603,13 @@ template IST & colvarbias::read_state_from_stream(IST &is) std::istream &colvarbias::read_state(std::istream &is) { - return read_state_from_stream(is); + return read_state_template_(is); } cvm::memory_stream &colvarbias::read_state(cvm::memory_stream &is) { - return read_state_from_stream(is); + return read_state_template_(is); } @@ -699,7 +699,8 @@ cvm::memory_stream &colvarbias::write_state_data_key(cvm::memory_stream &os, std } -template IST &colvarbias::read_state_data_key_template(IST &is, std::string const &key) +template +IST &colvarbias::read_state_data_key_template_(IST &is, std::string const &key) { auto const start_pos = is.tellg(); std::string key_in; @@ -718,13 +719,13 @@ template IST &colvarbias::read_state_data_key_template(IST &is, s std::istream & colvarbias::read_state_data_key(std::istream &is, std::string const &key) { - return read_state_data_key_template(is, key); + return read_state_data_key_template_(is, key); } cvm::memory_stream & colvarbias::read_state_data_key(cvm::memory_stream &is, std::string const &key) { - return read_state_data_key_template(is, key); + return read_state_data_key_template_(is, key); } diff --git a/src/colvarbias.h b/src/colvarbias.h index 1217a2b2b..9a51f9d51 100644 --- a/src/colvarbias.h +++ b/src/colvarbias.h @@ -181,7 +181,7 @@ class colvarbias /// Read a keyword header for a data sequence from a stream /// \param[in,out] Input stream /// \param[in] Keyword labeling the header block; an error will be raised if not matching - template IST &read_state_data_key_template(IST &is, std::string const &key); + template IST &read_state_data_key_template_(IST &is, std::string const &key); public: @@ -198,7 +198,7 @@ class colvarbias private: /// Generic stream reading function (formatted and not) - template IST & read_state_from_stream(IST &is); + template IST & read_state_template_(IST &is); public: diff --git a/src/colvarbias_abf.cpp b/src/colvarbias_abf.cpp index d8927e29a..acca85efa 100644 --- a/src/colvarbias_abf.cpp +++ b/src/colvarbias_abf.cpp @@ -742,7 +742,7 @@ int colvarbias_abf::read_gradients_samples() } -template OST & colvarbias_abf::write_to_stream(OST &os) +template OST & colvarbias_abf::write_state_data_template_(OST &os) { auto flags = os.flags(); @@ -770,17 +770,17 @@ template OST & colvarbias_abf::write_to_stream(OST &os) std::ostream & colvarbias_abf::write_state_data(std::ostream& os) { - return write_to_stream(os); + return write_state_data_template_(os); } cvm::memory_stream & colvarbias_abf::write_state_data(cvm::memory_stream& os) { - return write_to_stream(os); + return write_state_data_template_(os); } -template IST &colvarbias_abf::read_from_stream(IST &is) +template IST &colvarbias_abf::read_state_data_template_(IST &is) { if ( input_prefix.size() > 0 ) { cvm::error("ERROR: cannot provide both inputPrefix and a colvars state file.\n", COLVARS_INPUT_ERROR); @@ -827,13 +827,13 @@ template IST &colvarbias_abf::read_from_stream(IST &is) std::istream & colvarbias_abf::read_state_data(std::istream& is) { - return read_from_stream(is); + return read_state_data_template_(is); } cvm::memory_stream & colvarbias_abf::read_state_data(cvm::memory_stream& is) { - return read_from_stream(is); + return read_state_data_template_(is); } diff --git a/src/colvarbias_abf.h b/src/colvarbias_abf.h index e9887562d..635e0fbfd 100644 --- a/src/colvarbias_abf.h +++ b/src/colvarbias_abf.h @@ -162,10 +162,10 @@ class colvarbias_abf : public colvarbias { private: /// Generic stream writing function (formatted and not) - template OST &write_to_stream(OST &os); + template OST &write_state_data_template_(OST &os); /// Generic stream readingx function (formatted and not) - template IST &read_from_stream(IST &is); + template IST &read_state_data_template_(IST &is); public: diff --git a/src/colvargrid_def.h b/src/colvargrid_def.h index c109ef1bf..92861f43b 100644 --- a/src/colvargrid_def.h +++ b/src/colvargrid_def.h @@ -22,7 +22,7 @@ #include "colvars_memstream.h" -template IST &read_restart_template(colvar_grid &g, IST &is) +template IST &read_restart_template_(colvar_grid &g, IST &is) { auto const start_pos = is.tellg(); std::string conf; @@ -43,13 +43,13 @@ template IST &read_restart_template(colvar_grid &g, IST template std::istream &colvar_grid::read_restart(std::istream &is) { - return read_restart_template(*this, is); + return read_restart_template_(*this, is); } template cvm::memory_stream &colvar_grid::read_restart(cvm::memory_stream &is) { - return read_restart_template(*this, is); + return read_restart_template_(*this, is); } @@ -69,7 +69,7 @@ template cvm::memory_stream &colvar_grid::write_restart(cvm::memory } -template IST &read_raw_template(colvar_grid &g, IST &is) +template IST &read_raw_template_(colvar_grid &g, IST &is) { auto const start_pos = is.tellg(); @@ -99,13 +99,13 @@ template IST &read_raw_template(colvar_grid &g, IST &is) template std::istream &colvar_grid::read_raw(std::istream &is) { - return read_raw_template(*this, is); + return read_raw_template_(*this, is); } template cvm::memory_stream &colvar_grid::read_raw(cvm::memory_stream &is) { - return read_raw_template(*this, is); + return read_raw_template_(*this, is); } diff --git a/src/colvarvalue.cpp b/src/colvarvalue.cpp index 8d0f63212..64436db98 100644 --- a/src/colvarvalue.cpp +++ b/src/colvarvalue.cpp @@ -723,7 +723,7 @@ int colvarvalue::from_simple_string(std::string const &s) } -template void colvarvalue::write_to_stream(OST &os) const +template void colvarvalue::write_to_stream_template_(OST &os) const { switch (type()) { case colvarvalue::type_scalar: @@ -751,14 +751,14 @@ template void colvarvalue::write_to_stream(OST &os) const std::ostream & operator << (std::ostream &os, colvarvalue const &x) { - x.write_to_stream(os); + x.write_to_stream_template_(os); return os; } cvm::memory_stream & operator << (cvm::memory_stream &os, colvarvalue const &x) { - x.write_to_stream(os); + x.write_to_stream_template_(os); return os; } @@ -773,7 +773,7 @@ std::ostream & operator << (std::ostream &os, std::vector const &v) } -template void colvarvalue::read_from_stream(IST &is) +template void colvarvalue::read_from_stream_template_(IST &is) { if (type() == colvarvalue::type_notset) { cvm::error("Trying to read from a stream a colvarvalue, " @@ -811,14 +811,14 @@ template void colvarvalue::read_from_stream(IST &is) std::istream & operator >> (std::istream &is, colvarvalue &x) { - x.read_from_stream(is); + x.read_from_stream_template_(is); return is; } cvm::memory_stream & operator >> (cvm::memory_stream &is, colvarvalue &x) { - x.read_from_stream(is); + x.read_from_stream_template_(is); return is; } diff --git a/src/colvarvalue.h b/src/colvarvalue.h index b2edaa5a5..5670906cd 100644 --- a/src/colvarvalue.h +++ b/src/colvarvalue.h @@ -298,9 +298,12 @@ class colvarvalue { /// Undefined operation void undef_op() const; +private: /// Generic stream writing function (formatted and not) - template void write_to_stream(OST &os) const; + template void write_to_stream_template_(OST &os) const; + +public: /// Formatted output operator friend std::ostream & operator << (std::ostream &os, colvarvalue const &x); @@ -308,8 +311,12 @@ class colvarvalue { /// Unformatted output operator friend cvm::memory_stream & operator << (cvm::memory_stream &os, colvarvalue const &x); +private: + /// Generic stream reading function (formatted and not) - template void read_from_stream(IST &is); + template void read_from_stream_template_(IST &is); + +public: /// Formatted input operator friend std::istream & operator >> (std::istream &is, colvarvalue &x);