IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
Configuration.h
Go to the documentation of this file.
1/**
2 * \file IMP/Configuration.h
3 * \brief Store a single configuration of the model.
4 *
5 * Copyright 2007-2026 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPKERNEL_CONFIGURATION_H
10#define IMPKERNEL_CONFIGURATION_H
11
12#include <IMP/kernel_config.h>
13#include <IMP/Object.h>
14#include <IMP/Pointer.h>
15#include "Model.h"
16#include <cereal/access.hpp>
17#include <cereal/types/base_class.hpp>
18
19IMPKERNEL_BEGIN_NAMESPACE
20
21//! A class to store a configuration of a model
22class IMPKERNELEXPORT Configuration : public IMP::Object {
23 mutable Pointer<Model> model_;
24 Pointer<Object> base_;
25 internal::FloatAttributeTable floats_;
26 internal::FloatsAttributeTable float_lists_;
27 internal::StringAttributeTable strings_;
28 internal::IntAttributeTable ints_;
29 internal::ObjectAttributeTable objects_;
30 internal::WeakObjectAttributeTable weak_objects_;
31 internal::IntsAttributeTable int_lists_;
32 internal::ObjectsAttributeTable object_lists_;
33 internal::ParticleAttributeTable particles_;
34 internal::ParticlesAttributeTable particle_lists_;
35 internal::Vector3DAttributeTable vector3ds_;
36 internal::Vector4DAttributeTable vector4ds_;
37 internal::SparseStringAttributeTable sparse_strings_;
38 internal::SparseIntAttributeTable sparse_ints_;
39 internal::SparseFloatAttributeTable sparse_floats_;
40 internal::SparseParticleAttributeTable sparse_particles_;
41 internal::Vector3DDerivAttributeTable vector3d_derivs_;
42 internal::Vector4DDerivAttributeTable vector4d_derivs_;
43
44 friend class cereal::access;
45 template<class Archive> void serialize(Archive &ar) {
46 ar(cereal::base_class<Object>(this));
47 if (std::is_base_of<cereal::detail::OutputArchiveBase, Archive>::value) {
48 uint32_t model_id = get_model_id();
49 ar(model_id);
50 } else {
51 uint32_t model_id;
52 ar(model_id);
53 set_model_from_id(model_id);
54 }
55 ar(base_, floats_, float_lists_, strings_, ints_, objects_, weak_objects_,
56 int_lists_, object_lists_, particles_, particle_lists_, vector3ds_,
57 vector4ds_, sparse_strings_, sparse_ints_, sparse_floats_,
58 sparse_particles_, vector3d_derivs_, vector4d_derivs_);
59 }
60 void set_model_from_id(uint32_t model_id);
61 uint32_t get_model_id() const;
62
63 public:
64 Configuration(Model *m, std::string name = "Configuration %1%");
65 //! Only store parts of the configuration that have changed from base
66 /** At the moment, this does not play well with adding and removing
67 attributes.*/
68 Configuration(Model *m, Configuration *base,
69 std::string name = "Configuration %1%");
70
71 Configuration() : Object("") {}
72
73 void load_configuration() const;
74 //! Swap the current configuration with that in the Model
75 /** This should be faster than loading (or at least not slower).
76 */
78 IMP_OBJECT_METHODS(Configuration);
79};
80
82
83IMPKERNEL_END_NAMESPACE
84
85#endif /* IMPKERNEL_CONFIGURATION_H */
Storage of a model, its restraints, constraints and particles.
A shared base class to help in debugging and things.
A nullptr-initialized pointer to an IMP Object.
A class to store a configuration of a model.
void swap_configuration()
Swap the current configuration with that in the Model.
Configuration(Model *m, Configuration *base, std::string name="Configuration %1%")
Only store parts of the configuration that have changed from base.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
Common base class for heavy weight IMP objects.
Definition Object.h:111
Object(std::string name)
Construct an object with the given name.
IMP::Vector< IMP::Pointer< Configuration > > Configurations
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a reference counted object.
Definition Pointer.h:88