OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Codegen.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2021 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 
20 namespace spatial_type {
21 
22 std::unique_ptr<Codegen> Codegen::init(const Analyzer::GeoOperator* geo_operator,
23  const Catalog_Namespace::Catalog* catalog) {
24  const auto operator_name = geo_operator->getName();
25  if (operator_name == "ST_NRings") {
26  return std::make_unique<NRings>(geo_operator, catalog);
27  } else if (operator_name == "ST_NPoints") {
28  return std::make_unique<NPoints>(geo_operator, catalog);
29  } else if (operator_name == "ST_PointN") {
30  return std::make_unique<PointN>(geo_operator, catalog);
31  } else if (operator_name == "ST_StartPoint" || operator_name == "ST_EndPoint") {
32  return std::make_unique<StartEndPoint>(geo_operator, catalog);
33  } else if (operator_name == "ST_X" || operator_name == "ST_Y") {
34  return std::make_unique<PointAccessors>(geo_operator, catalog);
35  }
36  UNREACHABLE();
37  return nullptr;
38 }
39 
40 } // namespace spatial_type
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:102
#define UNREACHABLE()
Definition: Logger.h:250
const std::string & getName() const
Definition: Analyzer.h:1749
static std::unique_ptr< Codegen > init(const Analyzer::GeoOperator *geo_operator, const Catalog_Namespace::Catalog *catalog)
Definition: Codegen.cpp:22