IMP  2.1.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-2013 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  public:
29 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
30  void validate_inputs() const;
31  void validate_outputs() const;
32 #endif
33 
34  ModelObject(kernel::Model *m, std::string name);
35  ~ModelObject();
36 
37  Model *get_model() const { return model_; }
38  /** get_has_dependencies() must be true. */
39  ModelObjectsTemp get_inputs() const;
40  /** get_has_dependencies() must be true. */
41  ModelObjectsTemp get_outputs() const;
42  /** Get the interacting sets induce by this ModelObject. That is,
43  the particles in each ModelObjectsTemp in the list have some
44  sort of computed relation with one another and none with
45  disjoint other sets in the list.*/
46  ModelObjectsTemps get_interactions() const;
47 
48  //! Return whether this object has dependencies computed
49  bool get_has_dependencies() const;
50 
51  /** Either invalidate the dependncies or ensure they are correct.*/
52  void set_has_dependencies(bool tf);
53 
54  /** Compute the required score states. */
55  void set_has_required_score_states(bool tf);
56 
57  /** Return whether score states are computed.*/
58  bool get_has_required_score_states() const;
59 
60  /** Get the score states that are ancestors of this in the dependency graph.
61  */
63 
64  protected:
65  // virtual void do_destroy() IMP_OVERRIDE {set_has_dependencies(false);}
66  /** Called when set_has_required_score_states() is called.*/
68  /** Get any Particle, Container or other ModelObjects read by
69  this during evaluation. If you read everything in a container,
70  you can just return that container. */
71  virtual ModelObjectsTemp do_get_inputs() const = 0;
72  /** Get any Particle, Container or other ModelObjects changed by
73  this during evaluation. This is only useful for ScoreStates,
74  at the moment.*/
75  virtual ModelObjectsTemp do_get_outputs() const = 0;
76  /** Override if this if not all inputs interact with all outputs. This is
77  rarely something you want to do.*/
78  virtual ModelObjectsTemps do_get_interactions() const;
79 
80  public:
81  /** \deprecated_at{2.1} Use the constructor that takes a Model. */
82  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
83  ModelObject(std::string name);
84  /** \deprecated_at{2.1} Use the constructor that takes a Model. */
85  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
86  virtual void set_model(kernel::Model *m);
87  /** \deprecated_at{2.1} Should always be true. */
88  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
89  bool get_is_part_of_model() const;
90  /** \deprecated_at{2.1} As it should always be part of a model. */
91  IMPKERNEL_DEPRECATED_METHOD_DECL(2.1)
92  virtual void do_set_model(kernel::Model *) {}
93 };
94 
95 IMPKERNEL_END_NAMESPACE
96 
97 #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.
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.