Points&Forces (core)
Software tools facilitating the task of surveying architecture
a_unit_system.h
Go to the documentation of this file.
1 /*
2 Copyright 2000-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 _UNIT_SYSTEM_H_
17 #define _UNIT_SYSTEM_H_
18 
19 #include <iostream>
20 #include <deque>
21 #include <memory>
22 #include "a_unit_base.h"
23 #include "a_unit.h"
24 #include "a_point.h"
25 
34 {
35 public:
36  a_unit_system(): name_("Basic_System"), decimals1_(0), decimals2_(0) {}
39  virtual const std::string classname() {return "a_unit_system";};
40  static const std::string help();
41 
42  void name(const std::string name) {name_=name;}
43  std::string name() const {return name_;}
44  void decimals1(const int val) {decimals1_=val;}
45  int decimals1() const {return decimals1_;}
46  void decimals2(const int val) {decimals2_=val;}
47  int decimals2() const {return decimals2_;}
48  int levels1() const {return levels1_.size();}
49  int levels2() const {return levels2_.size();}
50 
51  void addlevel1(a_unit& u);
52  void addlevel2(a_unit& u);
53 
54  a_unit* level1(int n) const;
55  a_unit* level2(int n) const;
56 
57  std::string dim1(const double v); //ex: 3ft 2.37in
58  std::string dim1_det(const double v); //ex: 3ft 2.37in [Standard Leuven]
59  std::string dim2(const double v); //ex: 3ft 2.37in
60  std::string dim2_det(const double v); //ex: 3ft 2.37in [Standard Leuven]
61  std::string dim1(const a_point&);
62 
63  //: input/output
64  virtual void read(std::istream &i);
65  virtual void write(std::ostream &o) const;
66 
67 protected:
68  std::string name_;
69  std::deque<a_unit *> levels1_;
70  std::deque<a_unit *> levels2_;
73  void reset();
74 };
75 #endif
unit system
Definition: a_unit_system.h:34
virtual void write(std::ostream &o) const
std::string name_
Definition: a_unit_system.h:68
std::string dim2_det(const double v)
std::string name() const
Definition: a_unit_system.h:43
int decimals1() const
Definition: a_unit_system.h:45
void addlevel2(a_unit &u)
void decimals1(const int val)
Definition: a_unit_system.h:44
int levels2() const
Definition: a_unit_system.h:49
a_unit * level1(int n) const
std::deque< a_unit * > levels1_
Definition: a_unit_system.h:69
static const std::string help()
std::string dim1_det(const double v)
int levels1() const
Definition: a_unit_system.h:48
std::string dim1(const double v)
void addlevel1(a_unit &u)
std::deque< a_unit * > levels2_
Definition: a_unit_system.h:70
void name(const std::string name)
Definition: a_unit_system.h:42
int decimals2() const
Definition: a_unit_system.h:47
virtual void read(std::istream &i)
void decimals2(const int val)
Definition: a_unit_system.h:46
std::string dim2(const double v)
virtual const std::string classname()
Definition: a_unit_system.h:39
a_unit * level2(int n) const
unit
Definition: a_unit.h:29
int val