OEHasRole¶
class OEHasRole : public OESystem::OEUnaryPredicate<OERoleSet>
This class represents OEHasRole, a functor for objects inherited from OERoleSet that identifies those containing a specified role (OERole).
OEHasRole pred(role);
if (pred(frag))
std::cout << "has role: " << role.GetName() << std::endl;
The following methods are publicly inherited from OEUnaryPredicate:
The following methods are publicly inherited from OEUnaryFunction:
Constructors¶
OEHasRole(const OERole &role)
Copy constructor.
OEHasRole(const std::string &name)
Convenience constructor allowing the predicate to be constructed from a role name string.
operator()¶
bool operator()(const OERoleSet &myObject) const
Returns true
if the OERoleSet
contains
an OERole
that
matches the value used in the OEHasRole::Constructors
.
CreateCopy¶
OESystem::OEUnaryFunction<OERoleSet , bool> *CreateCopy() const
Deep copy constructor that returns a copy of the object. The memory for the returned OEHasRole object is dynamically allocated and owned by the caller.
The returned copy should be managed to ensure
it is deallocated using C++
delete
operator in order to prevent a memory leak.