From 90a787e420a18a05260fb76595d740644a7d134d Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Mon, 27 Feb 2006 21:22:47 +0000 Subject: [PATCH] Changed name to ISolutionComp. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@797 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- SolutionComp.cxx => ISolutionComp.cxx | 48 +++++++++++++-------------- SolutionComp.h => ISolutionComp.h | 23 +++++-------- 2 files changed, 33 insertions(+), 38 deletions(-) rename SolutionComp.cxx => ISolutionComp.cxx (84%) rename SolutionComp.h => ISolutionComp.h (70%) diff --git a/SolutionComp.cxx b/ISolutionComp.cxx similarity index 84% rename from SolutionComp.cxx rename to ISolutionComp.cxx index 8aabc078..0035ba56 100644 --- a/SolutionComp.cxx +++ b/ISolutionComp.cxx @@ -2,7 +2,7 @@ #pragma warning(disable : 4786) // disable truncation warning (Only used by debugger) #endif -#include "SolutionComp.h" +#include "ISolutionComp.h" #include "ISolution.h" #include "Utils.h" #include @@ -11,7 +11,7 @@ #include "phrqproto.h" #include "phqalloc.h" -cxxSolutionComp::cxxSolutionComp(void) +cxxISolutionComp::cxxISolutionComp(void) : description(NULL) , moles(0.0) , input_conc(0.0) @@ -25,7 +25,7 @@ cxxSolutionComp::cxxSolutionComp(void) //, phase(NULL) { } -cxxSolutionComp::cxxSolutionComp(struct conc *conc_ptr) +cxxISolutionComp::cxxISolutionComp(struct conc *conc_ptr) { description = conc_ptr->description; moles = conc_ptr->moles; @@ -40,11 +40,11 @@ cxxSolutionComp::cxxSolutionComp(struct conc *conc_ptr) //phase = conc_ptr->phase; } -cxxSolutionComp::~cxxSolutionComp(void) +cxxISolutionComp::~cxxISolutionComp(void) { } /* -struct conc *cxxSolutionComp::concarray(std::map &totals) +struct conc *cxxISolutionComp::concarray(std::map &totals) // for Solutions, not ISolutions // takes a map of (elt name, moles) // returns list of conc structures @@ -71,16 +71,16 @@ struct conc *cxxSolutionComp::concarray(std::map return(c); } */ -struct conc *cxxSolutionComp::cxxSolutionComp2conc(const std::set &totals) +struct conc *cxxISolutionComp::cxxISolutionComp2conc(const std::set &totals) // for ISolutions - // takes a std::vector cxxSolutionComp structures + // takes a std::vector cxxISolutionComp structures // returns list of conc structures { struct conc *c; c = (struct conc *) PHRQ_malloc((size_t) ((totals.size() + 1) * sizeof(struct conc))); if (c == NULL) malloc_error(); int i = 0; - for (std::set::const_iterator it = totals.begin(); it != totals.end(); ++it) { + for (std::set::const_iterator it = totals.begin(); it != totals.end(); ++it) { c[i].description = it->description; c[i].moles = it->moles; c[i].input_conc = it->input_conc; @@ -99,7 +99,7 @@ struct conc *cxxSolutionComp::cxxSolutionComp2conc(const std::set units = token1; - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; } else { - return cxxSolutionComp::ERROR; + return cxxISolutionComp::ERROR; } } @@ -173,49 +173,49 @@ cxxSolutionComp::STATUS_TYPE cxxSolutionComp::read(CParser& parser, cxxISolution { parser.copy_token(token, ptr); this->as = token; - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; } // Check for "gfw" followed by gram formula weight else if (token1.compare("gfw") == 0) { if (parser.copy_token(token, ptr) != CParser::TT_DIGIT) { parser.error_msg("Expecting gram formula weight.", CParser::OT_CONTINUE); - return cxxSolutionComp::ERROR; + return cxxISolutionComp::ERROR; } else { parser.get_iss() >> this->gfw; - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; } } // Check for redox couple for pe if ( Utilities::strcmp_nocase_arg1(token.c_str(), "pe") == 0 ) { this->n_pe = cxxPe_Data::store(solution.pe, token); - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; } else if (token.find("/") != std::string::npos) { if (parser.parse_couple(token) == CParser::OK) { this->n_pe = cxxPe_Data::store(solution.pe, token); - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; } else { - return cxxSolutionComp::ERROR; + return cxxISolutionComp::ERROR; } } // Must have phase this->equation_name = token; - if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxSolutionComp::OK; + if ( (j = parser.copy_token(token, ptr)) == CParser::TT_EMPTY) return cxxISolutionComp::OK; // Check for saturation index if (!(std::istringstream(token) >> this->phase_si)) { parser.error_msg("Expected saturation index.", CParser::OT_CONTINUE); - return cxxSolutionComp::ERROR; + return cxxISolutionComp::ERROR; } - return cxxSolutionComp::OK; + return cxxISolutionComp::OK; } #endif #ifdef SKIP -void cxxSolutionComp::dump_xml(std::ostream& s_oss, unsigned int indent)const +void cxxISolutionComp::dump_xml(std::ostream& s_oss, unsigned int indent)const { unsigned int i; std::string indent0(""); diff --git a/SolutionComp.h b/ISolutionComp.h similarity index 70% rename from SolutionComp.h rename to ISolutionComp.h index b9bbaa66..420f2118 100644 --- a/SolutionComp.h +++ b/ISolutionComp.h @@ -1,5 +1,5 @@ -#if !defined(SOLUTIONCOMP_H_INCLUDED) -#define SOLUTIONCOMP_H_INCLUDED +#if !defined(ISOLUTIONCOMP_H_INCLUDED) +#define ISOLUTIONCOMP_H_INCLUDED //#include "Parser.h" #include "Utils.h" @@ -13,17 +13,12 @@ // forward declarations class cxxISolution; // reqd for read and dump_xml -class cxxSolutionComp +class cxxISolutionComp { public: - cxxSolutionComp(void); - cxxSolutionComp(struct conc *conc_ptr); - ~cxxSolutionComp(void); - - enum STATUS_TYPE { - ERROR = 0, - OK = 1 - }; + cxxISolutionComp(void); + cxxISolutionComp(struct conc *conc_ptr); + ~cxxISolutionComp(void); public: @@ -46,9 +41,9 @@ public: int get_n_pe()const {return this->n_pe;} void set_n_pe(int n_pe) {this->n_pe = n_pe;} - bool operator<(const cxxSolutionComp& conc)const { return ::strcmp(this->description, conc.description) < 0; } + bool operator<(const cxxISolutionComp& conc)const { return ::strcmp(this->description, conc.description) < 0; } - static struct conc * cxxSolutionComp2conc(const std::set &t ); + static struct conc * cxxISolutionComp2conc(const std::set &t ); private: char * description; @@ -62,4 +57,4 @@ private: double gfw; }; -#endif // SOLUTIONCOMP_H_INCLUDED +#endif // ISOLUTIONCOMP_H_INCLUDED