spla
Classes | Namespaces | Macros | Functions
top.hpp File Reference
#include <spla/config.hpp>
#include <spla/op.hpp>
#include <core/ttype.hpp>
#include <functional>
#include <sstream>
#include <string>
Include dependency graph for top.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  spla::TOpUnary< A0, R >
 
class  spla::TOpBinary< A0, A1, R >
 
class  spla::TOpSelect< A0 >
 

Namespaces

 spla
 

Macros

#define DECL_OP_UNA(fname, key_prefix, A0, R, ...)
 
#define DECL_OP_UNA_S(name, key_prefix, T, ...)    DECL_OP_UNA(name, key_prefix, T, T, __VA_ARGS__)
 
#define DECL_OP_BIN(fname, key_prefix, A0, A1, R, ...)
 
#define DECL_OP_BIN_S(name, key_prefix, T, ...)    DECL_OP_BIN(name, key_prefix, T, T, T, __VA_ARGS__)
 
#define DECL_OP_SELECT(fname, key_prefix, A0, ...)
 

Functions

void spla::register_ops ()
 Register all ops on library initialization. More...
 

Macro Definition Documentation

◆ DECL_OP_BIN

#define DECL_OP_BIN (   fname,
  key_prefix,
  A0,
  A1,
  R,
  ... 
)
Value:
{ \
auto func = make_ref<TOpBinary<A0, A1, R>>(); \
\
func->function = [](A0 a, A1 b) -> R __VA_ARGS__; \
func->name = #fname; \
\
std::stringstream source_builder; \
source_builder << "(" \
<< func->get_type_arg_0()->get_cpp() \
<< " a, " \
<< func->get_type_arg_1()->get_cpp() \
<< " b)" #__VA_ARGS__; \
\
func->source = source_builder.str(); \
\
std::stringstream key_builder; \
key_builder << #key_prefix << "_" \
<< func->get_type_arg_0()->get_code() \
<< func->get_type_arg_1()->get_code() \
<< func->get_type_res()->get_code(); \
func->key = key_builder.str(); \
\
fname = func.as<OpBinary>(); \
}

◆ DECL_OP_BIN_S

#define DECL_OP_BIN_S (   name,
  key_prefix,
  T,
  ... 
)     DECL_OP_BIN(name, key_prefix, T, T, T, __VA_ARGS__)

◆ DECL_OP_SELECT

#define DECL_OP_SELECT (   fname,
  key_prefix,
  A0,
  ... 
)
Value:
{ \
auto func = make_ref<TOpSelect<A0>>(); \
\
func->function = [](A0 a) -> bool __VA_ARGS__; \
func->name = #fname; \
\
std::stringstream source_builder; \
source_builder << "(" \
<< func->get_type_arg_0()->get_cpp() \
<< " a)" #__VA_ARGS__; \
\
func->source = source_builder.str(); \
\
std::stringstream key_builder; \
key_builder << #key_prefix << "_" \
<< func->get_type_arg_0()->get_code(); \
func->key = key_builder.str(); \
\
fname = func.as<OpSelect>(); \
}

◆ DECL_OP_UNA

#define DECL_OP_UNA (   fname,
  key_prefix,
  A0,
  R,
  ... 
)
Value:
{ \
auto func = make_ref<TOpUnary<A0, R>>(); \
\
func->function = [](A0 a) -> R __VA_ARGS__; \
func->name = #fname; \
\
std::stringstream source_builder; \
source_builder << "(" \
<< func->get_type_arg_0()->get_cpp() \
<< " a)" #__VA_ARGS__; \
\
func->source = source_builder.str(); \
\
std::stringstream key_builder; \
key_builder << #key_prefix << "_" \
<< func->get_type_arg_0()->get_code() \
<< func->get_type_res()->get_code(); \
func->key = key_builder.str(); \
\
fname = func.as<OpUnary>(); \
}

◆ DECL_OP_UNA_S

#define DECL_OP_UNA_S (   name,
  key_prefix,
  T,
  ... 
)     DECL_OP_UNA(name, key_prefix, T, T, __VA_ARGS__)