lsst.gauss2d.fit g199a45376c+5e234f8357
 
Loading...
Searching...
No Matches
channel.h
1#ifndef LSST_GAUSS2D_FIT_CHANNEL_H
2#define LSST_GAUSS2D_FIT_CHANNEL_H
3
4#include <iostream>
5#include <functional>
6#include <map>
7#include <memory>
8#include <set>
9#include <stdexcept>
10#include <string>
11
12#include "lsst/gauss2d/object.h"
13
14#include "util.h"
15
16namespace lsst::gauss2d::fit {
17
29class Channel : public Object {
30public:
31 typedef std::map<std::string, std::shared_ptr<const Channel>> Registry;
32
33 Channel(const Channel &) = delete;
34 Channel &operator=(const Channel &) = delete;
44 static void erase(std::string name);
45
52 static const std::shared_ptr<const Channel> find_channel(std::string name);
53
60 static const std::shared_ptr<const Channel> get_channel(std::string name);
61
62 static std::vector<std::shared_ptr<const Channel>> get_channels();
63
64 inline static const std::string NAME_NONE = "None";
65
66 const std::string name;
67
68 static const std::shared_ptr<const Channel> NONE_PTR();
69 static const Channel &NONE();
70
71 std::string repr(bool name_keywords = false,
72 std::string_view namespace_separator = Object::CC_NAMESPACE_SEPARATOR) const override;
73 std::string str() const override;
74
81 static std::shared_ptr<Channel> make(std::string name);
83 static const std::shared_ptr<const Channel> make_const(std::string name);
84
85 // TODO: Figure out why tests compile but do not run without this operator.
86 // Until then, do NOT remove.
87 const bool operator<(const Channel &c) const;
88 const bool operator==(const Channel &c) const;
89 const bool operator!=(const Channel &c) const;
90
91private:
99 explicit Channel(std::string name);
100
101 struct Shared_enabler;
102};
103
104inline bool operator<(const std::reference_wrapper<const Channel> &lhs,
105 const std::reference_wrapper<const Channel> &rhs) {
106 return (lhs.get() < rhs.get());
107}
108
109inline bool operator==(const std::reference_wrapper<const Channel> &lhs,
110 const std::reference_wrapper<const Channel> &rhs) {
111 return (lhs.get() == rhs.get());
112}
113
114} // namespace lsst::gauss2d::fit
115
116#endif
static void erase(std::string name)
Definition channel.cc:51
static const std::shared_ptr< const Channel > make_const(std::string name)
Same as make(), but creating a new Channel.
Definition channel.cc:97
static const std::shared_ptr< const Channel > get_channel(std::string name)
Definition channel.cc:74
static const std::shared_ptr< const Channel > find_channel(std::string name)
Definition channel.cc:67
static std::shared_ptr< Channel > make(std::string name)
Definition channel.cc:89