From df0516278059baf2e2ed5199e478831054a034fa Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 10 Aug 2014 15:17:22 +0200 Subject: [PATCH] tgba_digraph: Simplify declaration of forwarded methods. * src/misc/common.hh (SPOT_RETURN): New macro. * src/tgba/tgbagraph.hh (out, states, transitions): Use it. --- src/misc/common.hh | 5 +++++ src/tgba/tgbagraph.hh | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/misc/common.hh b/src/misc/common.hh index 4f8ceeaf3..dd51dcba5 100644 --- a/src/misc/common.hh +++ b/src/misc/common.hh @@ -95,4 +95,9 @@ #define SPOT_UNIMPLEMENTED() throw std::runtime_error("unimplemented"); + +// Useful when forwarding methods such as: +// auto func(int param) SPOT_RETURN(implem_.func(param)); +#define SPOT_RETURN(code) -> decltype(code) { return code; } + #endif // SPOT_MISC_COMMON_HH diff --git a/src/tgba/tgbagraph.hh b/src/tgba/tgbagraph.hh index 79681ea59..2c8937517 100644 --- a/src/tgba/tgbagraph.hh +++ b/src/tgba/tgbagraph.hh @@ -332,17 +332,20 @@ namespace spot return g_.new_transition(src, dst, cond, acc); } - internal::state_out - out(unsigned src) const - { - return g_.out(src); - } + auto out(unsigned src) const + SPOT_RETURN(g_.out(src)); + auto out(unsigned src) + SPOT_RETURN(g_.out(src)); - internal::state_out - out(unsigned src) - { - return g_.out(src); - } + auto states() const + SPOT_RETURN(g_.states()); + auto states() + SPOT_RETURN(g_.states()); + + auto transitions() const + SPOT_RETURN(g_.transitions()); + auto transitions() + SPOT_RETURN(g_.transitions()); /// \brief Copy the acceptance conditions of another tgba. void copy_acceptance_conditions_of(const tgba *a)