OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int Class Reference
+ Inheritance diagram for import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int:
+ Collaboration diagram for import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int:

Public Member Functions

 Function_int ()
 
const mup::char_type * GetDesc () const final
 
mup::IToken * Clone () const final
 
void Eval (mup::ptr_val_type &ret, const mup::ptr_val_type *args, int argc) final
 

Detailed Description

Definition at line 195 of file ExpressionParser.cpp.

Constructor & Destructor Documentation

import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int::Function_int ( )
inline

Definition at line 197 of file ExpressionParser.cpp.

197 : mup::ICallback(mup::cmFUNC, _T("int"), 1) {}

Member Function Documentation

mup::IToken* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int::Clone ( ) const
inlinefinal
void import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int::Eval ( mup::ptr_val_type &  ret,
const mup::ptr_val_type *  args,
int  argc 
)
inlinefinal

Definition at line 200 of file ExpressionParser.cpp.

References run_benchmark_import::args, CHECK_EQ, import_export::anonymous_namespace{ExpressionParser.cpp}::ms_to_ss(), and THROW_INVALID_PARAMETER.

200  {
201  CHECK_EQ(argc, 1);
202  switch (args[0]->GetType()) {
203  case 'i':
204  *ret = args[0]->GetInteger();
205  break;
206  case 'f':
207  *ret = static_cast<mup::int_type>(args[0]->GetFloat());
208  break;
209  case 's':
210  *ret = static_cast<mup::int_type>(std::stoll(ms_to_ss(args[0]->GetString())));
211  break;
212  case 'b':
213  *ret = args[0]->GetBool() ? static_cast<mup::int_type>(1)
214  : static_cast<mup::int_type>(0);
215  break;
216  default: {
217  THROW_INVALID_PARAMETER(0, "unsupported type");
218  }
219  }
220  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
#define THROW_INVALID_PARAMETER(arg, what)

+ Here is the call graph for this function:

const mup::char_type* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_int::GetDesc ( ) const
inlinefinal

Definition at line 198 of file ExpressionParser.cpp.

198 { return _T("cast a value to an int"); };

The documentation for this class was generated from the following file: