lsst.astshim  master-gd1207e8857
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
SeriesMap.h
1 /*
2  * LSST Data Management System
3  * Copyright 2016 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 public:
65  explicit SeriesMap(Mapping const & map1, Mapping const & map2, std::string const & options="") :
66  CmpMap(map1, map2, true, options)
67  {}
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 
88  explicit SeriesMap(AstCmpMap * rawptr) :
89  CmpMap(rawptr)
90  {
91  if (!getSeries()) {
92  throw std::runtime_error("Compound mapping is in parallel");
93  }
94  }
95 };
96 
97 } // namespace ast
98 
99 #endif
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: SeriesMap.h:82
Definition: Mapping.h:59
std::shared_ptr< SeriesMap > copy() const
Return a deep copy of this object.
Definition: SeriesMap.h:77
Definition: Object.h:49
SeriesMap(Mapping const &map1, Mapping const &map2, std::string const &options="")
Definition: SeriesMap.h:65
bool getSeries()
Return True if the map is in series.
Definition: CmpMap.h:101
Definition: SeriesMap.h:50
Definition: CmpMap.h:56
SeriesMap(AstCmpMap *rawptr)
Definition: SeriesMap.h:88