IMP logo
IMP Reference Guide  2.13.0
The Integrative Modeling Platform
link_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/rmf/link_macros.h
3  * \brief macros for display classes
4  *
5  * Copyright 2007-2020 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPRMF_LINK_MACROS_H
9 #define IMPRMF_LINK_MACROS_H
10 #include "links.h"
11 #include "associations.h"
12 #include "internal/link_helpers.h"
13 #include <IMP/Pointer.h>
14 #include <RMF/FileHandle.h>
15 
16 // TODO: is there any good reason for the difference between InType(s)
17 // and OutType(s) - probably not, need to consolidate
18 /**
19  declares functions for adding, creating and linking
20  RMF file objects with base classes of type InType
21 */
22 #define IMP_DECLARE_LINKERS(Name, name, names, Type, Types, cargs, \
23  link_custom_documentation) \
24  /** Add objects to the file.
25  \note This does not save a configuration; make sure you use
26  save_frame() to do that. */ \
27  IMPRMFEXPORT void add_##names(RMF::FileHandle fh, const Types& hs); \
28  /** Add objects to the file under the specified node.
29  \note This does not save a configuration; make sure you
30  use save_frame() to do that. */ \
31  IMPRMFEXPORT void add_##names(RMF::NodeHandle fh, const Types& hs); \
32  /** Add a single Name object to the RMF file.
33  \note This does not save a configuration; make sure you
34  use save_frame() to do that. */ \
35  IMPRMFEXPORT void add_##name(RMF::FileHandle fh, Type hs); \
36  /** Create Name objects from the RMF file.
37  \note This does not load a frame. Make sure you call
38  IMP::rmf::load_frame() before using.*/ \
39  IMPRMFEXPORT Types create_##names cargs; \
40  /** Link Name objects with the RMF file,
41  possibly overwriting an
42  existing link for loading from the
43  file. This does not alter the
44  object, but will affect the behavior
45  of functions like load_frame()
46  and save_frame().
47 
48  link_custom_documentation
49  */ \
50  IMPRMFEXPORT void link_##names(RMF::FileConstHandle fh, const Types& hs)
51 
52 // TODO: is there any good reason for the difference between InType(s)
53 // and OutType(s) - probably not, need to consolidate
54 /**
55  Define functions for adding, creating and linking
56  RMF file objects with base classes of type InType
57 
58  \see IMP_DECLARE_LINKERS()
59 */
60 #define IMP_DEFINE_LINKERS(Name, name, names, Type, Types, create_args, \
61  create_args_pass) \
62  void add_##names(RMF::FileHandle fh, const Types& hs) { \
63  IMP::rmf::internal::add_helper<Name##SaveLink>(fh, hs); \
64  } \
65  void add_##names(RMF::NodeHandle nh, const Types& hs) { \
66  IMP::rmf::internal::add_helper<Name##SaveLink>(nh, hs); \
67  } \
68  void add_##name(RMF::FileHandle fh, Type hs) { \
69  add_##names(fh, Types(1, hs)); \
70  } \
71  Types create_##names create_args { \
72  return IMP::rmf::internal::create_helper<Name##LoadLink, Types> \
73  create_args_pass; \
74  } \
75  void link_##names(RMF::FileConstHandle fh, const Types& hs) { \
76  IMP::rmf::internal::link_helper<Name##LoadLink>(fh, hs); \
77  }
78 
79 #endif /* IMPRMF_LINK_MACROS_H */
Track associations between an RMF file and native objects.
A nullptr-initialized pointer to an IMP Object.