LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
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
59namespace lsst {
60namespace daf {
61namespace base {
62
63#if defined(__ICC)
64#pragma warning(push)
65#pragma warning(disable : 444)
66#endif
67
69public:
70 // Typedefs
73
76
78 virtual ~PropertyList() noexcept;
79
80 // Accessors
81
87 virtual std::shared_ptr<PropertySet> 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
163 void set(std::string const& name, std::shared_ptr<PropertySet> const& value);
164
166 template <typename T>
167 void set(std::string const& name, std::vector<T> const& value);
168
170 void set(std::string const& name, char const* value);
171
173 template <typename T>
174 void add(std::string const& name, T const& value);
175
177 template <typename T>
178 void add(std::string const& name, std::vector<T> const& value);
179
181 void add(std::string const& name, char const* value);
182
191 template <typename T>
192 void set(std::string const& name, T const& value, std::string const& comment);
193
202 template <typename T>
203 void set(std::string const& name, std::vector<T> const& value, std::string const& comment);
204
213 void set(std::string const& name, char const* value, std::string const& comment);
214
223 template <typename T>
224 void add(std::string const& name, T const& value, std::string const& comment);
225
234 template <typename T>
235 void add(std::string const& name, std::vector<T> const& value, std::string const& comment);
236
245 void add(std::string const& name, char const* value, std::string const& comment);
246
248 template <typename T>
249 void set(std::string const& name, T const& value, char const* comment) {
250 set(name, value, std::string(comment));
251 }
252
254 template <typename T>
255 void set(std::string const& name, std::vector<T> const& value, char const* comment) {
256 set(name, value, std::string(comment));
257 }
258
260 void set(std::string const& name, char const* value, char const* comment) {
261 set(name, value, std::string(comment));
262 }
263
265 template <typename T>
266 void add(std::string const& name, T const& value, char const* comment) {
267 add(name, value, std::string(comment));
268 }
270 template <typename T>
271 void add(std::string const& name, std::vector<T> const& value, char const* comment) {
272 add(name, value, std::string(comment));
273 }
274
276 void add(std::string const& name, char const* value, char const* comment) {
277 add(name, value, std::string(comment));
278 }
279
281
282 virtual void copy(std::string const& dest, PropertySet const & source, std::string const& name,
283 bool asScalar = false);
284 [[deprecated("Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
285 virtual void copy(std::string const& dest, std::shared_ptr<PropertySet const> source,
286 std::string const& name, bool asScalar = false);
288
290
291 virtual void combine(PropertySet const & source);
292 [[deprecated("Replaced by a non-shared_ptr overload. Will be removed after v25.")]]
293 virtual void combine(std::shared_ptr<PropertySet const> source);
295
297 virtual void remove(std::string const& name);
298
299private:
300
302
303 virtual void _set(std::string const& name, std::shared_ptr<std::vector<std::any> > vp);
304 virtual void _moveToEnd(std::string const& name);
305 virtual void _commentOrderFix(std::string const& name, std::string const& comment);
306
307 CommentMap _comments;
309};
310
311#if defined(__ICC)
312#pragma warning(pop)
313#endif
314}
315} // namespace daf
316} // namespace lsst
317
318#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:37
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:255
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:266
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:271
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:276
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:260
Class for storing generic metadata.
Definition: PropertySet.h:66
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.