lsst.daf.base  14.0-5-g744ff5f+5
PropertySet.cc
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more detailTypeErrors.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 
27 
28 #include <algorithm>
29 #include <iomanip>
30 #include <sstream>
31 #include <stdexcept>
32 
34 #include "lsst/daf/base/DateTime.h"
35 
36 namespace dafBase = lsst::daf::base;
38 
39 using namespace std;
40 
41 dafBase::PropertySet::PropertySet(bool flat) : Citizen(typeid(*this)), _flat(flat) {
42 }
43 
45 }
46 
48 // Accessors
50 
52  Ptr n(new PropertySet(_flat));
53  for (AnyMap::const_iterator i = _map.begin(); i != _map.end(); ++i) {
54  if (i->second->back().type() == typeid(Ptr)) {
56  i->second->begin(); j != i->second->end(); ++j) {
57  Ptr p = boost::any_cast<Ptr>(*j);
58  if (p.get() == 0) {
59  n->add(i->first, Ptr());
60  } else {
61  n->add(i->first, p->deepCopy());
62  }
63  }
64  } else {
66  new vector<boost::any>(*(i->second)));
67  n->_map[i->first] = vp;
68  }
69  }
70  return n;
71 }
72 
73 size_t dafBase::PropertySet::nameCount(bool topLevelOnly) const {
74  int n = 0;
75  for (AnyMap::const_iterator i = _map.begin(); i != _map.end(); ++i) {
76  ++n;
77  if (!topLevelOnly && i->second->back().type() == typeid(Ptr)) {
78  Ptr p = boost::any_cast<Ptr>(i->second->back());
79  if (p.get() != 0) {
80  n += p->nameCount(false);
81  }
82  }
83  }
84  return n;
85 }
86 
87 vector<string> dafBase::PropertySet::names(bool topLevelOnly) const {
89  for (AnyMap::const_iterator i = _map.begin(); i != _map.end(); ++i) {
90  v.push_back(i->first);
91  if (!topLevelOnly && i->second->back().type() == typeid(Ptr)) {
92  Ptr p = boost::any_cast<Ptr>(i->second->back());
93  if (p.get() != 0) {
94  vector<string> w = p->names(false);
96  k != w.end(); ++k) {
97  v.push_back(i->first + "." + *k);
98  }
99  }
100  }
101  }
102  return v;
103 }
104 
106 dafBase::PropertySet::paramNames(bool topLevelOnly) const {
107  vector<string> v;
108  for (AnyMap::const_iterator i = _map.begin(); i != _map.end(); ++i) {
109  if (i->second->back().type() == typeid(Ptr)) {
110  Ptr p = boost::any_cast<Ptr>(i->second->back());
111  if (p.get() != 0 && !topLevelOnly) {
112  vector<string> w = p->paramNames(false);
114  k != w.end(); ++k) {
115  v.push_back(i->first + "." + *k);
116  }
117  }
118  } else {
119  v.push_back(i->first);
120  }
121  }
122  return v;
123 }
124 
126 dafBase::PropertySet::propertySetNames(bool topLevelOnly) const {
127  vector<string> v;
128  for (AnyMap::const_iterator i = _map.begin(); i != _map.end(); ++i) {
129  if (i->second->back().type() == typeid(Ptr)) {
130  v.push_back(i->first);
131  Ptr p = boost::any_cast<Ptr>(i->second->back());
132  if (p.get() != 0 && !topLevelOnly) {
133  vector<string> w = p->propertySetNames(false);
135  k != w.end(); ++k) {
136  v.push_back(i->first + "." + *k);
137  }
138  }
139  }
140  }
141  return v;
142 }
143 
144 bool dafBase::PropertySet::exists(std::string const& name) const {
145  return _find(name) != _map.end();
146 }
147 
149  AnyMap::const_iterator i = _find(name);
150  return i != _map.end() && i->second->size() > 1U;
151 }
152 
154  AnyMap::const_iterator i = _find(name);
155  return i != _map.end() && i->second->back().type() == typeid(Ptr);
156 }
157 
159  AnyMap::const_iterator i = _find(name);
160  if (i == _map.end()) return 0;
161  return i->second->size();
162 }
163 
165  AnyMap::const_iterator i = _find(name);
166  if (i == _map.end()) {
167  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
168  }
169  return i->second->back().type();
170 }
171 
172 // The following throw an exception if the type does not match exactly.
173 
174 template <typename T>
175 T dafBase::PropertySet::get(string const& name) const { /* parasoft-suppress LsstDm-3-4a LsstDm-4-6 "allow template over bool" */
176  AnyMap::const_iterator i = _find(name);
177  if (i == _map.end()) {
178  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
179  }
180  try {
181  return boost::any_cast<T>(i->second->back());
182  }
183  catch (boost::bad_any_cast) {
184  throw LSST_EXCEPT(pexExcept::TypeError, name);
185  }
186  // not reached
187  return boost::any_cast<T>(i->second->back());
188 }
189 
190 template <typename T>
191 T dafBase::PropertySet::get(string const& name, T const& defaultValue) const { /* parasoft-suppress LsstDm-3-4a LsstDm-4-6 "allow template over bool" */
192  AnyMap::const_iterator i = _find(name);
193  if (i == _map.end()) {
194  return defaultValue;
195  }
196  try {
197  return boost::any_cast<T>(i->second->back());
198  }
199  catch (boost::bad_any_cast) {
200  throw LSST_EXCEPT(pexExcept::TypeError, name);
201  }
202  // not reached
203  return boost::any_cast<T>(i->second->back());
204 }
205 
206 template <typename T>
207 vector<T> dafBase::PropertySet::getArray(string const& name) const {
208  AnyMap::const_iterator i = _find(name);
209  if (i == _map.end()) {
210  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
211  }
212  vector<T> v;
213  for (vector<boost::any>::const_iterator j = i->second->begin();
214  j != i->second->end(); ++j) {
215  try {
216  v.push_back(boost::any_cast<T>(*j));
217  }
218  catch (boost::bad_any_cast) {
219  throw LSST_EXCEPT(pexExcept::TypeError, name);
220  }
221  }
222  return v;
223 }
224 
225 // The following throw an exception if the conversion is inappropriate.
226 
227 bool dafBase::PropertySet::getAsBool(std::string const& name) const { /* parasoft-suppress LsstDm-3-4a LsstDm-4-6 "for symmetry with other types" */
228  return get<bool>(name);
229 }
230 
232  AnyMap::const_iterator i = _find(name);
233  if (i == _map.end()) {
234  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
235  }
236  boost::any v = i->second->back();
237  type_info const& t = v.type();
238  if (t == typeid(bool)) {
239  return boost::any_cast<bool>(v);
240  } else if (t == typeid(char)) {
241  return boost::any_cast<char>(v);
242  } else if (t == typeid(signed char)) {
243  return boost::any_cast<signed char>(v);
244  } else if (t == typeid(unsigned char)) {
245  return boost::any_cast<unsigned char>(v);
246  } else if (t == typeid(short)) {
247  return boost::any_cast<short>(v);
248  } else if (t == typeid(unsigned short)) {
249  return boost::any_cast<unsigned short>(v);
250  }
251  try {
252  return boost::any_cast<int>(v);
253  }
254  catch (boost::bad_any_cast) {
255  throw LSST_EXCEPT(pexExcept::TypeError, name);
256  }
257  // not reached
258  return boost::any_cast<int>(v);
259 }
260 
262  AnyMap::const_iterator i = _find(name);
263  if (i == _map.end()) {
264  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
265  }
266  boost::any v = i->second->back();
267  type_info const& t = v.type();
268  if (t == typeid(bool)) return boost::any_cast<bool>(v);
269  if (t == typeid(char)) return boost::any_cast<char>(v);
270  if (t == typeid(signed char)) return boost::any_cast<signed char>(v);
271  if (t == typeid(unsigned char)) return boost::any_cast<unsigned char>(v);
272  if (t == typeid(short)) return boost::any_cast<short>(v);
273  if (t == typeid(unsigned short)) return boost::any_cast<unsigned short>(v);
274  if (t == typeid(int)) return boost::any_cast<int>(v);
275  if (t == typeid(unsigned int)) return boost::any_cast<unsigned int>(v);
276  if (t == typeid(long)) return boost::any_cast<long>(v);
277  if (t == typeid(long long)) return boost::any_cast<long long>(v);
278  try {
279  return boost::any_cast<int64_t>(v);
280  }
281  catch (boost::bad_any_cast) {
282  throw LSST_EXCEPT(pexExcept::TypeError, name);
283  }
284  // not reached
285  return boost::any_cast<int64_t>(v);
286 }
287 
289  AnyMap::const_iterator i = _find(name);
290  if (i == _map.end()) {
291  throw LSST_EXCEPT(pexExcept::NotFoundError, name + " not found");
292  }
293  boost::any v = i->second->back();
294  type_info const& t = v.type();
295  if (t == typeid(bool)) return boost::any_cast<bool>(v);
296  if (t == typeid(char)) return boost::any_cast<char>(v);
297  if (t == typeid(signed char)) return boost::any_cast<signed char>(v);
298  if (t == typeid(unsigned char)) return boost::any_cast<unsigned char>(v);
299  if (t == typeid(short)) return boost::any_cast<short>(v);
300  if (t == typeid(unsigned short)) return boost::any_cast<unsigned short>(v);
301  if (t == typeid(int)) return boost::any_cast<int>(v);
302  if (t == typeid(unsigned int)) return boost::any_cast<unsigned int>(v);
303  if (t == typeid(long)) return boost::any_cast<long>(v);
304  if (t == typeid(unsigned long)) return boost::any_cast<unsigned long>(v);
305  if (t == typeid(long long)) return boost::any_cast<long long>(v);
306  if (t == typeid(unsigned long long)) return boost::any_cast<unsigned long long>(v);
307  if (t == typeid(float)) return boost::any_cast<float>(v);
308  try {
309  return boost::any_cast<double>(v);
310  }
311  catch (boost::bad_any_cast) {
312  throw LSST_EXCEPT(pexExcept::TypeError, name);
313  }
314  // not reached
315  return boost::any_cast<double>(v);
316 }
317 
319  return get<string>(name);
320 }
321 
324  return get<Ptr>(name);
325 }
326 
329  return get<Persistable::Ptr>(name);
330 }
331 
333  std::string const& indent) const {
334  ostringstream s;
335  vector<string> nv = names();
336  sort(nv.begin(), nv.end());
337  for (vector<string>::const_iterator i = nv.begin(); i != nv.end(); ++i) {
338  std::shared_ptr< vector<boost::any> > vp = _map.find(*i)->second;
339  type_info const& t = vp->back().type();
340  if (t == typeid(Ptr)) {
341  s << indent << *i << " = ";
342  if (topLevelOnly) {
343  s << "{ ... }";
344  } else {
345  Ptr p = boost::any_cast<Ptr>(vp->back());
346  if (p.get() == 0) {
347  s << "{ NULL }";
348  } else {
349  s << '{' << endl;
350  s << p->toString(false, indent + "..");
351  s << indent << '}';
352  }
353  }
354  s << endl;
355  }
356  else {
357  s << indent << _format(*i);
358  }
359  }
360  return s.str();
361 }
362 
364  ostringstream s;
365  s << std::showpoint; // Always show a decimal point for floats
366  AnyMap::const_iterator j = _map.find(name);
367  s << j->first << " = ";
368  std::shared_ptr< vector<boost::any> > vp = j->second;
369  if (vp->size() > 1) {
370  s << "[ ";
371  }
372  type_info const& t = vp->back().type();
373  for (vector<boost::any>::const_iterator k = vp->begin();
374  k != vp->end(); ++k) {
375  if (k != vp->begin()) {
376  s << ", ";
377  }
378  boost::any const& v(*k);
379  if (t == typeid(bool)) {
380  s << boost::any_cast<bool>(v);
381  } else if (t == typeid(char)) {
382  s << '\'' << boost::any_cast<char>(v) << '\'';
383  } else if (t == typeid(signed char)) {
384  s << '\'' << boost::any_cast<signed char>(v) << '\'';
385  } else if (t == typeid(unsigned char)) {
386  s << '\'' << boost::any_cast<unsigned char>(v) << '\'';
387  } else if (t == typeid(short)) {
388  s << boost::any_cast<short>(v);
389  } else if (t == typeid(unsigned short)) {
390  s << boost::any_cast<unsigned short>(v);
391  } else if (t == typeid(int)) {
392  s << boost::any_cast<int>(v);
393  } else if (t == typeid(unsigned int)) {
394  s << boost::any_cast<unsigned int>(v);
395  } else if (t == typeid(long)) {
396  s << boost::any_cast<long>(v);
397  } else if (t == typeid(unsigned long)) {
398  s << boost::any_cast<unsigned long>(v);
399  } else if (t == typeid(long long)) {
400  s << boost::any_cast<long long>(v);
401  } else if (t == typeid(unsigned long long)) {
402  s << boost::any_cast<unsigned long long>(v);
403  } else if (t == typeid(float)) {
404  s << std::setprecision(7) << boost::any_cast<float>(v);
405  } else if (t == typeid(double)) {
406  s << std::setprecision(14) << boost::any_cast<double>(v);
407  } else if (t == typeid(string)) {
408  s << '"' << boost::any_cast<string>(v) << '"';
409  } else if (t == typeid(dafBase::DateTime)) {
410  s << boost::any_cast<dafBase::DateTime>(v).toString(dafBase::DateTime::UTC);
411  } else if (t == typeid(Ptr)) {
412  s << "{ ... }";
413  } else if (t == typeid(Persistable::Ptr)) {
414  s << "<Persistable>";
415  } else {
416  s << "<Unknown>";
417  }
418  }
419  if (j->second->size() > 1) {
420  s << " ]";
421  }
422  s << endl;
423  return s.str();
424 }
425 
427 // Modifiers
429 
430 template <typename T>
431 void dafBase::PropertySet::set(std::string const& name, T const& value) {
433  vp->push_back(value);
434  _set(name, vp);
435 }
436 
437 template <typename T>
439  vector<T> const& value) {
440  if (value.empty()) return;
442  vp->insert(vp->end(), value.begin(), value.end());
443  _set(name, vp);
444 }
445 
446 void dafBase::PropertySet::set(std::string const& name, char const* value) {
447  set(name, string(value));
448 }
449 
450 template <typename T>
451 void dafBase::PropertySet::add(std::string const& name, T const& value) {
452  AnyMap::iterator i = _find(name);
453  if (i == _map.end()) {
454  set(name, value);
455  }
456  else {
457  if (i->second->back().type() != typeid(T)) {
459  name + " has mismatched type");
460  }
461  i->second->push_back(value);
462  }
463 }
464 
465 // Specialize for Ptrs to check for cycles.
466 template <> void dafBase::PropertySet::add<dafBase::PropertySet::Ptr>(
467  std::string const& name, Ptr const& value) {
468  AnyMap::iterator i = _find(name);
469  if (i == _map.end()) {
470  set(name, value);
471  }
472  else {
473  if (i->second->back().type() != typeid(Ptr)) {
475  name + " has mismatched type");
476  }
477  _cycleCheckPtr(value, name);
478  i->second->push_back(value);
479  }
480 }
481 
482 template <typename T>
484  vector<T> const& value) {
485  AnyMap::iterator i = _find(name);
486  if (i == _map.end()) {
487  set(name, value);
488  }
489  else {
490  if (i->second->back().type() != typeid(T)) {
492  name + " has mismatched type");
493  }
494  i->second->insert(i->second->end(), value.begin(), value.end());
495  }
496 }
497 
498 // Specialize for Ptrs to check for cycles.
499 template<> void dafBase::PropertySet::add<dafBase::PropertySet::Ptr>(
500  std::string const& name, vector<Ptr> const& value) {
501  AnyMap::iterator i = _find(name);
502  if (i == _map.end()) {
503  set(name, value);
504  }
505  else {
506  if (i->second->back().type() != typeid(Ptr)) {
508  name + " has mismatched type");
509  }
510  _cycleCheckPtrVec(value, name);
511  i->second->insert(i->second->end(), value.begin(), value.end());
512  }
513 }
514 
515 void dafBase::PropertySet::add(std::string const& name, char const* value) {
516  add(name, string(value));
517 }
518 
520  ConstPtr source, std::string const& name,
521  bool asScalar) {
522  if (source.get() == 0) {
524  "Missing source");
525  }
526  AnyMap::const_iterator sj = source->_find(name);
527  if (sj == source->_map.end()) {
529  name + " not in source");
530  }
531  remove(dest);
532  if (asScalar) {
533  auto vp = std::make_shared<vector<boost::any>>();
534  vp->push_back(sj->second->back());
535  _set(dest, vp);
536  } else {
537  auto vp = std::make_shared<vector<boost::any>>(*(sj->second));
538  _set(dest, vp);
539  }
540 }
541 
543  if (source.get() == 0) {
544  return;
545  }
546  vector<string> names = source->paramNames(false);
547  for (vector<string>::const_iterator i = names.begin();
548  i != names.end(); ++i) {
549  AnyMap::const_iterator sp = source->_find(*i);
550  _add(*i, sp->second);
551  }
552 }
553 
555  string::size_type i = name.find('.');
556  if (_flat || i == name.npos) {
557  _map.erase(name);
558  return;
559  }
560  string prefix(name, 0, i);
561  AnyMap::iterator j = _map.find(prefix);
562  if (j == _map.end() || j->second->back().type() != typeid(Ptr)) {
563  return;
564  }
565  Ptr p = boost::any_cast<Ptr>(j->second->back());
566  if (p.get() != 0) {
567  string suffix(name, i + 1);
568  p->remove(suffix);
569  }
570 }
571 
573 // Private member functions
575 
576 dafBase::PropertySet::AnyMap::iterator
577 dafBase::PropertySet::_find(std::string const& name) {
578  string::size_type i = name.find('.');
579  if (_flat || i == name.npos) {
580  return _map.find(name);
581  }
582  string prefix(name, 0, i);
583  AnyMap::iterator j = _map.find(prefix);
584  if (j == _map.end() || j->second->back().type() != typeid(Ptr)) {
585  return _map.end();
586  }
587  Ptr p = boost::any_cast<Ptr>(j->second->back());
588  if (p.get() == 0) {
589  return _map.end();
590  }
591  string suffix(name, i + 1);
592  AnyMap::iterator x = p->_find(suffix);
593  if (x == p->_map.end()) {
594  return _map.end();
595  }
596  return x;
597 }
598 
599 dafBase::PropertySet::AnyMap::const_iterator
600 dafBase::PropertySet::_find(std::string const& name) const {
601  string::size_type i = name.find('.');
602  if (_flat || i == name.npos) {
603  return _map.find(name);
604  }
605  string prefix(name, 0, i);
606  AnyMap::const_iterator j = _map.find(prefix);
607  if (j == _map.end() || j->second->back().type() != typeid(Ptr)) {
608  return _map.end();
609  }
610  Ptr p = boost::any_cast<Ptr>(j->second->back());
611  if (p.get() == 0) {
612  return _map.end();
613  }
614  string suffix(name, i + 1);
615  AnyMap::const_iterator x = p->_find(suffix);
616  if (x == p->_map.end()) {
617  return _map.end();
618  }
619  return x;
620 }
621 
624  _findOrInsert(name, vp);
625 }
626 
629 
630  AnyMap::const_iterator dp = _find(name);
631  if (dp == _map.end()) {
632  _set(name, vp);
633  }
634  else {
635  if (vp->back().type() != dp->second->back().type()) {
637  name + " has mismatched type");
638  }
639  // Check for cycles
640  if (vp->back().type() == typeid(Ptr)) {
641  _cycleCheckAnyVec(*vp, name);
642  }
643  dp->second->insert(dp->second->end(), vp->begin(), vp->end());
644  }
645 }
646 
647 void dafBase::PropertySet::_findOrInsert(
649  if (vp->back().type() == typeid(Ptr)) {
650  if (_flat) {
651  Ptr source = boost::any_cast<Ptr>(vp->back());
652  vector<string> names = source->paramNames(false);
653  for (vector<string>::const_iterator i = names.begin();
654  i != names.end(); ++i) {
655  AnyMap::const_iterator sp = source->_find(*i);
656  _add(name + "." + *i, sp->second);
657  }
658  return;
659  }
660 
661  // Check for cycles
662  _cycleCheckAnyVec(*vp, name);
663  }
664 
665  string::size_type i = name.find('.');
666  if (_flat || i == name.npos) {
667  _map[name] = vp;
668  return;
669  }
670  string prefix(name, 0, i);
671  string suffix(name, i + 1);
672  AnyMap::iterator j = _map.find(prefix);
673  if (j == _map.end()) {
675  pp->_findOrInsert(suffix, vp);
677  temp->push_back(pp);
678  _map[prefix] = temp;
679  return;
680  }
681  else if (j->second->back().type() != typeid(Ptr)) {
683  prefix +
684  " exists but does not contain PropertySet::Ptrs");
685  }
686  Ptr p = boost::any_cast<Ptr>(j->second->back());
687  if (p.get() == 0) {
689  prefix +
690  " exists but contains null PropertySet::Ptr");
691  }
692  p->_findOrInsert(suffix, vp);
693 }
694 
695 void dafBase::PropertySet::_cycleCheckPtrVec(std::vector<Ptr> const& v,
696  std::string const& name) {
697  for (vector<Ptr>::const_iterator i = v.begin(); i != v.end(); ++i) {
698  _cycleCheckPtr(*i, name);
699  }
700 }
701 
702 void dafBase::PropertySet::_cycleCheckAnyVec(std::vector<boost::any> const& v,
703  std::string const& name) {
704  for (vector<boost::any>::const_iterator i = v.begin(); i != v.end(); ++i) {
705  _cycleCheckPtr(boost::any_cast<Ptr>(*i), name);
706  }
707 }
708 
709 void dafBase::PropertySet::_cycleCheckPtr(Ptr const& v,
710  std::string const& name) {
711  if (v.get() == this) {
713  name + " would cause a cycle");
714  }
715  vector<string> sets = v->propertySetNames(false);
716  for (vector<string>::const_iterator i = sets.begin();
717  i != sets.end(); ++i) {
718  if (v->getAsPropertySetPtr(*i).get() == this) {
720  name + " would cause a cycle");
721  }
722  }
723 }
724 
726 // Explicit template instantiations
728 
730 // Explicit template instantiations are not well understood by doxygen.
731 
732 #define INSTANTIATE(t) \
733  template t dafBase::PropertySet::get<t>(string const& name) const; \
734  template t dafBase::PropertySet::get<t>(string const& name, t const& defaultValue) const; \
735  template vector<t> dafBase::PropertySet::getArray<t>(string const& name) const; \
736  template void dafBase::PropertySet::set<t>(string const& name, t const& value); \
737  template void dafBase::PropertySet::set<t>(string const& name, vector<t> const& value); \
738  template void dafBase::PropertySet::add<t>(string const& name, t const& value); \
739  template void dafBase::PropertySet::add<t>(string const& name, vector<t> const& value);
740 
741 INSTANTIATE(bool)
742 INSTANTIATE(char)
743 INSTANTIATE(signed char)
744 INSTANTIATE(unsigned char)
745 INSTANTIATE(short)
746 INSTANTIATE(unsigned short)
747 INSTANTIATE(int)
748 INSTANTIATE(unsigned int)
749 INSTANTIATE(long)
750 INSTANTIATE(unsigned long)
751 INSTANTIATE(long long)
752 INSTANTIATE(unsigned long long)
753 INSTANTIATE(float)
754 INSTANTIATE(double)
755 INSTANTIATE(string)
756 INSTANTIATE(dafBase::PropertySet::Ptr)
757 INSTANTIATE(dafBase::Persistable::Ptr)
758 INSTANTIATE(dafBase::DateTime)
759 
760 
double getAsDouble(std::string const &name) const
Get the last value for any arithmetic property name (possibly hierarchical).
Definition: PropertySet.cc:288
virtual Ptr deepCopy(void) const
Make a deep copy of the PropertySet and all of its contents.
Definition: PropertySet.cc:51
virtual std::string _format(std::string const &name) const
Definition: PropertySet.cc:363
T empty(T... args)
std::shared_ptr< PropertySet > Ptr
Definition: PropertySet.h:76
Class for handling dates/times, including MJD, UTC, and TAI.
Definition: DateTime.h:62
size_t valueCount(std::string const &name) const
Get the number of values for a property name (possibly hierarchical).
Definition: PropertySet.cc:158
std::vector< T > getArray(std::string const &name) const
Get the vector of values for a property name (possibly hierarchical).
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
Definition: PropertySet.cc:554
virtual void _add(std::string const &name, std::shared_ptr< std::vector< boost::any > > vp)
Definition: PropertySet.cc:627
T get(std::string const &name) const
Get the last value for a property name (possibly hierarchical).
Definition: PropertySet.cc:175
bool getAsBool(std::string const &name) const
Get the last value for a bool property name (possibly hierarchical).
Definition: PropertySet.cc:227
std::vector< std::string > paramNames(bool topLevelOnly=true) const
A variant of names that excludes the names of subproperties.
Definition: PropertySet.cc:106
int getAsInt(std::string const &name) const
Get the last value for a bool/char/short/int property name (possibly hierarchical).
Definition: PropertySet.cc:231
T endl(T... args)
PropertySet::Ptr getAsPropertySetPtr(std::string const &name) const
Get the last value for a subproperty name (possibly hierarchical).
Definition: PropertySet.cc:323
STL namespace.
T end(T... args)
bool isPropertySetPtr(std::string const &name) const
Determine if a name (possibly hierarchical) is a subproperty.
Definition: PropertySet.cc:153
PropertySet(bool flat=false)
Construct an empty PropertySet.
Definition: PropertySet.cc:41
virtual std::string toString(bool topLevelOnly=false, std::string const &indent="") const
Generate a string representation of the PropertySet.
Definition: PropertySet.cc:332
void set(std::string const &name, T const &value)
Replace all values for a property name (possibly hierarchical) with a new scalar value.
Definition: PropertySet.cc:431
STL class.
bool isArray(std::string const &name) const
Determine if a name (possibly hierarchical) has multiple values.
Definition: PropertySet.cc:148
virtual void copy(std::string const &dest, ConstPtr source, std::string const &name, bool asScalar=false)
Replace a single value vector in the destination with one from the source.
Definition: PropertySet.cc:519
T push_back(T... args)
virtual void combine(ConstPtr source)
Append all value vectors from the source to their corresponding properties.
Definition: PropertySet.cc:542
int64_t getAsInt64(std::string const &name) const
Get the last value for a bool/char/short/int/int64_t property name (possibly hierarchical).
Definition: PropertySet.cc:261
std::vector< std::string > names(bool topLevelOnly=true) const
Get the names in the PropertySet, optionally including those in subproperties.
Definition: PropertySet.cc:87
size_t nameCount(bool topLevelOnly=true) const
Get the number of names in the PropertySet, optionally including those in subproperties.
Definition: PropertySet.cc:73
T erase(T... args)
T str(T... args)
bool exists(std::string const &name) const
Determine if a name (possibly hierarchical) exists.
Definition: PropertySet.cc:144
T showpoint(T... args)
Interface for DateTime class.
std::vector< std::string > propertySetNames(bool topLevelOnly=true) const
A variant of names that only returns the names of subproperties.
Definition: PropertySet.cc:126
T get(T... args)
T find(T... args)
#define LSST_EXCEPT(type,...)
STL class.
virtual void _set(std::string const &name, std::shared_ptr< std::vector< boost::any > > vp)
Definition: PropertySet.cc:622
T begin(T... args)
Class for storing generic metadata.
Definition: PropertySet.h:73
std::shared_ptr< Persistable > Ptr
Definition: Persistable.h:76
virtual ~PropertySet(void)
Destructor.
Definition: PropertySet.cc:44
T sort(T... args)
std::string getAsString(std::string const &name) const
Get the last value for a string property name (possibly hierarchical).
Definition: PropertySet.cc:318
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:53
Persistable::Ptr getAsPersistablePtr(std::string const &name) const
Get the last value for a Persistable name (possibly hierarchical).
Definition: PropertySet.cc:328
void add(std::string const &name, T const &value)
Append a single value to the vector of values for a property name (possibly hierarchical).
Definition: PropertySet.cc:451
std::type_info const & typeOf(std::string const &name) const
Get the type of values for a property name (possibly hierarchical).
Definition: PropertySet.cc:164