IMP  2.0.0
The Integrative Modeling Platform
kernel/key_macros.h
Go to the documentation of this file.
1 /**
2  * \file IMP/kernel/key_macros.h
3  * \brief Various general useful macros for IMP.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPKERNEL_KEY_MACROS_H
10 #define IMPKERNEL_KEY_MACROS_H
11 #include <IMP/kernel/kernel_config.h>
12 #include <IMP/base/value_macros.h>
13 #include "Key.h"
14 
15 
16 /** Define a new key type.
17 
18  It defines two public types: Name, which is an instantiation of KeyBase, and
19  Names which is a vector of Name.
20 
21  \param[in] Name The name for the new type.
22  \param[in] Tag A (hopefully) unique integer to define this key type.
23 
24  \note We define a new class rather than use a typedef since SWIG has a
25  bug dealing with names that start with ::. A fix has been commited to SVN
26  for SWIG.
27 
28  \note The name in the typedef would have to start with ::IMP so it
29  could be used out of the IMP namespace.
30 */
31 #define IMP_DECLARE_KEY_TYPE(Name, Tag) \
32  typedef Key<Tag, true> Name; \
33  IMP_VALUES(Name, Name##s)
34 
35 
36 /** Define a new key non lazy type where new types have to be created
37  explicitly.
38 
39  \see IMP_DECLARE_KEY_TYPE
40 */
41 #define IMP_DECLARE_CONTROLLED_KEY_TYPE(Name, Tag) \
42  typedef Key<Tag, false> Name; \
43  IMP_VALUES(Name, Name##s)
44 
45 
46 
47 #endif /* IMPKERNEL_KEY_MACROS_H */