00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: predicate.h,v 1.24 2005/10/23 12:02:19 oliver Exp $ 00005 // 00006 00007 #ifndef BALL_KERNEL_PREDICATE_H 00008 #define BALL_KERNEL_PREDICATE_H 00009 00010 #ifndef BALL_COMMON_RTTI_H 00011 # include <BALL/COMMON/rtti.h> 00012 #endif 00013 00014 #ifndef BALL_CONCEPT_PREDICATE_H 00015 # include <BALL/CONCEPT/predicate.h> 00016 #endif 00017 00018 #ifndef BALL_CONCEPT_COMPOSITE_H 00019 # include <BALL/CONCEPT/composite.h> 00020 #endif 00021 00022 namespace BALL 00023 { 00048 00049 00050 #ifndef BALL_KERNEL_PREDICATE_TYPE 00051 #define BALL_KERNEL_PREDICATE_TYPE 00052 typedef UnaryPredicate<Composite> KernelPredicateType; 00053 #endif 00054 00056 template <class T> 00057 class KernelPredicate 00058 : public UnaryPredicate<Composite> 00059 { 00060 public: 00061 00063 virtual bool operator () (const Composite& composite) const; 00064 virtual ~KernelPredicate() {} 00065 }; 00066 00067 template <class T> 00068 bool KernelPredicate<T>::operator () (const Composite& composite) const 00069 { 00070 return RTTI::isKindOf<T>(composite); 00071 } 00072 00074 00075 } // namespace BALL 00076 00077 00078 #endif // BALL_KERNEL_PREDICATE_H