utils.hpp

This file contains macros used to build Empirical’s C++ wrapper for D3.

Defines

IS_JS_FUNCTION(FN)

A more descriptive wrapper for the check to see if something is a function in Javascript.

CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_WINDOW()

Expects func_string to be a pre-defined variable that holds a string that may or may not be a function and checks to see if it is a function defined within the current window. If it is, it stores that function in the variable func_string.

CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_NAMESPACE_1(A1)
CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_NAMESPACE_2(A1, A2)
CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_NAMESPACE_3(A1, A2, A3)
CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_NAMESPACE(...)

Expects func_string to be a pre-defined variable that holds a string that may or may not be a function and checks to see if it is a function defined within and of the given namespaces. If it is, it stores that function in the variable func_string. Namespaces are checked in the order given and the first function found is used.

CONVERT_FUNCSTRING_TO_FUNCTION_IF_IN_NAMESPACE_OR_WINDOW(...)

Expects func_string to be a pre-defined variable that holds a string that may or may not be a function and checks to see if it is a function defined within and of the given namespaces or the current window. If it is, it stores that function in the variable func_string. Namespaces are checked in the order given and the first function found is used.

D3_CALLBACK_FUNCTION_1_ARG(FUNC, CALLBACK)

Call a Javascript function that accepts either a string indicating the name of a callback function or a normal string

D3_CALLBACK_FUNCTION_2_ARGS(FUNC, CALLBACK, ARG1)

Same as D3_CALLBACK_FUNCTION_1_ARG, but accepts an additional argument, ARG1, that goes before the callback function in the call to FUNC

D3_CALLBACK_METHOD_2_ARGS_IMPL(MACRO, FUNC, ARG1, ARG2)
D3_CALLBACK_METHOD_2_ARGS(FUNC, ARG1, ARG2)
D3_CALLBACK_METHOD_1_ARG_IMPL(MACRO, FUNC, ARG1)
D3_CALLBACK_METHOD_1_ARG(FUNC, ARG1)

The same as D3_CALLBACK_METHOD_2_ARGS except for FUNCs that only accept a single argument (the string that might or might not be a function).

D3_CALLBACK_METHOD_CPP_FUNCTION_2_ARGS(FUNC, ARG1, CPP_FUN)
D3_CALLBACK_METHOD_CPP_FUNCTION_1_ARG(FUNC, CPP_FUN)

Functions

void StoreNewObject(int id)