This class helps in implementing Movers by allowing changes to be easily rolled back. It maintains a list of particles and a list of attributes. All changes to the product of those two lists will be rolled back when reject_move() is called.
See NormalMover for a simple example using this class.
Public Member Functions | |
virtual void | accept_move () |
SingletonContainer * | get_container () const |
virtual void | propose_move (Float f) |
virtual void | reject_move () |
Methods to manipulate the set of controlled attributes | |
Each of the attributes whose FloatKey or IntKey is added to the list below is controlled by the MoverBase in each particle in the container. | |
unsigned int | add_int_key (IntKey obj) |
void | add_int_keys (const IntKeys &obj) |
void | clear_int_keys () |
bool | get_has_int_keys () const |
return true if there are any objects in the container | |
IntKey | get_int_key (unsigned int i) const |
unsigned int | get_number_of_int_keys () const |
IntKeyConstIterator | int_keys_begin () const |
IntKeyIterator | int_keys_begin () |
IntKeyConstIterator | int_keys_end () const |
IntKeyIterator | int_keys_end () |
void | remove_int_key (IntKey d) |
Remove any occurences of d from the container. | |
void | remove_int_keys (const IntKeys &d) |
Remove any occurences of each item in d. | |
template<class F > | |
void | remove_int_keys_if (const F &f) |
Remove any occurrences for which f is true. | |
void | reserve_int_keys (unsigned int sz) |
void | set_int_keys (const IntKeys &ps) |
unsigned int | add_float_key (FloatKey obj) |
void | add_float_keys (const FloatKeys &obj) |
void | clear_float_keys () |
FloatKeyConstIterator | float_keys_begin () const |
FloatKeyIterator | float_keys_begin () |
FloatKeyConstIterator | float_keys_end () const |
FloatKeyIterator | float_keys_end () |
FloatKey | get_float_key (unsigned int i) const |
bool | get_has_float_keys () const |
return true if there are any objects in the container | |
unsigned int | get_number_of_float_keys () const |
void | remove_float_key (FloatKey d) |
Remove any occurences of d from the container. | |
void | remove_float_keys (const FloatKeys &d) |
Remove any occurences of each item in d. | |
template<class F > | |
void | remove_float_keys_if (const F &f) |
Remove any occurrences for which f is true. | |
void | reserve_float_keys (unsigned int sz) |
void | set_float_keys (const FloatKeys &ps) |
Protected Member Functions | |
virtual void | generate_move (Float f)=0 |
implement this method to propose a move | |
Float | get_float (unsigned int i, unsigned int j) const |
Get the value of a controlled attribute. | |
Int | get_int (unsigned int i, unsigned int j) const |
Get an int attribute value. | |
MoverBase (SingletonContainer *sc) | |
void | propose_value (unsigned int i, unsigned int j, Int t) |
Propose a value. | |
void | propose_value (unsigned int i, unsigned int j, Float t) |
Propose a value. | |
Friends | |
template<class T > | |
void | IMP::internal::unref (T *) |
unsigned int IMP::core::MoverBase::add_float_key | ( | FloatKey | obj | ) | [protected] |
void IMP::core::MoverBase::add_float_keys | ( | const FloatKeys & | obj | ) | [protected] |
Add several objects to the container. They are not necessarily added at the end.
unsigned int IMP::core::MoverBase::add_int_key | ( | IntKey | obj | ) |
void IMP::core::MoverBase::add_int_keys | ( | const IntKeys & | obj | ) |
Add several objects to the container. They are not necessarily added at the end.
virtual void IMP::core::MoverBase::generate_move | ( | Float | f | ) | [protected, pure virtual] |
implement this method to propose a move
See NormalMover for a simple example.
Float IMP::core::MoverBase::get_float | ( | unsigned int | i, | |
unsigned int | j | |||
) | const [protected] |
Get the value of a controlled attribute.
[in] | i | The index of the particle. |
[in] | j | The index of the attribute. |
FloatKey IMP::core::MoverBase::get_float_key | ( | unsigned int | i | ) | const [protected] |
Get the object refered to by the index
IndexException | in Python if the index is out of range |
Int IMP::core::MoverBase::get_int | ( | unsigned int | i, | |
unsigned int | j | |||
) | const [protected] |
Get an int attribute value.
[in] | i | The index of the particle. |
[in] | j | The index of the attribute. |
IntKey IMP::core::MoverBase::get_int_key | ( | unsigned int | i | ) | const |
Get the object refered to by the index
IndexException | in Python if the index is out of range |
virtual void IMP::core::MoverBase::propose_move | ( | Float | f | ) | [virtual] |
This sets everything up and then calls the generate_move method.
Implements IMP::core::Mover.
void IMP::core::MoverBase::propose_value | ( | unsigned int | i, | |
unsigned int | j, | |||
Int | t | |||
) | [protected] |
Propose a value.
[in] | i | The index of the particle. |
[in] | j | The index of the key |
[in] | t | The value to propose |
void IMP::core::MoverBase::propose_value | ( | unsigned int | i, | |
unsigned int | j, | |||
Float | t | |||
) | [protected] |
Propose a value.
[in] | i | The index of the particle. |
[in] | j | The index of the key |
[in] | t | The value to propose |
void IMP::core::MoverBase::set_float_keys | ( | const FloatKeys & | ps | ) | [protected] |
Set the contents of the container to ps removing all its current contents.
void IMP::core::MoverBase::set_int_keys | ( | const IntKeys & | ps | ) |
Set the contents of the container to ps removing all its current contents.