OEIdxSelected

template<class Arg>
class OEIdxSelected : public OESystem::OEUnaryPredicate<Arg>

This class represents OEIdxSelected, a template functor that identifies objects which provide a GetIdx method and have been selected by index in the boolean array or vector or OEBitVector used to initialize the class.

The following methods are publicly inherited from OEUnaryPredicate:

operator()

CreateCopy

CreatePredicateCopy

The following methods are publicly inherited from OEUnaryFunction:

operator()

CreateCopy

The following specializations exist for this template:

Specialized Functor

Definition

OEAtomIdxSelected

OEIdxSelected <OEAtomBase>

OEBondIdxSelected

OEIdxSelected <OEBondBase>

OEConfIdxSelected

OEIdxSelected <OEConfBase>

Constructors

OEIdxSelected(const OESystem::OEBitVector &bv)
OEIdxSelected(const std::vector<bool> &vb)
OEIdxSelected(const bool *ap, unsigned int sz)
OEIdxSelected(const bool *ap)

Construct the functor from an OEBitVector, vector<bool> or boolean array (call it s) where the selection state of the object with internal index i is stored at s[i] (e.g. bv.SetBitOn(atom.GetIdx())). The caller is responsible for making sure that the input OEBitVector, vector<bool> or array is sufficient size to refer to the maximum index value of the objects it will be applied to.

If only const bool *ap is supplied to the constructor, the functor continues to accesses the boolean array by its pointer. In that case, the caller is responsible for making certain that it is not be deleted before this functor is called. Because of this, it is recommended that you pass in the array size as well.

If other arguments are supplied to the constructor, the selection states will be copied into an internal representation and the OEBitVector, vector<bool> or array can be deleted before the functor is called.

operator()

bool operator()(const Arg &a) const

Returns true, if the state of the array, vector or OEBitVector used to construct the functor at the index returned by the Arg.GetIdx() method is true.

CreateCopy

OETYPENAME OESystem::OEUnaryFunction<Arg, bool> *CreateCopy() const

Deep copy constructor that returns a copy of the object. The memory for the returned OEIdxSelected object is dynamically allocated and owned by the caller.

The returned copy should be deallocated using C++ delete operator in order to prevent a memory leak.