IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
VersionInfo.h
Go to the documentation of this file.
1/**
2 * \file IMP/VersionInfo.h \brief Version and authorship of IMP objects.
3 *
4 * Copyright 2007-2022 IMP Inventors. All rights reserved.
5 *
6 */
7
8#ifndef IMPKERNEL_VERSION_INFO_H
9#define IMPKERNEL_VERSION_INFO_H
10
11#include <IMP/kernel_config.h>
12#include "exception.h"
13#include "comparison_macros.h"
14#include "check_macros.h"
15#include "showable_macros.h"
16#include "value_macros.h"
17#include "Value.h"
18#include <cereal/access.hpp>
19#include <iostream>
20
21IMPKERNEL_BEGIN_NAMESPACE
22
23//! Version and module information for Objects
24/** All IMP::Object -derived objects have a method
25 IMP::Object::get_version_info() returning such an object. The
26 version info allows one to determine the module and version of
27 all restraints used to help creating reproducible results.
28 */
29class IMPKERNELEXPORT VersionInfo : public Value {
30 public:
31 //! Create a VersionInfo object with the given module and version.
32 VersionInfo(std::string module, std::string version);
33
34 VersionInfo() {}
35
36 std::string get_module() const { return module_; }
37
38 std::string get_version() const { return version_; }
39 IMP_SHOWABLE_INLINE(VersionInfo, {
40 IMP_USAGE_CHECK(!module_.empty(),
41 "Attempting to use uninitialized version info");
42 out << module_ << " " << version_;
43 });
44 IMP_COMPARISONS_2(VersionInfo, module_, version_);
45
46 private:
47 std::string module_, version_;
48 friend class cereal::access;
49
50 template<class Archive> void serialize(Archive &ar) {
51 ar(module_, version_);
52 }
53};
55
56IMPKERNEL_END_NAMESPACE
57
58#endif /* IMPKERNEL_VERSION_INFO_H */
Base class for a simple primitive-like type.
Helper macros for throwing and handling exceptions.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Version and module information for Objects.
Definition VersionInfo.h:29
VersionInfo(std::string module, std::string version)
Create a VersionInfo object with the given module and version.
Helper macros for implementing comparisons of IMP objects.
#define IMP_COMPARISONS_2(Name, f0, f1)
Implement comparison in a class using field as the variable to compare.
Exception definitions and assertions.
IMP::Vector< VersionInfo > VersionInfos
Definition VersionInfo.h:54
Macros to help with objects that can be printed to a stream.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Macros to help in implementing Value objects.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.