Leosac  0.8.0
Open Source Access Control
IVisitable.hpp File Reference
#include "tools/Visitor.hpp"
#include <cassert>
+ Include dependency graph for IVisitable.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Leosac::Tools::IVisitable
 Base class to make an object visitable. More...
 

Namespaces

 Leosac
 This is the header file for a generated source file, GitSHA1.cpp.
 
 Leosac::Tools
 

Macros

#define MAKE_VISITABLE()
 Provide the object calling this macro in its definition with an accept() method that will accept BaseVisitor client. More...
 
#define MAKE_VISITABLE_FALLBACK(PARENT_CLASS)
 Similar to the MAKE_VISITABLE() macro, with 1 major difference. More...
 

Macro Definition Documentation

◆ MAKE_VISITABLE

#define MAKE_VISITABLE ( )
Value:
virtual void accept(::Leosac::Tools::BaseVisitor &v) override \
{ \
visitor_dispatch(*this, v, true); \
} \
virtual void accept(::Leosac::Tools::BaseVisitor &v) const override \
{ \
visitor_dispatch(*this, v, true); \
}

Provide the object calling this macro in its definition with an accept() method that will accept BaseVisitor client.

Those visitors will be dispatched accordingly by the visitor_dispatch() static method.

Definition at line 85 of file IVisitable.hpp.

◆ MAKE_VISITABLE_FALLBACK

#define MAKE_VISITABLE_FALLBACK (   PARENT_CLASS)
Value:
virtual void accept(::Leosac::Tools::BaseVisitor &v) override \
{ \
if (!visitor_dispatch(*this, v, false)) \
{ \
PARENT_CLASS::accept(v); \
} \
} \
virtual void accept(::Leosac::Tools::BaseVisitor &v) const override \
{ \
if (!visitor_dispatch(*this, v, false)) \
{ \
PARENT_CLASS::accept(v); \
} \
}

Similar to the MAKE_VISITABLE() macro, with 1 major difference.

If the visitor object is not able to visit an object of type (*this), then this->accept() will call PARENT_CLASS->accept() to try again.

This allows to us to visit an object mid hierarchy instead of having to handle each concrete implementation.

Definition at line 104 of file IVisitable.hpp.

Leosac::Tools::BaseVisitor
Base class for visitor, should not be used directly.
Definition: Visitor.hpp:37