DefaultPolicy - GerdHirsch/Cpp-VisitorFrameworkCyclicAcyclic GitHub Wiki
If you've choosen BaseKind::Default, the DefaultPolicy is used to implement the
default methods for visit(..).
There are some DefaultPolicies defined in DefaultPolicy.h
namespace VisitorFramework{
struct EmptyLoggingPolicy{
template<class Visitable, class Visitor>
static void logNotAccepted(Visitable const& visitable, Visitor const& visitor){/*empty*/}
//is used in default visit(..) of a Visitor
template<class Visitable, class Visitor>
static void logNotVisited(Visitable const& visitable, Visitor const& visitor){}
template<class Visitable, class Visitor>
static void logAccepted(Visitable const& visitable, Visitor const& visitor){}
template<class Visitable, class Visitor>
static void logInvalidVisitable(Visitable const& visitable, Visitor const& visitor){}
};
struct StdOutLoggingPolicy{ /* method signatures as above */ };
}
logAccepted is called from Visitable::accept,
logNotAccepted from an Acyclic::Visitable::accept, if the Visitor don't implement the type specific VisitorInterface.
logNotVisited is called from the default Visitor::visit method, if a visitor don't implement a visit method with the matching signature.
logInvalidVisitable is called from accept of an Adapter with a StoragePolicy Weakpointer, if the Weakpointer is expired.
You can define your own DefaultPolicy and delegate the function calls to Element specific Functions, choosen at compile-time, cause the concrete type is known inside of the function.