DynaMix  1.3.7
A new take on polymorphism in C++
dynamix::object_type_mutation Class Reference

#include <object_type_mutation.hpp>

Public Member Functions

 object_type_mutation ()
 Constructs an empty mutation.
 
 object_type_mutation (const mixin_collection *src)
 Constructs a mutation with a specific source.
 
void 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
 
template<typename Feature >
bool is_removing (const Feature *f) const
 
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)
 
template<typename Feature >
void stop_removing (const Feature *f)
 
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)
 
bool empty () const
 Returns true if the mutation is empty - adds no mixins and removes no mixins.
 
void normalize ()
 
void clear ()
 Clears a mutation. Restores it to its initial state.
 

Friends

class internal::object_mutator
 

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

Member Function Documentation

template<typename Feature >
bool dynamix::object_type_mutation::is_adding ( const Feature *  f) const
inline

Checks if any of the mixins that are being added by the mutation also implements a given feature.

template<typename Feature >
bool dynamix::object_type_mutation::is_removing ( const Feature *  f) const
inline

Checks if any of the mixins that are being removed by the mutation also implements a given feature.

template<typename Feature >
void dynamix::object_type_mutation::stop_adding ( const Feature *  f)
inline

Removes all mixins from the ones being added by the mutation, that also implement a specific feature.

template<typename Feature >
void dynamix::object_type_mutation::stop_removing ( const Feature *  f)
inline

Removes all mixins from the ones being removed by the mutation, that also implement a specific feature.

template<typename Feature >
void dynamix::object_type_mutation::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.

void dynamix::object_type_mutation::normalize ( )

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


The documentation for this class was generated from the following file: