lsst.astshim  14.0-9-g580965d+1
SeriesMap.h
1 /*
2  * LSST Data Management System
3  * Copyright 2017 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 #ifndef ASTSHIM_SERIESMAP_H
23 #define ASTSHIM_SERIESMAP_H
24 
25 #include <algorithm>
26 #include <sstream>
27 #include <stdexcept>
28 
29 #include "astshim/base.h"
30 #include "astshim/Mapping.h"
31 #include "astshim/CmpMap.h"
32 
33 namespace ast {
34 
50 class SeriesMap : public CmpMap {
51  friend class Object;
52 
53 public:
66  explicit SeriesMap(Mapping const &map1, Mapping const &map2, std::string const &options = "")
67  : CmpMap(map1, map2, true, options) {}
68 
69  virtual ~SeriesMap() {}
70 
71  SeriesMap(SeriesMap const &) = delete;
72  SeriesMap(SeriesMap &&) = default;
73  SeriesMap &operator=(SeriesMap const &) = delete;
74  SeriesMap &operator=(SeriesMap &&) = default;
75 
77  std::shared_ptr<SeriesMap> copy() const {
78  return std::static_pointer_cast<SeriesMap>(copyPolymorphic());
79  }
80 
81 protected:
82  virtual std::shared_ptr<Object> copyPolymorphic() const override {
83  return copyImpl<SeriesMap, AstCmpMap>();
84  }
85 
87  explicit SeriesMap(AstCmpMap *rawptr) : CmpMap(rawptr) {
88  if (!getSeries()) {
89  throw std::runtime_error("Compound mapping is in parallel");
90  }
91  }
92 };
93 
94 } // namespace ast
95 
96 #endif
Definition: SeriesMap.h:50
std::shared_ptr< SeriesMap > copy() const
Return a deep copy of this object.
Definition: SeriesMap.h:77
virtual std::shared_ptr< Object > copyPolymorphic() const override
Definition: SeriesMap.h:82
AST wrapper classes and functions.
Definition: attributes_channel.dox:1
Definition: Mapping.h:59
bool getSeries()
Return True if the map is in series.
Definition: CmpMap.h:97
SeriesMap(AstCmpMap *rawptr)
Construct a SeriesMap from a raw AST pointer.
Definition: SeriesMap.h:87
SeriesMap(Mapping const &map1, Mapping const &map2, std::string const &options="")
Definition: SeriesMap.h:66
Definition: Object.h:51
Definition: CmpMap.h:56