boost::mixin::object_type_mutation
// In header: <boost/mixin/object_type_mutation.hpp> class object_type_mutation { public: // construct/copy/destruct object_type_mutation(); object_type_mutation(const mixin_collection *); // public member functions void set_source(const mixin_collection *); template<typename Mixin> bool is_adding() const; template<typename Mixin> bool is_removing() const; template<typename Mixin> bool source_has() const; bool is_adding(mixin_id) const; bool is_removing(mixin_id) const; bool source_has(mixin_id) const; template<typename Feature> bool is_adding(const Feature *) const; template<typename Feature> bool is_removing(const Feature *) const; template<typename Feature> bool source_implements(const Feature *) const; template<typename Mixin> void stop_adding(); template<typename Mixin> void stop_removing(); void stop_adding(mixin_id); void stop_removing(mixin_id); template<typename Feature> void stop_adding(const Feature *); template<typename Feature> void stop_removing(const Feature *); template<typename Mixin> void start_adding(); template<typename Mixin> void start_removing(); void start_adding(mixin_id); void start_removing(mixin_id); template<typename Feature> void start_removing(const Feature *); bool empty() const; void normalize(); void clear(); // private member functions void check_valid(); };
This class represents an object mutation. It is used by mutators and mutation rules.
Internally the class has two mixin_collection
objects - removing
and adding
. They represent the mixins that are supposed to be removed and added by the mutation.
Additionally another mixin collection might be present - the source. It is a pointer that may be null. If it's not, it represents the mixins of the object that currently being mutated by this mutation.
object_type_mutation
public
construct/copy/destructobject_type_mutation();Constructs an empty mutation.
object_type_mutation(const mixin_collection * src);Constructs a mutation with a specific source.
object_type_mutation
public member functionsvoid set_source(const mixin_collection * src);Sets the source of the mutation.
template<typename Mixin> bool is_adding() const;Checks if the mutation is adding a mixin.
template<typename Mixin> bool is_removing() const;Checks if the mutation is removing a mixin.
template<typename Mixin> bool source_has() const;Checks if the mutation's source has a mixin.
bool is_adding(mixin_id id) const;
bool is_removing(mixin_id id) const;
bool source_has(mixin_id id) const;
template<typename Feature> bool is_adding(const Feature * f) const;
Checks if any of the mixins that are being added by the mutation also implements a given feature.
template<typename Feature> bool is_removing(const Feature * f) const;
Checks if any of the mixins that are being removed by the mutation also implements a given feature.
template<typename Feature> bool source_implements(const Feature * f) const;Checks if the mutation's source implements a feature.
template<typename Mixin> void stop_adding();Removes a mixin from the ones being added by the mutation.
template<typename Mixin> void stop_removing();Removes a mixin from the ones being removed by the mutation.
void stop_adding(mixin_id id);
void stop_removing(mixin_id id);
template<typename Feature> void stop_adding(const Feature * f);
Removes all mixins from the ones being added by the mutation, that also implement a specific feature.
template<typename Feature> void stop_removing(const Feature * f);
Removes all mixins from the ones being removed by the mutation, that also implement a specific feature.
template<typename Mixin> void start_adding();Adds a mixin to the ones being added by the mutation.
template<typename Mixin> void start_removing();Adds a mixin to the ones being removed by the mutation.
void start_adding(mixin_id id);
void start_removing(mixin_id id);
template<typename Feature> void start_removing(const Feature * f);
Adds a feature to the mutation so that all mixins in the source, that implement a specific feature will be removed.
bool empty() const;Returns true if the mutation is empty - adds no mixins and removes no mixins.
void normalize();
Normalize the collections _adding and _removing. That is, if an element is in both, it will be removed from both.
void clear();Clears a mutation. Restores it to its initial state.