LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+f5e6047307,21.0.0-11-g2b59f77+a9c1acf22d,21.0.0-11-ga42c5b2+86977b0b17,21.0.0-12-gf4ce030+76814010d2,21.0.0-13-g1721dae+760e7a6536,21.0.0-13-g3a573fe+768d78a30a,21.0.0-15-g5a7caf0+f21cbc5713,21.0.0-16-g0fb55c1+b60e2d390c,21.0.0-19-g4cded4ca+71a93a33c0,21.0.0-2-g103fe59+bb20972958,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+3ad5d60fb1,21.0.0-2-g7f82c8f+8babb168e8,21.0.0-2-g8f08a60+06509c8b61,21.0.0-2-g8faa9b5+616205b9df,21.0.0-2-ga326454+8babb168e8,21.0.0-2-gde069b7+5e4aea9c2f,21.0.0-2-gecfae73+1d3a86e577,21.0.0-2-gfc62afb+3ad5d60fb1,21.0.0-25-g1d57be3cd+e73869a214,21.0.0-3-g357aad2+ed88757d29,21.0.0-3-g4a4ce7f+3ad5d60fb1,21.0.0-3-g4be5c26+3ad5d60fb1,21.0.0-3-g65f322c+e0b24896a3,21.0.0-3-g7d9da8d+616205b9df,21.0.0-3-ge02ed75+a9c1acf22d,21.0.0-4-g591bb35+a9c1acf22d,21.0.0-4-g65b4814+b60e2d390c,21.0.0-4-gccdca77+0de219a2bc,21.0.0-4-ge8a399c+6c55c39e83,21.0.0-5-gd00fb1e+05fce91b99,21.0.0-6-gc675373+3ad5d60fb1,21.0.0-64-g1122c245+4fb2b8f86e,21.0.0-7-g04766d7+cd19d05db2,21.0.0-7-gdf92d54+04719a4bac,21.0.0-8-g5674e7b+d1bd76f71f,master-gac4afde19b+a9c1acf22d,w.2021.13
LSST Data Management Base Package
PropertyList.h
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 details.
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 #ifndef LSST_DAF_BASE_PROPERTYLIST
26 #define LSST_DAF_BASE_PROPERTYLIST
27 
47 #include <list>
48 #include <memory>
49 #include <string>
50 #include <typeinfo>
51 #include <unordered_map>
52 #include <vector>
53 
54 #include "boost/any.hpp"
55 
56 #include "lsst/base.h"
58 
59 namespace lsst {
60 namespace daf {
61 namespace base {
62 
63 #if defined(__ICC)
64 #pragma warning(push)
65 #pragma warning(disable : 444)
66 #endif
67 
69 public:
70  // Typedefs
73 
75  PropertyList();
76 
78  virtual ~PropertyList() noexcept;
79 
80  // Accessors
81 
87  virtual PropertySet::Ptr deepCopy() const;
88 
89  // I can't make copydoc work for this so...
101  template <typename T>
102  T get(std::string const& name) const;
103 
104  // I can't make copydoc work for this so...
117  template <typename T>
118  T get(std::string const& name, T const& defaultValue) const;
119 
121  template <typename T>
122  std::vector<T> getArray(std::string const& name) const;
123 
131  std::string const& getComment(std::string const& name) const;
132 
134  std::vector<std::string> getOrderedNames() const;
135 
137  std::list<std::string>::const_iterator begin() const;
138 
140  std::list<std::string>::const_iterator end() const;
141 
143  virtual std::string toString(bool topLevelOnly = false, std::string const& indent = "") const;
144 
145  // Modifiers
146 
148  template <typename T>
149  void set(std::string const& name, T const& value);
150 
159  void set(std::string const& name, PropertySet::Ptr const& value);
160 
162  template <typename T>
163  void set(std::string const& name, std::vector<T> const& value);
164 
166  void set(std::string const& name, char const* value);
167 
169  template <typename T>
170  void add(std::string const& name, T const& value);
171 
173  template <typename T>
174  void add(std::string const& name, std::vector<T> const& value);
175 
177  void add(std::string const& name, char const* value);
178 
187  template <typename T>
188  void set(std::string const& name, T const& value, std::string const& comment);
189 
198  template <typename T>
199  void set(std::string const& name, std::vector<T> const& value, std::string const& comment);
200 
209  void set(std::string const& name, char const* value, std::string const& comment);
210 
219  template <typename T>
220  void add(std::string const& name, T const& value, std::string const& comment);
221 
230  template <typename T>
231  void add(std::string const& name, std::vector<T> const& value, std::string const& comment);
232 
241  void add(std::string const& name, char const* value, std::string const& comment);
242 
244  template <typename T>
245  void set(std::string const& name, T const& value, char const* comment) {
246  set(name, value, std::string(comment));
247  }
248 
250  template <typename T>
251  void set(std::string const& name, std::vector<T> const& value, char const* comment) {
252  set(name, value, std::string(comment));
253  }
254 
256  void set(std::string const& name, char const* value, char const* comment) {
257  set(name, value, std::string(comment));
258  }
259 
261  template <typename T>
262  void add(std::string const& name, T const& value, char const* comment) {
263  add(name, value, std::string(comment));
264  }
266  template <typename T>
267  void add(std::string const& name, std::vector<T> const& value, char const* comment) {
268  add(name, value, std::string(comment));
269  }
270 
272  void add(std::string const& name, char const* value, char const* comment) {
273  add(name, value, std::string(comment));
274  }
275 
277  virtual void copy(std::string const& dest, PropertySet::ConstPtr source, std::string const& name,
278  bool asScalar = false);
279 
281  virtual void combine(PropertySet::ConstPtr source);
282 
284  virtual void remove(std::string const& name);
285 
286 private:
287 
289 
290  virtual void _set(std::string const& name, std::shared_ptr<std::vector<boost::any> > vp);
291  virtual void _moveToEnd(std::string const& name);
292  virtual void _commentOrderFix(std::string const& name, std::string const& comment);
293 
294  CommentMap _comments;
295  std::list<std::string> _order;
296 };
297 
298 #if defined(__ICC)
299 #pragma warning(pop)
300 #endif
301 }
302 } // namespace daf
303 } // namespace lsst
304 
305 #endif
table::Key< std::string > name
Definition: Amplifier.cc:116
int end
Basic LSST definitions.
#define LSST_EXPORT
Make a symbol visible even if visiblity is hidden (e.g.
Definition: base.h:54
Class for storing ordered metadata with comments.
Definition: PropertyList.h:68
void set(std::string const &name, std::vector< T > const &value, char const *comment)
Version of set vector value that accepts a comment.
Definition: PropertyList.h:251
std::shared_ptr< PropertyList > Ptr
Definition: PropertyList.h:71
void add(std::string const &name, T const &value, char const *comment)
Version of add scalar value that accepts a comment.
Definition: PropertyList.h:262
void add(std::string const &name, std::vector< T > const &value, char const *comment)
Version of add vector value that accepts a comment.
Definition: PropertyList.h:267
std::shared_ptr< PropertyList const > ConstPtr
Definition: PropertyList.h:72
void add(std::string const &name, char const *value, char const *comment)
Version of add char* value that accepts a comment.
Definition: PropertyList.h:272
virtual ~PropertyList() noexcept
Destructor.
void set(std::string const &name, char const *value, char const *comment)
Version of set char* value that accepts a comment.
Definition: PropertyList.h:256
Class for storing generic metadata.
Definition: PropertySet.h:67
daf::base::PropertyList * list
Definition: fits.cc:913
daf::base::PropertySet * set
Definition: fits.cc:912
const char * source()
Source function that allows astChannel to source from a Stream.
Definition: Stream.h:224
A base class for image defects.
STL namespace.