PrevUpHomeNext

Class object_type_mutation

boost::mixin::object_type_mutation

Synopsis

// 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();
};

Description

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/destruct

  1. object_type_mutation();
    Constructs an empty mutation.
  2. object_type_mutation(const mixin_collection * src);
    Constructs a mutation with a specific source.

object_type_mutation public member functions

  1. void set_source(const mixin_collection * src);
    Sets the source of the mutation.
  2. template<typename Mixin> bool is_adding() const;
    Checks if the mutation is adding a mixin.
  3. template<typename Mixin> bool is_removing() const;
    Checks if the mutation is removing a mixin.
  4. template<typename Mixin> bool source_has() const;
    Checks if the mutation's source has a mixin.
  5. bool is_adding(mixin_id id) const;
  6. bool is_removing(mixin_id id) const;
  7. bool source_has(mixin_id id) const;
  8. 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.

  9. 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.

  10. template<typename Feature> bool source_implements(const Feature * f) const;
    Checks if the mutation's source implements a feature.
  11. template<typename Mixin> void stop_adding();
    Removes a mixin from the ones being added by the mutation.
  12. template<typename Mixin> void stop_removing();
    Removes a mixin from the ones being removed by the mutation.
  13. void stop_adding(mixin_id id);
  14. void stop_removing(mixin_id id);
  15. 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.

  16. 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.

  17. template<typename Mixin> void start_adding();
    Adds a mixin to the ones being added by the mutation.
  18. template<typename Mixin> void start_removing();
    Adds a mixin to the ones being removed by the mutation.
  19. void start_adding(mixin_id id);
  20. void start_removing(mixin_id id);
  21. 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.

  22. bool empty() const;
    Returns true if the mutation is empty - adds no mixins and removes no mixins.
  23. void normalize();

    Normalize the collections _adding and _removing. That is, if an element is in both, it will be removed from both.

  24. void clear();
    Clears a mutation. Restores it to its initial state.

object_type_mutation private member functions

  1. void check_valid();

PrevUpHomeNext