IMP  2.2.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 induce by this ModelObject. That is,
46  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 dependncies 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.
64  */
66 
67  protected:
68  // virtual void do_destroy() IMP_OVERRIDE {set_has_dependencies(false);}
69  /** Called when set_has_required_score_states() is called.*/
71  /** Get any Particle, Container or other ModelObjects read by
72  this during evaluation. If you read everything in a container,
73  you can just return that container. */
74  virtual ModelObjectsTemp do_get_inputs() const = 0;
75  /** Get any Particle, Container or other ModelObjects changed by
76  this during evaluation. This is only useful for ScoreStates,
77  at the moment.*/
78  virtual ModelObjectsTemp do_get_outputs() const = 0;
79  /** Override if this if not all inputs interact with all outputs. This is
80  rarely something you want to do.*/
81  virtual ModelObjectsTemps do_get_interactions() const;
82 };
83 
84 IMPKERNEL_END_NAMESPACE
85 
86 #endif /* IMPKERNEL_MODEL_OBJECT_H */
IMP::kernel::ModelObject ModelObject
virtual void handle_set_has_required_score_states(bool)
Basic types used by IMP.
IMP::kernel::Model Model
Various general useful macros for IMP.
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Definition: base/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:72