Mercurial > octave
diff libinterp/parse-tree/pt-eval.h @ 25653:b3d357990b52
better use of templates for action_container and derived classes
It should now be possible to add arbitrary lambda functions or
std::function objects to the unwind_protect objects and octave_link
event queues, and to add functions (including member functions) with
any number of parameters.
* action-container.h (action_container::fcn_elem): Define using
variadic template, std::bind, and std::function for more flexibility
and to eliminate code duplication.
(action_container::method_elem, action_container::method_arg_elem,
action_container::method_crefarg_elem,
action_container::method_arg2_elem,
action_container::method_arg3_elem,
action_container::method_arg4_elem): Delete.
(action_container::add_action): Rename from add. Now protected.
(action_container::add): New generic function for adding functions.
(action_container::add_fcn, action_container::add_method): Define
using variadic template for more flexibility and to eliminate code
duplication.
* event-queue.h (event_queue::add_action): Rename from add.
Now protected.
* unwind-prot.h (unwind_protect::add_action): Likewise.
* variable-editor-model.cc: Eliminate template parameters for calls to
octave_link::post_event fucntions.
* octave-link.h (octave_link::post_event, octave_link::do_post_event):
Define using variadic template for more flexibility and to eliminate
code duplication.
* pt-eval.h, pt-eval.cc (tree_evaluator::uwp_set_echo_state):
New function.
(tree_evaluator::set_echo_state, tree_evaluator::set_echo_file_name,
tree_evaluator::set_echo_file_pos): Delete.
(tree_evaluator::push_echo_state_cleanup): Use uwp_set_echo_state
instead of set_echo_state, set_echo_file_name, and set_echo_file_pos.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 20 Jul 2018 18:38:03 -0400 |
parents | e37d857716c3 |
children | d2aae3570c81 |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.h Fri Jul 20 13:09:19 2018 -0700 +++ b/libinterp/parse-tree/pt-eval.h Fri Jul 20 18:38:03 2018 -0400 @@ -538,19 +538,8 @@ std::list<octave_lvalue> make_lvalue_list (tree_argument_list *); // For unwind-protect. - void set_echo_state (bool val) { m_echo_state = val; } - - // For unwind-protect. - void set_echo_file_name (const std::string& file_name) - { - m_echo_file_name = file_name; - } - - // For unwind-protect. - void set_echo_file_pos (const size_t& file_pos) - { - m_echo_file_pos = file_pos; - } + void uwp_set_echo_state (bool state, const std::string& file_name, + size_t pos); bool echo_this_file (const std::string& file, int type) const;