IMP  2.1.1
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-2013 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/base/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 calsses 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 \
31  save_frame() to do that. */ \
32  IMPRMFEXPORT void add_##names(RMF::NodeHandle fh, const Types& hs); \
33  /** Add a single Name object to the RMF file. \
34  \note This does not save a configuration, make \
35  sure you use \
36  save_frame() to do that. */ \
37  IMPRMFEXPORT void add_##name(RMF::FileHandle fh, Type hs); \
38  /** Create Name objects from the RMF file. \
39  \note This does not load a frame. Make sure you call \
40  IMP::rmf::load_frame() before using.*/ \
41  IMPRMFEXPORT Types create_##names cargs; \
42  /** Link Name objects with the RMF file, \
43  possibly overwriting an \
44  existing link for loading from the \
45  file. This does not alter the \
46  object, but will affect the behaviour \
47  of functions like load_frame() \
48  and save_frame(). \
49  \
50  link_custom_documentation \
51  */ \
52  IMPRMFEXPORT void link_##names(RMF::FileConstHandle fh, const Types& hs)
53 
54 // TODO: is there any good reason for the difference between InType(s)
55 // and OutType(s) - probably not, need to consolidate
56 /**
57  Define functions for adding, creating and linking
58  RMF file objects with base calsses of type InType
59 
60  \see IMP_DECLARE_LINKERS()
61 */
62 #define IMP_DEFINE_LINKERS(Name, name, names, Type, Types, create_args, \
63  create_args_pass) \
64  void add_##names(RMF::FileHandle fh, const Types& hs) { \
65  IMP::rmf::internal::add_helper<Name##SaveLink>(fh, hs); \
66  } \
67  void add_##names(RMF::NodeHandle fh, const Types& hs) { \
68  IMP::rmf::internal::add_helper<Name##SaveLink>(fh.get_file(), hs); \
69  } \
70  void add_##name(RMF::FileHandle fh, Type hs) { \
71  add_##names(fh, Types(1, hs)); \
72  } \
73  Types create_##names create_args { \
74  return IMP::rmf::internal::create_helper<Name##LoadLink, Types> \
75  create_args_pass; \
76  } \
77  void link_##names(RMF::FileConstHandle fh, const Types& hs) { \
78  IMP::rmf::internal::link_helper<Name##LoadLink>(fh, hs); \
79  }
80 
81 #endif /* IMPRMF_LINK_MACROS_H */
A nullptr-initialized pointer to an IMP Object.
Handle read/write of kernel::Model data from/to files.