OmniSciDB  dfae7c3b14
anonymous_namespace{ExtensionFunctionsWhitelist.cpp} Namespace Reference

Functions

std::string serialize_type (const ExtArgumentType type, bool byval=true)
 
std::string drop_suffix (const std::string &str)
 
ExtArgumentType deserialize_type (const std::string &type_name)
 

Function Documentation

◆ deserialize_type()

ExtArgumentType anonymous_namespace{ExtensionFunctionsWhitelist.cpp}::deserialize_type ( const std::string &  type_name)

Definition at line 468 of file ExtensionFunctionsWhitelist.cpp.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, Bool, CHECK, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, Cursor, Double, Float, GeoLineString, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and Void.

Referenced by ExtensionFunctionsWhitelist::addCommon().

468  {
469  if (type_name == "bool" || type_name == "i1") {
470  return ExtArgumentType::Bool;
471  }
472  if (type_name == "i8") {
473  return ExtArgumentType::Int8;
474  }
475  if (type_name == "i16") {
476  return ExtArgumentType::Int16;
477  }
478  if (type_name == "i32") {
479  return ExtArgumentType::Int32;
480  }
481  if (type_name == "i64") {
482  return ExtArgumentType::Int64;
483  }
484  if (type_name == "float") {
485  return ExtArgumentType::Float;
486  }
487  if (type_name == "double") {
489  }
490  if (type_name == "void") {
491  return ExtArgumentType::Void;
492  }
493  if (type_name == "i8*") {
494  return ExtArgumentType::PInt8;
495  }
496  if (type_name == "i16*") {
498  }
499  if (type_name == "i32*") {
501  }
502  if (type_name == "i64*") {
504  }
505  if (type_name == "float*") {
507  }
508  if (type_name == "double*") {
510  }
511  if (type_name == "i1*" || type_name == "bool*") {
512  return ExtArgumentType::PBool;
513  }
514  if (type_name == "{i8*, i64, i8}*") {
516  }
517  if (type_name == "{i16*, i64, i8}*") {
519  }
520  if (type_name == "{i32*, i64, i8}*") {
522  }
523  if (type_name == "{i64*, i64, i8}*") {
525  }
526  if (type_name == "{float*, i64, i8}*") {
528  }
529  if (type_name == "{double*, i64, i8}*") {
531  }
532  if (type_name == "{i1*, i64, i8}*" || type_name == "{bool*, i64, i8}*") {
534  }
535  if (type_name == "geo_point") {
537  }
538  if (type_name == "geo_linestring") {
540  }
541  if (type_name == "geo_polygon") {
543  }
544  if (type_name == "geo_multi_polygon") {
546  }
547  if (type_name == "cursor") {
549  }
550  if (type_name == "{i8*, i64}") {
552  }
553  if (type_name == "{i16*, i64}") {
555  }
556  if (type_name == "{i32*, i64}") {
558  }
559  if (type_name == "{i64*, i64}") {
561  }
562  if (type_name == "{float*, i64}") {
564  }
565  if (type_name == "{double*, i64}") {
567  }
568  if (type_name == "{i1*, i64}" || type_name == "{bool*, i64}") {
570  }
571  CHECK(false);
572  return ExtArgumentType::Int16;
573 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ drop_suffix()

std::string anonymous_namespace{ExtensionFunctionsWhitelist.cpp}::drop_suffix ( const std::string &  str)

Definition at line 195 of file ExtensionFunctionsWhitelist.cpp.

References CHECK_GT.

Referenced by ExtensionFunctionsWhitelist::addCommon(), and ExtensionFunction::getName().

195  {
196  const auto idx = str.find("__");
197  if (idx == std::string::npos) {
198  return str;
199  }
200  CHECK_GT(idx, std::string::size_type(0));
201  return str.substr(0, idx);
202 }
#define CHECK_GT(x, y)
Definition: Logger.h:209
+ Here is the caller graph for this function:

◆ serialize_type()

std::string anonymous_namespace{ExtensionFunctionsWhitelist.cpp}::serialize_type ( const ExtArgumentType  type,
bool  byval = true 
)

Definition at line 118 of file ExtensionFunctionsWhitelist.cpp.

References ArrayBool, ArrayDouble, ArrayFloat, ArrayInt16, ArrayInt32, ArrayInt64, ArrayInt8, Bool, CHECK, ColumnBool, ColumnDouble, ColumnFloat, ColumnInt16, ColumnInt32, ColumnInt64, ColumnInt8, Cursor, Double, Float, GeoLineString, GeoMultiPolygon, GeoPoint, GeoPolygon, Int16, Int32, Int64, Int8, PBool, PDouble, PFloat, PInt16, PInt32, PInt64, PInt8, and Void.

Referenced by ext_arg_type_to_type_info(), ExtensionFunctionsWhitelist::getLLVMDeclarations(), ExtensionFunction::toString(), and ExtensionFunctionsWhitelist::toString().

118  {
119  switch (type) {
121  return "i8"; // clang converts bool to i8
123  return "i8";
125  return "i16";
127  return "i32";
129  return "i64";
131  return "float";
133  return "double";
135  return "void";
137  return "i8*";
139  return "i16*";
141  return "i32*";
143  return "i64*";
145  return "float*";
147  return "double*";
149  return "i1*";
151  return "{i8*, i64, i8}*";
153  return "{i16*, i64, i8}*";
155  return "{i32*, i64, i8}*";
157  return "{i64*, i64, i8}*";
159  return "{float*, i64, i8}*";
161  return "{double*, i64, i8}*";
163  return "{i1*, i64, i8}*";
165  return "geo_point";
167  return "geo_linestring";
169  return "geo_polygon";
171  return "geo_multi_polygon";
173  return "cursor";
175  return (byval ? "{i8*, i64}" : "i8*");
177  return (byval ? "{i16*, i64}" : "i8*");
179  return (byval ? "{i32*, i64}" : "i8*");
181  return (byval ? "{i64*, i64}" : "i8*");
183  return (byval ? "{float*, i64}" : "i8*");
185  return (byval ? "{double*, i64}" : "i8*");
187  return (byval ? "{i1*, i64}" : "i8*");
188  default:
189  CHECK(false);
190  }
191  CHECK(false);
192  return "";
193 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function: