/usr/include/BALL/KERNEL/predicate.h is in libball1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: predicate.h,v 1.24 2005/10/23 12:02:19 oliver Exp $
//
#ifndef BALL_KERNEL_PREDICATE_H
#define BALL_KERNEL_PREDICATE_H
#ifndef BALL_COMMON_RTTI_H
# include <BALL/COMMON/rtti.h>
#endif
#ifndef BALL_CONCEPT_PREDICATE_H
# include <BALL/CONCEPT/predicate.h>
#endif
#ifndef BALL_CONCEPT_COMPOSITE_H
# include <BALL/CONCEPT/composite.h>
#endif
namespace BALL
{
class Atom;
class Molecule;
class Protein;
class Fragment;
class Residue;
class Chain;
/** @name KernelPredicates Kernel predicates
This chapter describes a set of unary predicates acting on \link Composite \endlink instances, that
can be used to identify the class type of a composite at runtime. \par
This predicates are functionally similar to the \link RTTI:isKindOf RTTI:isKindOf \endlink function.
They decide whether a given composite is an instance of a certain class (or of
a class derived thereof). For instance, the application of a \link MoleculePredicate MoleculePredicate \endlink
to a composite will yield <b>true</b>, if the given composite was an instance of \link Molecule Molecule \endlink
(or \link Protein Protein \endlink , as Protein is derived from Molecule). Otherwise false is returned. \par
Each KernelPredicate possesses three methods:
-<b>operator (const Composite&)</b>
-<b>operator (const Composite&) const</b>
The two operators are functionally identical (two methods are needed, because the class
is derived from TUnaryPredicate and we want to make sure both methods are overwritten).
<b>operator()</b> returns true, if the given composite is a kind of the class corresponding
to the respective predicate, false otherwise. \par
@see UnaryPredicate
@see RTTI
\ingroup Predicates
*/
//@{
#ifndef BALL_KERNEL_PREDICATE_TYPE
#define BALL_KERNEL_PREDICATE_TYPE
typedef UnaryPredicate<Composite> KernelPredicateType;
#endif
/// Kernel predicate class
template <class T>
class KernelPredicate
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Atom>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Molecule>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Protein>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Fragment>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Residue>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
template <>
class KernelPredicate<Chain>
: public UnaryPredicate<Composite>
{
public:
/// Constant virtual RTTI evaluation operator
virtual bool operator () (const Composite& composite) const;
virtual ~KernelPredicate() {}
};
inline bool KernelPredicate<Atom>::operator () (const Composite& composite) const
{
return composite.isAtom();
}
inline bool KernelPredicate<Molecule>::operator () (const Composite& composite) const
{
return composite.isMolecule();
}
inline bool KernelPredicate<Protein>::operator () (const Composite& composite) const
{
return composite.isProtein();
}
inline bool KernelPredicate<Fragment>::operator () (const Composite& composite) const
{
return composite.isFragment();
}
inline bool KernelPredicate<Residue>::operator () (const Composite& composite) const
{
return composite.isResidue();
}
inline bool KernelPredicate<Chain>::operator () (const Composite& composite) const
{
return composite.isChain();
}
template <class T>
bool KernelPredicate<T>::operator () (const Composite& composite) const
{
return RTTI::isKindOf<T>(&composite);
}
//@}
} // namespace BALL
#endif // BALL_KERNEL_PREDICATE_H
|