OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Parser::DefaultValidate< IntLiteral > Struct Template Reference

#include <ParserNode.h>

Public Member Functions

template<typename T >
decltype(auto) operator() (T t)
 

Detailed Description

template<>
struct Parser::DefaultValidate< IntLiteral >

Definition at line 2208 of file ParserNode.h.

Member Function Documentation

template<typename T >
decltype(auto) Parser::DefaultValidate< IntLiteral >::operator() ( t)
inline

Definition at line 2210 of file ParserNode.h.

2210  {
2211  const std::string property_name(boost::to_upper_copy<std::string>(*t->get_name()));
2212  if (!dynamic_cast<const IntLiteral*>(t->get_value())) {
2213  throw std::runtime_error(property_name + " must be an integer literal.");
2214  }
2215  const auto val = static_cast<const IntLiteral*>(t->get_value())->get_intval();
2216  // Delay this check for FRAGMENT_SIZE because we shouldn't make
2217  // assumptions about the stored type from here.
2218  // TODO : remove this check for all other integer options if we
2219  // would like to preform similar bounds checking i.e. max_rows,
2220  // page_size, max_chunk_size, etc...
2221  if (val <= 0 && property_name != "FRAGMENT_SIZE") {
2222  throw std::runtime_error(property_name + " must be a positive number.");
2223  }
2224  return val;
2225  }

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