IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
associations.h
Go to the documentation of this file.
1/**
2 * \file IMP/rmf/associations.h
3 * \brief Track associations between an RMF file and native objects.
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPRMF_ASSOCIATIONS_H
10#define IMPRMF_ASSOCIATIONS_H
11
12#include <IMP/rmf/rmf_config.h>
13#include "links.h"
14#include <IMP/Object.h>
15#include <IMP/Pointer.h>
16#include <IMP/object_macros.h>
17#include <IMP/log_macros.h>
18#include <RMF/names.h>
19
20IMPRMF_BEGIN_NAMESPACE
21
22typedef Object *AssociationType;
23
24IMPRMFEXPORT void set_association(RMF::NodeConstHandle nh, Object *o,
25 bool overwrite = false);
26
27template <class T>
28inline T *get_association(RMF::NodeConstHandle nh) {
29 AssociationType o = nh.get_association<AssociationType>();
30 Object *op = o;
31 if (!op) return nullptr;
32 return dynamic_cast<T *>(op);
33}
34
35/** \name Associations
36 RMF supports tracking associations between an RMF file and native objects.
37 In the \imp case these are IMP::Object and we provide some special
38 methods to aid in this process.
39 @{
40*/
41IMPRMFEXPORT RMF::NodeConstHandle get_node_from_association(
42 RMF::FileConstHandle nh, Object *oi);
43
44IMPRMFEXPORT RMF::NodeHandle get_node_from_association(RMF::FileHandle nh,
45 Object *oi);
46IMPRMFEXPORT bool get_has_associated_node(RMF::FileConstHandle nh,
47 Object *oi);
48
49/** @} */
50
51IMPRMF_END_NAMESPACE
52
53#endif /* IMPRMF_ASSOCIATIONS_H */
A shared base class to help in debugging and things.
A nullptr-initialized pointer to an IMP Object.
Logging and error reporting support.
Helper macros for implementing IMP Objects.