lsst.astshim  master-gd1207e8857
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
ParallelMap.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_PARALLELMAP_H
23 #define ASTSHIM_PARALLELMAP_H
24 
25 #include <memory>
26 #include <sstream>
27 #include <stdexcept>
28 
29 #include "astshim/base.h"
30 #include "astshim/CmpMap.h"
31 
32 namespace ast {
33 
50 class ParallelMap : public CmpMap {
51 friend class Object;
52 public:
65  explicit ParallelMap(Mapping const & map1, Mapping const & map2, std::string const & options="") :
66  CmpMap(map1, map2, false, options)
67  {}
68 
69  virtual ~ParallelMap() {}
70 
71  ParallelMap(ParallelMap const &) = delete;
72  ParallelMap(ParallelMap &&) = default;
73  ParallelMap & operator=(ParallelMap const &) = delete;
74  ParallelMap & operator=(ParallelMap &&) = default;
75 
77  std::shared_ptr<ParallelMap> copy() const {
78  return std::static_pointer_cast<ParallelMap>(_copyPolymorphic());
79  }
80 
81 protected:
82  virtual std::shared_ptr<Object> _copyPolymorphic() const override {
83  return _copyImpl<ParallelMap, AstCmpMap>();
84  }
85 
88  explicit ParallelMap(AstCmpMap * rawptr) :
89  CmpMap(rawptr)
90  {
91  if (getSeries()) {
92  throw std::runtime_error("Compound mapping is in series");
93  }
94  }
95 };
96 
97 } // namespace ast
98 
99 #endif
std::shared_ptr< ParallelMap > copy() const
Return a deep copy of this object.
Definition: ParallelMap.h:77
Definition: ParallelMap.h:50
Definition: Mapping.h:59
Definition: Object.h:49
ParallelMap(Mapping const &map1, Mapping const &map2, std::string const &options="")
Definition: ParallelMap.h:65
bool getSeries()
Return True if the map is in series.
Definition: CmpMap.h:101
Definition: CmpMap.h:56
ParallelMap(AstCmpMap *rawptr)
Definition: ParallelMap.h:88
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: ParallelMap.h:82