PSCF v1.1
Lng.cpp
1/*
2* Util Package - C++ Utilities for Scientific Computation
3*
4* Copyright 2010 - 2017, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "Lng.h"
9#include "Format.h"
10
11namespace Util
12{
13
14 // Default constructor.
16 : value_(0),
17 width_(20)
18 //width_(Format::defaultWidth())
19 {}
20
21 // Constructor, value only.
22 Lng::Lng(long int value)
23 : value_(value),
24 width_(20)
25 //width_(Format::defaultWidth())
26 {}
27
29 Lng::Lng(long int value, int width)
30 : value_(value),
31 width_(width)
32 {}
33
34 void Lng::setValue(long int value)
35 { value_ = value; }
36
37 void Lng::setWidth(int width)
38 { width_ = width; }
39
40 long int Lng::value()
41 { return value_; }
42
44 { return width_; }
45
53 std::istream& operator>>(std::istream& in, Lng &object)
54 {
55 in >> object.value_;
56 return in;
57 }
58
66 std::ostream& operator<<(std::ostream& out, const Lng &object)
67 {
68 out.width(object.width_);
69 out << object.value_;
70 return out;
71 }
72
73}
Wrapper for a long int, for formatted ostream output.
Definition: Lng.h:36
void setWidth(int width)
Set field width.
Definition: Lng.cpp:37
void setValue(long int value)
Set value of long int.
Definition: Lng.cpp:34
Lng()
Default constructor.
Definition: Lng.cpp:15
int width()
Get field width.
Definition: Lng.cpp:43
long int value()
Get value of long int.
Definition: Lng.cpp:40
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