IMP  2.3.0
The Integrative Modeling Platform
kernel/ModelObject.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/ModelObject.h \brief Single variable function.
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  */
6 
7 #ifndef IMPKERNEL_MODEL_OBJECT_H
8 #define IMPKERNEL_MODEL_OBJECT_H
9 
10 #include <IMP/kernel/kernel_config.h>
11 #include "base_types.h"
14 
15 IMPKERNEL_BEGIN_NAMESPACE
16 
17 class Model;
18 
19 /** These objects are associated with a particular Model
20  and have a callback that is called whenever the dependencies
21  in the model change. This allows them to update internal state
22  when that occurs.
23  */
24 class IMPKERNELEXPORT ModelObject : public base::Object {
25  friend class Model;
27 
28  // for cleanup
29  void set_model(Model *m);
30 
31  public:
32 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
33  void validate_inputs() const;
34  void validate_outputs() const;
35 #endif
36 
37  ModelObject(kernel::Model *m, std::string name);
38  ~ModelObject();
39 
40  Model *get_model() const { return model_; }
41  /** get_has_dependencies() must be true. */
42  ModelObjectsTemp get_inputs() const;
43  /** get_has_dependencies() must be true. */
44  ModelObjectsTemp get_outputs() const;
45  //! Get the interacting sets induced by this ModelObject.
46  /** That is, the particles in each ModelObjectsTemp in the list have some
47  sort of computed relation with one another and none with
48  disjoint other sets in the list. */
49  ModelObjectsTemps get_interactions() const;
50 
51  //! Return whether this object has dependencies computed
52  bool get_has_dependencies() const;
53 
54  //! Either invalidate the dependencies or ensure they are correct.
55  void set_has_dependencies(bool tf);
56 
57  //! Compute the required score states.
58  void set_has_required_score_states(bool tf);
59 
60  //! Return whether score states are computed.
61  bool get_has_required_score_states() const;
62 
63  //! Get the score states that are ancestors of this in the dependency graph.
65 
66  protected:
67  // virtual void do_destroy() IMP_OVERRIDE {set_has_dependencies(false);}
68  /** Called when set_has_required_score_states() is called.*/
70  /** Get any Particle, Container or other ModelObjects read by
71  this during evaluation. If you read everything in a container,
72  you can just return that container. */
73  virtual ModelObjectsTemp do_get_inputs() const = 0;
74  /** Get any Particle, Container or other ModelObjects changed by
75  this during evaluation. This is only useful for ScoreStates,
76  at the moment.*/
77  virtual ModelObjectsTemp do_get_outputs() const = 0;
78  /** Override if this if not all inputs interact with all outputs. This is
79  rarely something you want to do.*/
80  virtual ModelObjectsTemps do_get_interactions() const;
81 };
82 
83 IMPKERNEL_END_NAMESPACE
84 
85 #endif /* IMPKERNEL_MODEL_OBJECT_H */
IMP::kernel::ModelObject ModelObject
Various general useful macros for IMP.
virtual void handle_set_has_required_score_states(bool)
Basic types used by IMP.
IMP::kernel::Model Model
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Definition: Object.h:106
ScoreStatesTemp get_required_score_states(ModelObject *p, const ModelObjectsTemp &all, const DependencyGraph &dg, const DependencyGraphVertexIndex &index)
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:73