Simpatico  v1.10
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 
11 namespace 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 
43  int Lng::width()
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 }
void setValue(long int value)
Set value of long int.
Definition: Lng.cpp:34
Wrapper for a long int, for formatted ostream output.
Definition: Lng.h:35
int width()
Get field width.
Definition: Lng.cpp:43
Lng()
Default constructor.
Definition: Lng.cpp:15
void setWidth(int width)
Set field width.
Definition: Lng.cpp:37
Utility classes for scientific computation.
Definition: accumulators.mod:1
friend std::ostream & operator<<(std::ostream &out, const Lng &object)
Output stream inserter for an Lng object.
Definition: Lng.cpp:66
friend std::istream & operator>>(std::istream &in, Lng &object)
Input stream extractor for an Lng object.
Definition: Lng.cpp:53
long int value()
Get value of long int.
Definition: Lng.cpp:40