OmniSciDB  04ee39c94c
anonymous_namespace{ExtensionFunctionsWhitelist.cpp} Namespace Reference

Functions

std::string serialize_type (const ExtArgumentType type)
 
ExtArgumentType deserialize_type (const std::string &type_name)
 
std::string drop_suffix (const std::string &str)
 

Function Documentation

◆ deserialize_type()

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

Definition at line 242 of file ExtensionFunctionsWhitelist.cpp.

References CHECK, Double, Float, Int16, Int32, Int64, Int8, PDouble, PFloat, PInt16, PInt32, PInt64, and PInt8.

Referenced by ExtensionFunctionsWhitelist::addCommon().

242  {
243  if (type_name == "bool" || type_name == "i1") {
244  return ExtArgumentType::Int8; // need to handle the possibility of nulls
245  }
246  if (type_name == "i8") {
247  return ExtArgumentType::Int8;
248  }
249  if (type_name == "i16") {
250  return ExtArgumentType::Int16;
251  }
252  if (type_name == "i32") {
253  return ExtArgumentType::Int32;
254  }
255  if (type_name == "i64") {
256  return ExtArgumentType::Int64;
257  }
258  if (type_name == "float") {
259  return ExtArgumentType::Float;
260  }
261  if (type_name == "double") {
263  }
264  if (type_name == "i8*") {
265  return ExtArgumentType::PInt8;
266  }
267  if (type_name == "i16*") {
269  }
270  if (type_name == "i32*") {
272  }
273  if (type_name == "i64*") {
275  }
276  if (type_name == "float*") {
278  }
279  if (type_name == "double*") {
281  }
282  CHECK(false);
283  return ExtArgumentType::Int16;
284 }
#define CHECK(condition)
Definition: Logger.h:187
+ 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 286 of file ExtensionFunctionsWhitelist.cpp.

References CHECK_GT.

Referenced by ExtensionFunctionsWhitelist::addCommon().

286  {
287  const auto idx = str.find("__");
288  if (idx == std::string::npos) {
289  return str;
290  }
291  CHECK_GT(idx, std::string::size_type(0));
292  return str.substr(0, idx);
293 }
#define CHECK_GT(x, y)
Definition: Logger.h:199
+ Here is the caller graph for this function:

◆ serialize_type()

std::string anonymous_namespace{ExtensionFunctionsWhitelist.cpp}::serialize_type ( const ExtArgumentType  type)

Definition at line 116 of file ExtensionFunctionsWhitelist.cpp.

References Bool, CHECK, Double, Float, Int16, Int32, Int64, Int8, PDouble, PFloat, PInt16, PInt32, PInt64, and PInt8.

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

116  {
117  switch (type) {
119  return "i1";
121  return "i8";
123  return "i16";
125  return "i32";
127  return "i64";
129  return "float";
131  return "double";
133  return "i8*";
135  return "i16*";
137  return "i32*";
139  return "i64*";
141  return "float*";
143  return "double*";
144  default:
145  CHECK(false);
146  }
147  CHECK(false);
148  return "";
149 }
#define CHECK(condition)
Definition: Logger.h:187
+ Here is the caller graph for this function: