IMP logo
IMP Reference Guide  2.20.0
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 
21 IMPKERNEL_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  */
29 class 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_; }
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 
56 IMPKERNEL_END_NAMESPACE
57 
58 #endif /* IMPKERNEL_VERSION_INFO_H */
#define IMP_COMPARISONS_2(Name, f0, f1)
Implement comparison in a class using field as the variable to compare.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Helper macros for implementing comparisons of IMP objects.
Exception definitions and assertions.
A more IMP-like version of the std::vector.
Definition: Vector.h:42
Base class for a simple primitive-like type.
Definition: Value.h:23
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
Version and module information for Objects.
Definition: VersionInfo.h:29
Helper macros for throwing and handling exceptions.
Base class for a simple primitive-like type.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
Macros to help in implementing Value objects.
Macros to help with objects that can be printed to a stream.