MPQC  3.0.0-alpha
keyval.h
1 //
2 // keyval.h
3 //
4 // Copyright (C) 1996 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_keyval_h
29 #define _util_keyval_keyval_h
30 
31 #include <iostream>
32 #include <string>
33 #include <map>
34 #include <vector>
35 
36 #include <string.h>
37 #include <stdlib.h>
38 #include <stdarg.h>
39 
40 #include <util/class/class.h>
41 #include <util/misc/scexception.h>
42 #include <util/keyval/keyvalval.h>
43 
44 namespace sc {
45 
69 class KeyVal: public RefCount {
70  // these classes need to directly access the key_value member
71  friend class AggregateKeyVal;
72  friend class PrefixKeyVal;
73  public:
74  enum {MaxKeywordLength = 256};
75  enum KeyValError { OK, HasNoValue, WrongType,
76  UnknownKeyword, OperationFailed };
77  private:
78  KeyValError errcod;
79  // do not allow a copy constructor or assignment
80  KeyVal(const KeyVal&);
81  void operator=(const KeyVal&);
82  protected:
83  int verbose_;
84 
85  KeyVal();
86 
88  void seterror(KeyValError err);
90  void seterror(KeyValValue::KeyValValueError err);
91 
93  virtual int key_exists(const char*) = 0;
95  virtual int key_count(const char* =0);
97  virtual Ref<KeyValValue> key_value(const char*,
98  const KeyValValue& def) = 0;
100  virtual int key_booleanvalue(const char*,const KeyValValue& def);
102  virtual double key_doublevalue(const char* key,const KeyValValue& def);
104  virtual float key_floatvalue(const char* key,const KeyValValue& def);
106  virtual char key_charvalue(const char* key,const KeyValValue& def);
108  virtual int key_intvalue(const char* key,const KeyValValue& def);
110  virtual long key_longvalue(const char* key,const KeyValValue& def);
112  virtual size_t key_sizevalue(const char* key,const KeyValValue& def);
114  DEPRECATED virtual char* key_pcharvalue(const char* key,const KeyValValue& def);
116  virtual std::string key_stringvalue(const char* key,
117  const KeyValValue& def);
119  virtual Ref<DescribedClass> key_describedclassvalue(const char* key,
120  const KeyValValue& def);
121 
122  public:
123  virtual ~KeyVal();
124 
125  // For nonindexed things. If a subclass defines one of these,
126  // then the overloaded functions will be hidden. The key_... functions
127  // should be overridden instead.
128 
131  int exists(const char*);
136  int count(const char* =0);
138  Ref<KeyValValue> value(const char* key = 0,
139  const KeyValValue& def=KeyValValue());
141  int booleanvalue(const char* key = 0,
142  const KeyValValue& def=KeyValValueboolean());
144  double doublevalue(const char* key = 0,
145  const KeyValValue& def=KeyValValuedouble());
147  float floatvalue(const char* key = 0,
148  const KeyValValue& def=KeyValValuefloat());
150  char charvalue(const char* key = 0,
151  const KeyValValue& def=KeyValValuechar());
153  int intvalue(const char* key = 0,
154  const KeyValValue& def=KeyValValueint());
156  long longvalue(const char* key = 0,
157  const KeyValValue& def=KeyValValuelong());
159  size_t sizevalue(const char* key = 0,
160  const KeyValValue& def=KeyValValuesize());
164  DEPRECATED char* pcharvalue(const char* key = 0,
165  const KeyValValue& def=KeyValValuestring());
167  std::string stringvalue(const char* key = 0,
168  const KeyValValue& def=KeyValValuestring());
170  Ref<DescribedClass> describedclassvalue(const char* key = 0,
175  virtual const char* classname(const char*);
176 
180  virtual Ref<DescribedClass> describedclass(const char* classname);
181 
190  int exists(const char* key,int i);
191  int count(const char* key,int i);
192  int booleanvalue(const char* key,int i,
193  const KeyValValue& def=KeyValValueboolean());
194  double doublevalue(const char* key,int i,
195  const KeyValValue& def=KeyValValuedouble());
196  float floatvalue(const char* key,int i,
197  const KeyValValue& def=KeyValValuefloat());
198  char charvalue(const char* key,int i,
199  const KeyValValue& def=KeyValValuechar());
200  int intvalue(const char* key,int i,
201  const KeyValValue& def=KeyValValueint());
202  long longvalue(const char* key,int i,
203  const KeyValValue& def=KeyValValuelong());
204  size_t sizevalue(const char* key,int i,
205  const KeyValValue& def=KeyValValuesize());
206  DEPRECATED char* pcharvalue(const char* key,int i,
207  const KeyValValue& def=KeyValValuestring());
208  std::string stringvalue(const char* key,int i,
209  const KeyValValue& def=KeyValValuestring());
210  Ref<DescribedClass> describedclassvalue(const char* key,int,
212 
213  int exists(int i);
214  int count(int i);
215  int booleanvalue(int i,
216  const KeyValValue& def=KeyValValueboolean());
217  double doublevalue(int i,
218  const KeyValValue& def=KeyValValuedouble());
219  float floatvalue(int i,
220  const KeyValValue& def=KeyValValuefloat());
221  char charvalue(int i,
222  const KeyValValue& def=KeyValValuechar());
223  int intvalue(int i,
224  const KeyValValue& def=KeyValValueint());
225  long longvalue(int i,
226  const KeyValValue& def=KeyValValuelong());
227  size_t sizevalue(int i,
228  const KeyValValue& def=KeyValValuesize());
229  DEPRECATED char* pcharvalue(int i,
230  const KeyValValue& def=KeyValValuestring());
231  std::string stringvalue(int i,
232  const KeyValValue& def=KeyValValuestring());
236 
244  int exists(const char*,int,int);
245  int count(const char*,int,int);
246  int booleanvalue(const char*,int,int,
247  const KeyValValue& def=KeyValValueboolean());
248  double doublevalue(const char* key,int,int,
249  const KeyValValue& def=KeyValValuedouble());
250  float floatvalue(const char* key,int,int,
251  const KeyValValue& def=KeyValValuefloat());
252  char charvalue(const char* key,int,int,
253  const KeyValValue& def=KeyValValuechar());
254  int intvalue(const char* key,int,int,
255  const KeyValValue& def=KeyValValueint());
256  long longvalue(const char* key,int,int,
257  const KeyValValue& def=KeyValValuelong());
258  size_t sizevalue(const char* key,int,int,
259  const KeyValValue& def=KeyValValuesize());
260  DEPRECATED char* pcharvalue(const char* key,int,int,
261  const KeyValValue& def=KeyValValuestring());
262  std::string stringvalue(const char* key,int,int,
263  const KeyValValue& def=KeyValValuestring());
264  Ref<DescribedClass> describedclassvalue(const char* key,int,int,
266 
267  int exists(int i,int j);
268  int count(int i,int j);
269  int booleanvalue(int i,int j,
270  const KeyValValue& def=KeyValValueboolean());
271  double doublevalue(int i,int j,
272  const KeyValValue& def=KeyValValuedouble());
273  float floatvalue(int i,int j,
274  const KeyValValue& def=KeyValValuefloat());
275  char charvalue(int i,int j,
276  const KeyValValue& def=KeyValValuechar());
277  int intvalue(int i,int j,
278  const KeyValValue& def=KeyValValueint());
279  long longvalue(int i,int j,
280  const KeyValValue& def=KeyValValuelong());
281  size_t sizevalue(int i,int j,
282  const KeyValValue& def=KeyValValuesize());
283  DEPRECATED char* pcharvalue(int i,int j,
284  const KeyValValue& def=KeyValValuestring());
285  std::string stringvalue(int i,int j,
286  const KeyValValue& def=KeyValValuestring());
290 
297  int Va_exists(const char* key,int nindex,...);
298  int Va_count(const char* key,int nindex,...);
299  int Va_booleanvalue(const char* key,int nindex,...);
300  double Va_doublevalue(const char* key,int nindex,...);
301  float Va_floatvalue(const char* key,int nindex,...);
302  char Va_charvalue(const char* key,int nindex,...);
303  int Va_intvalue(const char* key,int nindex,...);
304  long Va_longvalue(const char* key,int nindex,...);
305  size_t Va_sizevalue(const char* key,int nindex,...);
306  DEPRECATED char* Va_pcharvalue(const char* key,int nindex,...);
307  std::string Va_stringvalue(const char* key,int nindex,...);
308  Ref<DescribedClass> Va_describedclassvalue(const char* key,int nindex,...);
310 
312  KeyValError error();
314  const char* errormsg(KeyValError err);
316  const char* errormsg();
318  virtual void errortrace(std::ostream&fp=ExEnv::err0());
320  virtual void dump(std::ostream&fp=ExEnv::err0());
321 
323  virtual void print_unseen(std::ostream&fp=ExEnv::out0());
327  virtual int have_unseen();
328 
330  void verbose(int v) { verbose_ = v; }
332  int verbose() const { return verbose_; }
333 };
334 
335 
336 
340 class AssignedKeyVal: public KeyVal {
341  private:
342  typedef std::map<std::string,Ref<KeyValValue> > _map_t;
343  _map_t _map;
344  // do not allow a copy constructor or assignment
346  void operator=(const AssignedKeyVal&);
347  protected:
348  int key_exists(const char*);
349  Ref<KeyValValue> key_value(const char*,
350  const KeyValValue& def);
351  public:
352  AssignedKeyVal();
353  ~AssignedKeyVal();
354 
358  void assign(const char* key, const Ref<KeyValValue>& val);
359  void assign(const char* key, double val);
360  void assignboolean(const char* key, int val);
361  void assign(const char* key, float val);
362  void assign(const char* key, char val);
363  void assign(const char* key, int val);
364  void assign(const char* key, long val);
365  void assign(const char* key, const char* val);
366  void assign(const char* key, const std::string& val);
367  void assign(const char* key, const Ref<DescribedClass>& val);
369 
370  const char* classname(const char*);
371 
373  void clear();
374 
377  void print(std::ostream& os = ExEnv::out0()) const;
378 
379  template <typename ValueType>
380  static Ref<AssignedKeyVal> instance(const char* key, const ValueType& value) {
381  Ref<AssignedKeyVal> result;
382  result->assign(key,value);
383  return result;
384  }
385 };
386 
392 class StringKeyVal: public KeyVal {
393  private:
394  // once a described class is found it is kept here so
395  // multiple references to it return the same instance
396  std::map<std::string,Ref<KeyValValue> > _map;
397  // do not allow a copy constructor or assignment
398  StringKeyVal(const StringKeyVal&);
399  void operator=(const StringKeyVal&);
400  protected:
401  StringKeyVal();
402  int key_exists(const char*);
403  Ref<KeyValValue> key_value(const char*,
404  const KeyValValue& def);
405  public:
406  virtual ~StringKeyVal();
408  virtual std::string stringrep(const char *key) = 0;
411  virtual const char* classname(const char*);
415  virtual const char* truekeyword(const char*);
416 
421  virtual void errortrace(std::ostream&fp=ExEnv::err0());
422  virtual void dump(std::ostream&fp=ExEnv::err0());
424 };
425 
431 class AggregateKeyVal : public KeyVal {
432  private:
433  enum { MaxKeyVal = 4 };
434  Ref<KeyVal> kv[MaxKeyVal];
435  Ref<KeyVal> getkeyval(const char*key);
436  // do not allow a copy constructor or assignment
438  void operator=(const AggregateKeyVal&);
439  protected:
440  int key_exists(const char*);
441  Ref<KeyValValue> key_value(const char*,
442  const KeyValValue& def);
443  public:
451  AggregateKeyVal(const Ref<KeyVal>& keyval1);
452  AggregateKeyVal(const Ref<KeyVal>& keyval1,const Ref<KeyVal>& keyval2);
453  AggregateKeyVal(const Ref<KeyVal>& keyval1,const Ref<KeyVal>& keyval2,
454  const Ref<KeyVal>& keyval3);
455  AggregateKeyVal(const Ref<KeyVal>& keyval1,const Ref<KeyVal>& keyval2,
456  const Ref<KeyVal>& keyval3, const Ref<KeyVal>& keyval4);
458  ~AggregateKeyVal();
459 
460  const char* classname(const char*);
461  void errortrace(std::ostream&fp=ExEnv::err0());
462  void dump(std::ostream&fp=ExEnv::err0());
463 };
464 
508 class PrefixKeyVal : public KeyVal {
509  private:
510  char* prefix;
511  Ref<KeyVal> keyval;
512  void setup(const char*,int,int,int,int,int);
513  int getnewprefixkey(const char*key,char*newkey);
514  // do not allow a copy constructor or assignment
515  PrefixKeyVal(const PrefixKeyVal&);
516  void operator=(const PrefixKeyVal&);
517  int key_exists(const char*);
518  Ref<KeyValValue> key_value(const char*,
519  const KeyValValue& def);
520  public:
524  PrefixKeyVal(const Ref<KeyVal>&,int i);
525  PrefixKeyVal(const Ref<KeyVal>&,int i,int j);
526  PrefixKeyVal(const Ref<KeyVal>&,int i,int j,int k);
527  PrefixKeyVal(const Ref<KeyVal>&,int i,int j,int k,int l);
528  PrefixKeyVal(const Ref<KeyVal>&,const char*prefix);
529  PrefixKeyVal(const Ref<KeyVal>&,const char*prefix,int i);
530  PrefixKeyVal(const Ref<KeyVal>&,const char*prefix,int i,int j);
531  PrefixKeyVal(const Ref<KeyVal>&,const char*prefix,int i,int j,int k);
532  PrefixKeyVal(const Ref<KeyVal>&,const char*prefix,int i,int j,int k,int l);
534  ~PrefixKeyVal();
535 
536  const char* classname(const char*);
537  void errortrace(std::ostream&fp=ExEnv::err0());
538  void dump(std::ostream&fp=ExEnv::err0());
539 };
540 
541 class IPV2;
546 class ParsedKeyVal : public StringKeyVal {
547  private:
548  int nfile;
549  char**file;
550  int nfp;
551  IPV2* ipv2;
552  // do not allow a copy constructor or assignment
553  ParsedKeyVal(const ParsedKeyVal&);
554  void operator=(const ParsedKeyVal&);
555  public:
557  ParsedKeyVal();
559  ParsedKeyVal(const char*file);
561  ParsedKeyVal(std::istream&s);
564  ParsedKeyVal(IPV2*);
570  ParsedKeyVal(const char*,const Ref<KeyVal>&);
572  ~ParsedKeyVal();
573 
576  static void cat_files(const char*,const Ref<KeyVal>&,std::ostream &o);
577 
579  void read(const char*);
581  void read(const std::string &);
583  void read(std::istream&);
585  void parse_string(const std::string&);
586 
590  std::string stringrep(const char*);
591  const char* classname(const char*);
592  const char* truekeyword(const char*);
593  void errortrace(std::ostream&fp=ExEnv::err0());
594  void dump(std::ostream&fp=ExEnv::err0());
595  void print_unseen(std::ostream&fp=ExEnv::out0());
596  int have_unseen();
598 };
599 
600 namespace detail {
602  template <typename T> struct GetValue;
603  template <> struct GetValue<bool> {
604  static bool eval(const Ref<KeyVal>& kv, const char* key, int i) {
605  return kv->booleanvalue(key, i);
606  }
607  static bool eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
608  return kv->booleanvalue(key, i, j);
609  }
610  };
611  template <> struct GetValue<double> {
612  static double eval(const Ref<KeyVal>& kv, const char* key, int i) {
613  return kv->doublevalue(key, i);
614  }
615  static double eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
616  return kv->doublevalue(key, i, j);
617  }
618  };
619  template <> struct GetValue<float> {
620  static float eval(const Ref<KeyVal>& kv, const char* key, int i) {
621  return kv->floatvalue(key, i);
622  }
623  static float eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
624  return kv->floatvalue(key, i, j);
625  }
626  };
627  template <> struct GetValue<int> {
628  static int eval(const Ref<KeyVal>& kv, const char* key, int i) {
629  return kv->intvalue(key, i);
630  }
631  static int eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
632  return kv->intvalue(key, i, j);
633  }
634  };
635  template <> struct GetValue<long> {
636  static long eval(const Ref<KeyVal>& kv, const char* key, int i) {
637  return kv->longvalue(key, i);
638  }
639  static long eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
640  return kv->longvalue(key, i, j);
641  }
642  };
643  template <> struct GetValue<std::size_t> {
644  static std::size_t eval(const Ref<KeyVal>& kv, const char* key, int i) {
645  return kv->sizevalue(key, i);
646  }
647  static std::size_t eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
648  return kv->sizevalue(key, i, j);
649  }
650  };
651  template <> struct GetValue<char> {
652  static char eval(const Ref<KeyVal>& kv, const char* key, int i) {
653  return kv->charvalue(key, i);
654  }
655  static char eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
656  return kv->charvalue(key, i, j);
657  }
658  };
659  template <> struct GetValue<std::string> {
660  static std::string eval(const Ref<KeyVal>& kv, const char* key, int i) {
661  return kv->stringvalue(key, i);
662  }
663  static std::string eval(const Ref<KeyVal>& kv, const char* key, int i, int j) {
664  return kv->stringvalue(key, i, j);
665  }
666  };
667 }
668 
672 class Keyword {
673  public:
674  Keyword(const Ref<KeyVal>& kv,
675  const std::string& key) : kv_(kv), key_(key) {}
676 
677  const Ref<KeyVal>& keyval() const { return kv_; }
678  const std::string& key() const { return key_; }
679 
682  template <typename Value, typename Alloc>
683  Keyword& operator>>(std::vector<Value,Alloc>& vec) {
684  const std::size_t n = kv_->count(key_.c_str());
685  vec.resize(n);
686  for(std::size_t i=0; i<n; ++i) {
687  vec[i] = detail::GetValue<Value>::eval(kv_, key_.c_str(), i);
688  }
689  return *this;
690  }
691 
694  template <typename Key, typename Compare, typename Alloc>
695  Keyword& operator>>(std::set<Key, Compare, Alloc>& c) {
696  const std::size_t n = kv_->count(key_.c_str());
697  for(std::size_t i=0; i<n; ++i) {
698  c.insert( detail::GetValue<Key>::eval(kv_, key_.c_str(), i) );
699  }
700  return *this;
701  }
702 
705  template <typename Key, typename Data, typename Compare, typename Alloc>
706  Keyword& operator>>(std::map<Key, Data, Compare, Alloc>& c) {
707  const std::size_t n = kv_->count(key_.c_str());
708  for(std::size_t i=0; i<n; ++i) {
709  if (kv_->count(key_.c_str(),i) != 2) {
710  std::ostringstream oss;
711  oss << key_ << ":" << i;
712  throw sc::InputError("invalid std::map specification in KeyVal",
713  __FILE__, __LINE__,
714  oss.str().c_str());
715  }
716  Key k = detail::GetValue<Key>::eval(kv_, key_.c_str(), i, 0);
717  Data d = detail::GetValue<Data>::eval(kv_, key_.c_str(), i, 1);
718  c.insert(std::make_pair(k,d));
719  }
720  return *this;
721  }
722 
723  private:
724  Ref<KeyVal> kv_;
725  std::string key_;
726 };
727 
728 }
729 
730 #endif /* _KeyVal_h */
731 
732 // Local Variables:
733 // mode: c++
734 // c-file-style: "CLJ"
735 // End:
sc::ParsedKeyVal::ParsedKeyVal
ParsedKeyVal()
Create an empty ParsedKeyVal.
sc::KeyVal::intvalue
int intvalue(const char *key=0, const KeyValValue &def=KeyValValueint())
Returns the int value of key.
sc::KeyValValuefloat
Represents a float value.
Definition: keyvalval.h:88
sc::KeyVal
Definition: keyval.h:69
sc::AggregateKeyVal::key_exists
int key_exists(const char *)
Ultimately called by exists.
sc::Keyword::operator>>
Keyword & operator>>(std::vector< Value, Alloc > &vec)
fills up std::vector using KeyVal object of the following form key = [ value0 value1 value2 ....
Definition: keyval.h:683
sc::KeyVal::errortrace
virtual void errortrace(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::pcharvalue
DEPRECATED char * pcharvalue(const char *key=0, const KeyValValue &def=KeyValValuestring())
Returns a copy of the string representation of the key's value.
sc::ParsedKeyVal::have_unseen
int have_unseen()
Return 1 if there were unseen keywords, 0 if there are none, or -1 this keyval doesn't keep track of ...
sc::ParsedKeyVal::classname
const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::StringKeyVal::key_exists
int key_exists(const char *)
Ultimately called by exists.
sc::KeyVal::key_intvalue
virtual int key_intvalue(const char *key, const KeyValValue &def)
Ultimately called by intvalue.
sc::KeyVal::have_unseen
virtual int have_unseen()
Return 1 if there were unseen keywords, 0 if there are none, or -1 this keyval doesn't keep track of ...
sc::KeyVal::floatvalue
float floatvalue(const char *key=0, const KeyValValue &def=KeyValValuefloat())
Returns the float value of key.
sc::KeyVal::key_charvalue
virtual char key_charvalue(const char *key, const KeyValValue &def)
Ultimately called by charvalue.
sc::StringKeyVal::classname
virtual const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::detail::GetValue
GetValue(keyval, key, i) grabs the value corresponding to key.
Definition: keyval.h:602
sc::AssignedKeyVal::print
void print(std::ostream &os=ExEnv::out0()) const
sc::KeyValValuestring
Represents a std::string value.
Definition: keyvalval.h:168
sc::KeyValValueRefDescribedClass
Represents a Ref<DescribedClass> value.
Definition: keyvalval.h:201
sc::Ref< KeyValValue >
sc::KeyValValuesize
Represents a size_t value.
Definition: keyvalval.h:140
sc::StringKeyVal::dump
virtual void dump(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::ParsedKeyVal::print_unseen
void print_unseen(std::ostream &fp=ExEnv::out0())
Print keywords that were never looked at, if possible.
sc::KeyVal::value
Ref< KeyValValue > value(const char *key=0, const KeyValValue &def=KeyValValue())
Return the value associated with the keyword.
sc::AggregateKeyVal::errortrace
void errortrace(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::booleanvalue
int booleanvalue(const char *key=0, const KeyValValue &def=KeyValValueboolean())
Returns the boolean value (0 = false, 1 = true) of key.
sc::StringKeyVal::stringrep
virtual std::string stringrep(const char *key)=0
Returns the string representation of the value assigned to key.
sc::KeyVal::key_longvalue
virtual long key_longvalue(const char *key, const KeyValValue &def)
Ultimately called by longvalue.
sc::PrefixKeyVal::dump
void dump(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::key_floatvalue
virtual float key_floatvalue(const char *key, const KeyValValue &def)
Ultimately called by floatvalue.
sc::KeyVal::exists
int exists(const char *)
This takes as its only argument a keyword.
sc::AssignedKeyVal::clear
void clear()
Erase all of the stored assignments.
sc::PrefixKeyVal::classname
const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::StringKeyVal::truekeyword
virtual const char * truekeyword(const char *)
Returns a string which is the actual keyword if some sort of variable substitution takes place (neede...
sc::PrefixKeyVal
Definition: keyval.h:508
sc::ParsedKeyVal
Definition: keyval.h:546
sc::KeyVal::key_doublevalue
virtual double key_doublevalue(const char *key, const KeyValValue &def)
Ultimately called by doublevalue.
sc::KeyVal::print_unseen
virtual void print_unseen(std::ostream &fp=ExEnv::out0())
Print keywords that were never looked at, if possible.
sc::KeyVal::key_value
virtual Ref< KeyValValue > key_value(const char *, const KeyValValue &def)=0
Ultimately called by value.
sc::InputError
This is thrown when invalid input is provided.
Definition: scexception.h:153
sc::KeyVal::key_stringvalue
virtual std::string key_stringvalue(const char *key, const KeyValValue &def)
Ultimately called by stringvalue.
sc::KeyVal::describedclassvalue
Ref< DescribedClass > describedclassvalue(const char *key=0, const KeyValValue &def=KeyValValueRefDescribedClass())
Returns a reference to an object of type DescribedClass.
sc::AggregateKeyVal::classname
const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::KeyVal::longvalue
long longvalue(const char *key=0, const KeyValValue &def=KeyValValuelong())
Returns the long value of key.
sc::KeyVal::dump
virtual void dump(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::error
KeyValError error()
Return the current error condition.
sc::ParsedKeyVal::dump
void dump(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyValValuelong
Represents a long value.
Definition: keyvalval.h:127
sc::ExEnv::err0
static std::ostream & err0()
Return an ostream for error messages that writes from node 0.
Definition: exenv.h:87
sc::ParsedKeyVal::stringrep
std::string stringrep(const char *)
Returns the string representation of the value assigned to key.
sc::KeyValValueboolean
Represents a boolean value.
Definition: keyvalval.h:75
sc::KeyVal::key_booleanvalue
virtual int key_booleanvalue(const char *, const KeyValValue &def)
Ultimately called by booleanvalue.
sc::Keyword::operator>>
Keyword & operator>>(std::set< Key, Compare, Alloc > &c)
fills up std::set using KeyVal object of the following form key = [ key0 key1 key2 ....
Definition: keyval.h:695
sc::KeyVal::key_pcharvalue
virtual DEPRECATED char * key_pcharvalue(const char *key, const KeyValValue &def)
Ultimately called by pcharvalue.
sc::KeyValValueint
Represents an int value.
Definition: keyvalval.h:114
sc::KeyVal::sizevalue
size_t sizevalue(const char *key=0, const KeyValValue &def=KeyValValuesize())
Returns the size_t value of key.
sc::KeyValValuechar
Represents a char value.
Definition: keyvalval.h:101
sc::KeyVal::count
int count(const char *=0)
If the value of a keyword is an array, then return its length.
sc::StringKeyVal::key_value
Ref< KeyValValue > key_value(const char *, const KeyValValue &def)
Ultimately called by value.
sc::KeyValValue
Represents the value of a keyword.
Definition: keyvalval.h:38
sc::StringKeyVal
Definition: keyval.h:392
sc::ParsedKeyVal::truekeyword
const char * truekeyword(const char *)
Returns a string which is the actual keyword if some sort of variable substitution takes place (neede...
sc::StringKeyVal::errortrace
virtual void errortrace(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::key_exists
virtual int key_exists(const char *)=0
Ultimately called by exists.
sc::AssignedKeyVal
Definition: keyval.h:340
sc::AggregateKeyVal::dump
void dump(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::ParsedKeyVal::read
void read(const char *)
Read input data from the given filename.
sc::KeyVal::stringvalue
std::string stringvalue(const char *key=0, const KeyValValue &def=KeyValValuestring())
Returns a string representation of the key's value.
sc::Keyword
Definition: keyval.h:672
sc::AssignedKeyVal::key_exists
int key_exists(const char *)
Ultimately called by exists.
sc::AssignedKeyVal::classname
const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::AggregateKeyVal
Definition: keyval.h:431
sc::KeyVal::charvalue
char charvalue(const char *key=0, const KeyValValue &def=KeyValValuechar())
Returns the char value of key.
sc::ParsedKeyVal::parse_string
void parse_string(const std::string &)
Read input data from the given string.
sc::KeyVal::classname
virtual const char * classname(const char *)
Returns the name of the exact class of the object at the keyword.
sc::ParsedKeyVal::cat_files
static void cat_files(const char *, const Ref< KeyVal > &, std::ostream &o)
This is like the ParsedKeyVal(const char*,const Ref<KeyVal>&) ctor, but writes the contents of the fi...
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::KeyVal::key_count
virtual int key_count(const char *=0)
Ultimately called by count.
sc::ParsedKeyVal::errortrace
void errortrace(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::errormsg
const char * errormsg()
Return a textual representation of the current error.
sc::RefCount
The base class for all reference counted objects.
Definition: ref.h:192
sc::KeyVal::doublevalue
double doublevalue(const char *key=0, const KeyValValue &def=KeyValValuedouble())
Returns the double value of key.
sc::KeyValValuedouble
Represents a double value.
Definition: keyvalval.h:62
sc::IPV2
Definition: ipv2.h:77
sc::AggregateKeyVal::key_value
Ref< KeyValValue > key_value(const char *, const KeyValValue &def)
Ultimately called by value.
sc::PrefixKeyVal::errortrace
void errortrace(std::ostream &fp=ExEnv::err0())
Write a message to fp describing the error.
sc::KeyVal::describedclass
virtual Ref< DescribedClass > describedclass(const char *classname)
Returns a reference to an object of type DescribedClass using the top level keywords of this KeyVal.
sc::KeyVal::key_sizevalue
virtual size_t key_sizevalue(const char *key, const KeyValValue &def)
Ultimately called by sizevalue.
sc::KeyVal::key_describedclassvalue
virtual Ref< DescribedClass > key_describedclassvalue(const char *key, const KeyValValue &def)
Ultimately called by describedclassvalue.
sc::KeyVal::verbose
void verbose(int v)
Control printing of assignments.
Definition: keyval.h:330
sc::KeyVal::verbose
int verbose() const
Returns nonzero if assignments are printed.
Definition: keyval.h:332
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::Keyword::operator>>
Keyword & operator>>(std::map< Key, Data, Compare, Alloc > &c)
fills up std::map using KeyVal object of the following form key = [ [key0 value0] [key1 value1] [key2...
Definition: keyval.h:706
sc::AssignedKeyVal::key_value
Ref< KeyValValue > key_value(const char *, const KeyValValue &def)
Ultimately called by value.
sc::KeyVal::seterror
void seterror(KeyValError err)
Set the current error condition.
sc::ParsedKeyVal::~ParsedKeyVal
~ParsedKeyVal()
Cleanup, deleting the IPV2 object.

Generated at Sun Jan 26 2020 23:24:01 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.