You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: Split out some code from output_flex_t class
The class output_flex_t is huge, output-flex.cpp with over 1000 lines is
the largest source code file we have. This change moves some code out of
there.
This change introduces a new templated wrapper base class
(lua_wrapper_base) for wrapping C++ objects in Lua. It is then used for
the "Table" and "ExpireOutput" Lua objects. Functions that are called
from Lua on those objects are called through the wrapper on the
underlying C++ objects using little wrapper functions in the wrapper
classes. A new macro TRAMPOLINE_WRAPPED_OBJECT() is used to call these
functions where we used the TRAMPOLINE() macro before.
One problem is though that more complex functions need more of the
machinery in the output_flex_t class to work, specifically this is the
"insert" function for tables which can not be implemented without full
access to the output_flex_t class. So this function keeps using the old
mechanism.
This also changes the get_from_idx_param() helper function and the
functions using it
(output_flex_t::[get_table|expire_output]_from_param()) to return a
reference instead of a const reference so that the wrapper will be
initialized with a mutable pointer to the underlying C++ class.
Currently all functions that can be called through the wrapper are const
functions, but this will not necessarily always be the case in the
future.
0 commit comments