PSCF v1.1
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
13namespace 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
Wrapper for an int, for formatted ostream output.
Definition: Int.h:37
friend std::istream & operator>>(std::istream &in, Int &object)
Input stream extractor for an Int object.
Definition: Int.cpp:71
friend std::ostream & operator<<(std::ostream &out, const Int &object)
Output stream inserter for an Int object.
Definition: Int.cpp:84
int value()
Get the integer value.
Definition: Int.cpp:55
void setWidth(int width)
Set the output field width.
Definition: Int.cpp:49
void setValue(int value)
Set the integer value.
Definition: Int.cpp:43
Int()
Default constructor.
Definition: Int.cpp:19
int width()
Get the minimum field width.
Definition: Int.cpp:61
Utility classes for scientific computation.
Definition: accumulators.mod:1
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition: Pair.h:44
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition: Pair.h:57