//****************************************************************************** //** SCATMECH: Polarized Light Scattering C++ Class Library //** //** File: scattabl.h //** //** Thomas A. Germer //** Optical Technology Division, National Institute of Standards and Technology //** 100 Bureau Dr. Stop 8443; Gaithersburg, MD 20899-8443 //** Phone: (301) 975-2876; FAX: (301) 975-6991 //** Email: thomas.germer@nist.gov //** //** Version: 6.00 (February 2008) //** //****************************************************************************** #ifndef SCATMECH_SCATTABL_H #define SCATMECH_SCATTABL_H #include #include #include #include "inherit.h" namespace SCATMECH { class Table : public std::vector > { public: Table(); Table(const std::string& filename,int col=2); Table(double singlevalue); Table(double *l,double *v,int nn); double value(double l) const; double value() const {return last_value;}; int read(const std::string& filename, int ycol=2); static Table AskUser(const std::string& prompt,const std::string& deflt); static Table AskUser(const std::string& prompt,double deflt); void set_table(const std::string& value); const std::string& get_name() const {return name;} friend std::ostream& operator<<(std::ostream& os,const Table& t) {return os << t.name;} private: int _AskUser(const std::string& prompt,const std::string& deflt); int _AskUser(const std::string& prompt,double deflt); double last_lambda; double last_value; std::string name; }; class TableFile { private: std::vector > columns; std::string name; public: TableFile(const std::string& filename); TableFile() {}; const std::string& get_name() {return name;} const std::vector& operator[](int i) { if (i>=columns.size() || i<0) throw SCATMECH_exception("Out of bounds error in TableFile::operator[]"); return columns[i]; } int ncolumns() {return columns.size();} }; void ClearTableCache(); template <> void ModelParameterSet(Table& variable,const std::string& subparameter,const std::string& value); template <> std::string ModelParameterGet(Table& variable,const std::string& subparameter); template <> void ModelParameterAskUser(Table& variable,const std::string& prompt); } // namespace SCATMECH #endif