#ifndef __JLANG__JOBJECTSELECTOR__ #define __JLANG__JOBJECTSELECTOR__ #include "JLang/JDefault.hh" #include "JLang/JTypeList.hh" #include "JLang/JClass.hh" /** * \author mdejong */ namespace JLANG {} namespace JPP { using namespace JLANG; } namespace JLANG { /** * Interface for selection of objects. */ template class JObjectSelector : public JDefault< JObjectSelector > { public: /** * Type definition of argument of interface method. */ typedef typename JClass::argument_type argument_type; /** * Virtual destructor. */ virtual ~JObjectSelector() {} /** * Accept object. * * \param object object * \return true if accepted; else false */ virtual bool accept(argument_type object) const { return true; } }; /** * Interface for multiple selection of objects. * * This class recursively defines the JLANG::JObjectSelector interface * for all data types by deriving from: * - JObjectSelector; and * - JObjectSelector. */ template class JObjectSelector< JTypeList > : public JDefault< JObjectSelector< JTypeList > >, public virtual JObjectSelector, public virtual JObjectSelector { public: using JDefault< JObjectSelector< JTypeList > >::getDefault; }; /** * Terminator class of recursive JObjectSelector class. */ template class JObjectSelector< JTypeList > : public virtual JObjectSelector {}; } #endif