Simpatico  v1.10
Int.h
1 #ifndef UTIL_INT_H
2 #define UTIL_INT_H
3 
4 /*
5 * Util Package - C++ Utilities for Scientific Computation
6 *
7 * Copyright 2010 - 2017, The Regents of the University of Minnesota
8 * Distributed under the terms of the GNU General Public License.
9 */
10 
11 #include <iostream>
12 
13 namespace Util
14 {
15 
36  class Int
37  {
38 
39  public:
40 
42 
43 
45  Int();
46 
48  explicit Int(int value);
49 
51  Int(int value, int width);
52 
54 
56 
62  void setValue(int value);
63 
69  void setWidth(int width);
70 
72 
74 
78  int value();
79 
83  int width();
84 
86 
87  private:
88 
90  int value_;
91 
93  int width_;
94 
95  //friends:
96 
97  friend std::istream& operator>>(std::istream& in, Int &object);
98  friend std::ostream& operator<<(std::ostream& out, const Int &object);
99 
100  };
101 
109  std::istream& operator>>(std::istream& in, Int &object);
110 
118  std::ostream& operator<<(std::ostream& out, const Int &object);
119 
120 }
121 #endif
void setWidth(int width)
Set the output field width.
Definition: Int.cpp:49
Int()
Default constructor.
Definition: Int.cpp:19
int value()
Get the integer value.
Definition: Int.cpp:55
int width()
Get the minimum field width.
Definition: Int.cpp:61
Utility classes for scientific computation.
Definition: accumulators.mod:1
friend std::istream & operator>>(std::istream &in, Int &object)
Input stream extractor for an Int object.
Definition: Int.cpp:71
Wrapper for an int, for formatted ostream output.
Definition: Int.h:36
void setValue(int value)
Set the integer value.
Definition: Int.cpp:43
friend std::ostream & operator<<(std::ostream &out, const Int &object)
Output stream inserter for an Int object.
Definition: Int.cpp:84