Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_base.h
Go to the documentation of this file.
1 /*
2  Copyright 2012-2020 Pierre SMARS (smars@yuntech.edu.tw)
3  This program is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 2 of the License, or
6  (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #ifndef _VE_BASE_H_
17 #define _VE_BASE_H_
18 
19 #include <iostream>
20 
27 class a_base
28 {
29  public:
30  a_base() {verysmall_=1.e-12;}
32  virtual const std::string classname() { return "a_base";}
34  static const std::string help();
35 
36  //: input/output
38  virtual void read(std::istream &i) {};
40  virtual void write(std::ostream &o) const {};
42  void read(const std::string &file_in);
44  void write(const std::string &file_out) const;
45  void small(double tol) {verysmall_=tol;}
46  double small() const {return verysmall_;}
48  friend std::istream& operator>> (std::istream& in, a_base& o);
50  friend std::ostream& operator<< (std::ostream& out, const a_base& o);
52  friend std::istream& operator>> (std::istream& in, a_base* o);
54  friend std::ostream& operator<< (std::ostream& out, const a_base* o);
55 
57  class file_open_error {};
58  class file_read_error {};
59  class file_write_error {};
60  protected:
61  /*a small number used as a tolerance limit */
62  double verysmall_;
63 };
64 
65 #endif
Definition: a_base.h:28
friend std::ostream & operator<<(std::ostream &out, const a_base &o)
Definition: a_base.cxx:62
double verysmall_
Definition: a_base.h:62
virtual void read(std::istream &i)
Definition: a_base.h:38
virtual void write(std::ostream &o) const
Definition: a_base.h:40
double small() const
Definition: a_base.h:46
a_base()
Definition: a_base.h:30
static const std::string help()
Definition: a_base.cxx:21
void small(double tol)
Definition: a_base.h:45
virtual const std::string classname()
Definition: a_base.h:32
friend std::istream & operator>>(std::istream &in, a_base &o)
Definition: a_base.cxx:56