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.
You can view, comment on, or merge this pull request online at:

  https://github.com/osm2pgsql-dev/osm2pgsql/pull/2324

-- Commit Summary --

  * Refactor: Split out some code from output_flex_t class

-- File Changes --

    M src/flex-lua-expire-output.cpp (83)
    M src/flex-lua-expire-output.hpp (24)
    M src/flex-lua-table.cpp (86)
    M src/flex-lua-table.hpp (20)
    A src/flex-lua-wrapper.hpp (60)
    M src/output-flex.cpp (218)
    M src/output-flex.hpp (27)

-- Patch Links --

https://github.com/osm2pgsql-dev/osm2pgsql/pull/2324.patch
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2324.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2324
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to