IMP logo
IMP Reference Guide  2.6.1
The Integrative Modeling Platform
links.h
Go to the documentation of this file.
1 /**
2  * \file IMP/rmf/links.h
3  * \brief Handle read/write of Model data from/to files.
4  *
5  * Copyright 2007-2016 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPRMF_LINKS_H
10 #define IMPRMF_LINKS_H
11 
12 #include <IMP/rmf/rmf_config.h>
13 #include <RMF/NodeHandle.h>
14 #include <RMF/FileHandle.h>
15 #include <IMP/Object.h>
16 #include <IMP/Pointer.h>
17 #include <IMP/object_macros.h>
18 #include <IMP/log_macros.h>
19 
20 IMPRMF_BEGIN_NAMESPACE
21 
22 class SaveLink;
23 class LoadLink;
25 
27 
28 /** Manage a link between an \imp object and a part
29  of the RMF file. This allows conformations to be
30  loaded flexibly.
31 
32  LoadLinks must not save any handles to RMF objects.
33 
34  \unstable{LoadLink}
35 */
36 class IMPRMFEXPORT LoadLink : public Object {
37  bool frame_loaded_;
38 
39  protected:
40  virtual void do_load(RMF::FileConstHandle fh) = 0;
41  LoadLink(std::string name);
42 
43  public:
44  void load(RMF::FileConstHandle fh) {
46  set_was_used(true);
47  do_load(fh);
48  frame_loaded_ = true;
49  }
51 };
52 /** Manage a link between an \imp object and a part
53  of the RMF file. This allows conformations to be
54  saved flexibly.
55 
56  SaveLinks must not save any handles to RMF objects.
57 
58  \unstable{SaveLink}
59 */
60 class IMPRMFEXPORT SaveLink : public Object {
61  bool frame_saved_;
62 
63  protected:
64  virtual void do_save(RMF::FileHandle hf) = 0;
65  SaveLink(std::string name);
66 
67  public:
68  void save(RMF::FileHandle fh) {
70  set_was_used(true);
71  do_save(fh);
72  frame_saved_ = true;
73  }
75 };
76 
77 IMPRMF_END_NAMESPACE
78 
79 #endif /* IMPRMF_LINKS_H */
Various general useful macros for IMP.
#define IMP_OBJECT_LOG
Set the log level to the object's log level.
Definition: log_macros.h:297
Common base class for heavy weight IMP objects.
Definition: Object.h:106
Logging and error reporting support.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Definition: object_macros.h:42
A nullptr-initialized pointer to an IMP Object.
A shared base class to help in debugging and things.
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
void set_was_used(bool tf) const