IMP logo
IMP Reference Guide  develop.27926d84dc,2024/04/18
The Integrative Modeling Platform
ExampleSingletonModifier.h
Go to the documentation of this file.
1 /**
2  * \file IMP/example/ExampleSingletonModifier.h
3  * \brief A singleton modifier which wraps an attribute into a
4  * given range.
5  *
6  * Copyright 2007-2022 IMP Inventors. All rights reserved.
7  */
8 
9 #ifndef IMPEXAMPLE_EXAMPLE_SINGLETON_MODIFIER_H
10 #define IMPEXAMPLE_EXAMPLE_SINGLETON_MODIFIER_H
11 
12 #include <IMP/example/example_config.h>
13 #include <IMP/SingletonModifier.h>
15 #include <IMP/singleton_macros.h>
16 #include <cereal/access.hpp>
17 #include <cereal/types/base_class.hpp>
18 
19 IMPEXAMPLE_BEGIN_NAMESPACE
20 
21 //! An example singleton modifier
22 /** A simple singleton modifier which ensures the x,y,z coordinates
23  stay in a box by wrapping them.
24 
25  Such a class could be coupled with an IMP::core::SingletonConstraint
26  or IMP::container::SingletonsConstraint to keep a set of particles
27  in a box.
28 
29  \include range_restriction.py
30 
31  The source code is as follows:
32  \include ExampleSingletonModifier.h
33  \include ExampleSingletonModifier.cpp
34  */
35 class IMPEXAMPLEEXPORT ExampleSingletonModifier : public SingletonModifier {
37 
38  friend class cereal::access;
39  template<class Archive> void serialize(Archive &ar) {
40  ar(cereal::base_class<SingletonModifier>(this), bb_);
41  }
43 
44  public:
47 
48  // note, Doxygen wants a semicolon at the end of macro lines
49  virtual void apply_index(Model *m, ParticleIndex p) const
50  override;
52  Model *m, const ParticleIndexes &pis) const override;
54  Model *m, const ParticleIndexes &pis) const override;
57 };
58 
59 IMPEXAMPLE_END_NAMESPACE
60 
61 #endif /* IMPEXAMPLE_EXAMPLE_SINGLETON_MODIFIER_H */
A base class for modifiers of ParticlesTemp.
A Modifier on ParticlesTemp.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
Macros for various classes.
virtual ModelObjectsTemp do_get_outputs(Model *m, const ParticleIndexes &pis) const =0
Overload this method to specify the outputs.
A more IMP-like version of the std::vector.
Definition: Vector.h:50
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
#define IMP_SINGLETON_MODIFIER_METHODS(Name)
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
Definition: object_macros.h:95
A bounding box in D dimensions.
virtual ModelObjectsTemp do_get_inputs(Model *m, const ParticleIndexes &pis) const =0
Overload this method to specify the inputs.
virtual void apply_index(Model *m, ParticleIndex v) const =0