MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
keyvalval.h
1//
2// keyval.h
3//
4// Copyright (C) 1997 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _util_keyval_keyvalval_h
29#define _util_keyval_keyvalval_h
30
31#include <string>
32
33#include <util/class/class.h>
34
35namespace sc {
36
38class KeyValValue: public RefCount {
39 public:
40 enum KeyValValueError { OK, WrongType };
41 public:
42 KeyValValue() {}
44 virtual ~KeyValValue();
45 virtual KeyValValue::KeyValValueError doublevalue(double&) const;
46 virtual KeyValValue::KeyValValueError booleanvalue(int&) const;
47 virtual KeyValValue::KeyValValueError floatvalue(float&) const;
48 virtual KeyValValue::KeyValValueError charvalue(char&) const;
49 virtual KeyValValue::KeyValValueError intvalue(int&) const;
50 virtual KeyValValue::KeyValValueError longvalue(long&) const;
51 virtual KeyValValue::KeyValValueError sizevalue(size_t&) const;
52 DEPRECATED virtual KeyValValue::KeyValValueError pcharvalue(const char*&) const;
53 virtual KeyValValue::KeyValValueError stringvalue(std::string&) const;
54 virtual KeyValValue::KeyValValueError describedclassvalue(Ref<DescribedClass>&) const;
55 virtual void print(std::ostream &o=ExEnv::out0()) const;
56};
57std::ostream& operator<<(std::ostream&,const KeyValValue&);
58
59
60
63 private:
64 double _val;
65 public:
66 KeyValValuedouble(): _val(0.0) {}
67 KeyValValuedouble(double v): _val(v) {}
70 KeyValValue::KeyValValueError doublevalue(double&) const;
71 void print(std::ostream &o=ExEnv::out0()) const;
72};
73
76 private:
77 int _val;
78 public:
79 KeyValValueboolean(): _val(0) {}
80 KeyValValueboolean(int v): _val(v) {}
83 KeyValValue::KeyValValueError booleanvalue(int&) const;
84 void print(std::ostream &o=ExEnv::out0()) const;
85};
86
89 private:
90 float _val;
91 public:
92 KeyValValuefloat(): _val(0.0) {}
93 KeyValValuefloat(float v): _val(v) {}
96 KeyValValue::KeyValValueError floatvalue(float&) const;
97 void print(std::ostream &o=ExEnv::out0()) const;
98};
99
102 private:
103 char _val;
104 public:
105 KeyValValuechar(): _val(0) {}
106 KeyValValuechar(char v): _val(v) {}
109 KeyValValue::KeyValValueError charvalue(char&) const;
110 void print(std::ostream &o=ExEnv::out0()) const;
111};
112
115 private:
116 int _val;
117 public:
118 KeyValValueint(): _val(0) {}
119 KeyValValueint(int v): _val(v) {}
122 KeyValValue::KeyValValueError intvalue(int&) const;
123 void print(std::ostream &o=ExEnv::out0()) const;
124};
125
128 private:
129 long _val;
130 public:
131 KeyValValuelong(): _val(0) {}
132 KeyValValuelong(long v): _val(v) {}
135 KeyValValue::KeyValValueError longvalue(long&) const;
136 void print(std::ostream &o=ExEnv::out0()) const;
137};
138
141 private:
142 size_t _val;
143 public:
144 KeyValValuesize(): _val(0) {}
145 KeyValValuesize(int v): _val(v) {}
148 KeyValValue::KeyValValueError sizevalue(size_t&) const;
149 void print(std::ostream &o=ExEnv::out0()) const;
150};
151
154 private:
155 char* _val;
156 public:
157 DEPRECATED KeyValValuepchar(): _val(0) {}
158 DEPRECATED KeyValValuepchar(const char*);
159 DEPRECATED KeyValValuepchar(const KeyValValuepchar&);
161 DEPRECATED KeyValValue::KeyValValueError pcharvalue(const char*&) const;
162 KeyValValue::KeyValValueError stringvalue(std::string&) const;
163 void print(std::ostream &o=ExEnv::out0()) const;
164};
165
169 private:
170 // This is used to provide compatibility with KeyValValuepchar:
171 bool _defined;
172 std::string _val;
173 public:
174 KeyValValuestring():_defined(false) {}
175 KeyValValuestring(const std::string&);
179 KeyValValue::KeyValValueError doublevalue(double&) const;
182 KeyValValue::KeyValValueError booleanvalue(int&) const;
184 KeyValValue::KeyValValueError floatvalue(float&) const;
186 KeyValValue::KeyValValueError charvalue(char&) const;
188 KeyValValue::KeyValValueError intvalue(int&) const;
190 KeyValValue::KeyValValueError longvalue(long&) const;
193 KeyValValue::KeyValValueError sizevalue(size_t&) const;
195 DEPRECATED KeyValValue::KeyValValueError pcharvalue(const char*&) const;
196 KeyValValue::KeyValValueError stringvalue(std::string&) const;
197 void print(std::ostream &o=ExEnv::out0()) const;
198};
199
202 private:
204 public:
209 KeyValValue::KeyValValueError describedclassvalue(Ref<DescribedClass>&) const;
210 void print(std::ostream &o=ExEnv::out0()) const;
211};
212
213}
214
215#endif /* _KeyVal_h */
216
217// Local Variables:
218// mode: c++
219// c-file-style: "CLJ"
220// End:
static std::ostream & out0()
Return an ostream that writes from node 0.
Represents a Ref<DescribedClass> value.
Definition keyvalval.h:201
Represents the value of a keyword.
Definition keyvalval.h:38
Represents a boolean value.
Definition keyvalval.h:75
Represents a char value.
Definition keyvalval.h:101
Represents a double value.
Definition keyvalval.h:62
Represents a float value.
Definition keyvalval.h:88
Represents an int value.
Definition keyvalval.h:114
Represents a long value.
Definition keyvalval.h:127
Represents a pointer to char value (deprecated, use KeyValValuestring).
Definition keyvalval.h:153
Represents a size_t value.
Definition keyvalval.h:140
Represents a std::string value.
Definition keyvalval.h:168
KeyValValue::KeyValValueError charvalue(char &) const
Converts the string to char.
KeyValValue::KeyValValueError intvalue(int &) const
Converts the string to int.
DEPRECATED KeyValValue::KeyValValueError pcharvalue(const char *&) const
Converts the string to a pointer to char (deprecated).
KeyValValue::KeyValValueError doublevalue(double &) const
Converts the string to double.
KeyValValue::KeyValValueError booleanvalue(int &) const
Converts the string to boolean.
KeyValValue::KeyValValueError longvalue(long &) const
Converts the string to long.
KeyValValue::KeyValValueError floatvalue(float &) const
Converts the string to float.
KeyValValue::KeyValValueError sizevalue(size_t &) const
Converts the string to size_t.
The base class for all reference counted objects.
Definition ref.h:192
A template class that maintains references counts.
Definition ref.h:361
std::vector< unsigned int > operator<<(const GaussianBasisSet &B, const GaussianBasisSet &A)
computes a map from basis functions in A to the equivalent basis functions in B.
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:31 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.