IMP  2.1.0
The Integrative Modeling Platform
kernel/decorator_macros.h File Reference

Various general useful macros for IMP. More...

#include <IMP/kernel/kernel_config.h>
#include "particle_index.h"
#include "Particle.h"
#include "Decorator.h"
#include <IMP/base/check_macros.h>
#include <IMP/base/log_macros.h>
#include <IMP/base/showable_macros.h>
#include <IMP/base/warning_macros.h>
+ Include dependency graph for kernel/decorator_macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMP_DECORATOR(Name, Parent)
 
#define IMP_DECORATOR_GET(AttributeKey, Type, has_action, not_has_action)
 Perform actions dependent on whether a particle has an attribute. More...
 
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
 Define methods for getting and setting a particular simple field. More...
 
#define IMP_DECORATOR_GET_SET_OPT(name, AttributeKey, Type, ReturnType, default_value)
 Define methods for getting and setting an optional simple field. More...
 
#define IMP_DECORATOR_METHODS(Name, Parent)
 
#define IMP_DECORATOR_SET(AttributeKey, value)
 Set an attribute, creating it if it does not already exist. More...
 
#define IMP_DECORATOR_SETUP_0(Name)
 
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
 
#define IMP_DECORATOR_SETUP_2(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name)
 
#define IMP_DECORATOR_SETUP_3(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name)
 
#define IMP_DECORATOR_SETUP_4(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name,FourthArgumentType, fourth_argument_name)
 
#define IMP_DECORATOR_TRAITS_SETUP_0(Name)
 
#define IMP_DECORATOR_TRAITS_SETUP_1(Name, FirstArgumentType,first_argument_name)
 
#define IMP_DECORATOR_TRAITS_SETUP_2(Name, FirstArgumentType,first_argument_name, SecondArgumentType, second_argument_name)
 
#define IMP_DECORATOR_WITH_TRAITS(Name, Parent, TraitsType, traits_name,default_traits)
 
#define IMP_DECORATOR_WITH_TRAITS_METHODS(Name, Parent, TraitsType,traits_name, default_traits)
 
#define IMP_DECORATORS(Name, PluralName, Parent)
 Define the types for storing sets of decorators. More...
 
#define IMP_DECORATORS_DECL(Name, PluralName)
 
#define IMP_DECORATORS_DEF(Name, PluralName)
 
#define IMP_DECORATORS_WITH_TRAITS(Name, PluralName, Parent)
 Define the types for storing sets of decorators. More...
 
#define IMP_SUMMARY_DECORATOR_DECL(Name, Parent, Members)
 Create a decorator that computes some sort of summary info on a set. More...
 
#define IMP_SUMMARY_DECORATOR_DEF(Name, Parent, Members, create_modifier)
 

Detailed Description

Copyright 2007-2013 IMP Inventors. All rights reserved.

Definition in file kernel/decorator_macros.h.

Macro Definition Documentation

#define IMP_DECORATOR (   Name,
  Parent 
)
Deprecated:
As of IMP release 2.1. See the IMP Deprecation Policy for more information about deprecation in IMP. Use IMP_DECORATOR_METHODS() instead.

Definition at line 23 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_GET (   AttributeKey,
  Type,
  has_action,
  not_has_action 
)

A common pattern is to check if a particle has a particular attribute, do one thing if it does and another if it does not. This macro implements that pattern. It requires that the method get_particle() return the particle being used.

Parameters
[in]AttributeKeyThe key for the attribute
[in]TypeThe type for the attribute ("Int", "Float", "String")
[in]has_actionThe action to take if the Particle has the attribute. The attribute value is stored in the variable VALUE.
[in]not_has_actionThe action to take if the Particle does not have the attribute.
See Also
IMP_DECORATOR_GET()
IMP_DECORATOR_GET_SET()

Definition at line 435 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_GET_SET (   name,
  AttributeKey,
  Type,
  ReturnType 
)

This macro defines methods to get and set a particular attribute.

Parameters
[in]nameThe lower case name of the attribute
[in]AttributeKeyThe AttributeKey object controlling the attribute.
[in]TypeThe type of the attribute (upper case).
[in]ReturnTypeThe type to return from the get.
See Also
IMP_DECORATOR_GET()
IMP_DECORATOR_SET()

Definition at line 473 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_GET_SET_OPT (   name,
  AttributeKey,
  Type,
  ReturnType,
  default_value 
)

See IMP_DECORATOR_GET_SET(). The difference is that here you can provide a default value to use if the decorator does not have the attribute.

Parameters
[in]nameThe lower case name of the attribute
[in]AttributeKeyThe expression to get the required attribute key.
[in]TypeThe type of the attribute (upper case).
[in]ReturnTypeThe type to return from the get.
[in]default_valueThe value returned if the attribute is missing.

Definition at line 493 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_METHODS (   Name,
  Parent 
)

Implement the needed methods for a decorator based on

  • setup_particle()
  • get_is_setup() methods that you provide.

Definition at line 88 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SET (   AttributeKey,
  value 
)

Another common pattern is to have an assumed value if the attribute is not there. Then, you sometimes need to set the value whether it is there or not.

See Also
IMP_DECORATOR_GET()
IMP_DECORATOR_GET_SET()

Definition at line 453 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SETUP_0 (   Name)

Decorators need to be able to be set up from Particles, ParticleIndexes and other Decorators. To help keep things uniform, we provide macros to declare the setup functions. These macros expect that an appropriate do_setup_particle(kernel::Model *, ParticleIndex, args...) function is defined. But any docs needed before the macro invocation.

Definition at line 258 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SETUP_1 (   Name,
  FirstArgumentType,
  first_argument_name 
)
See Also
IMP_DECORATOR_SETUP_0()

Definition at line 272 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SETUP_2 (   Name,
  FirstArgumentType,
  first_argument_name,
  SecondArgumentType,
  second_argument_name 
)
See Also
IMP_DECORATOR_SETUP_0()

Definition at line 289 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SETUP_3 (   Name,
  FirstArgumentType,
  first_argument_name,
  SecondArgumentType,
  second_argument_name,
  ThirdArgumentType,
  third_argument_name 
)
See Also
IMP_DECORATOR_SETUP_0()

Definition at line 309 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_SETUP_4 (   Name,
  FirstArgumentType,
  first_argument_name,
  SecondArgumentType,
  second_argument_name,
  ThirdArgumentType,
  third_argument_name,
  FourthArgumentType,
  fourth_argument_name 
)
See Also
IMP_DECORATOR_SETUP_0()

Definition at line 333 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_TRAITS_SETUP_0 (   Name)

Decorators need to be able to be set up from Particles, ParticleIndexes and other Decorators. To help keep things uniform, we provide macros to declare the setup functions. These macros expect that an appropriate do_setup_particle(kernel::Model *, ParticleIndex, args...) function is defined. But any docs needed before the macro invocation.

Definition at line 367 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_TRAITS_SETUP_1 (   Name,
  FirstArgumentType,
  first_argument_name 
)
See Also
IMP_DECORATOR_TRAITS_SETUP_0()

Definition at line 382 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_TRAITS_SETUP_2 (   Name,
  FirstArgumentType,
  first_argument_name,
  SecondArgumentType,
  second_argument_name 
)
See Also
IMP_DECORATOR_TRAITS_SETUP_0()

Definition at line 399 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_WITH_TRAITS (   Name,
  Parent,
  TraitsType,
  traits_name,
  default_traits 
)
Deprecated:
As of IMP release 2.1. See the IMP Deprecation Policy for more information about deprecation in IMP. Use IMP_DECORATOR_WITH_TRAITS_METHODS()

Definition at line 138 of file kernel/decorator_macros.h.

#define IMP_DECORATOR_WITH_TRAITS_METHODS (   Name,
  Parent,
  TraitsType,
  traits_name,
  default_traits 
)

Implement the needed methods for a decorator based on

  • setup_particle()
  • get_is_setup() methods that you provide.

Definition at line 188 of file kernel/decorator_macros.h.

#define IMP_DECORATORS (   Name,
  PluralName,
  Parent 
)
Value:
IMP_DECORATORS_DECL(Name, PluralName); \
IMP_DECORATORS_DEF(Name, PluralName)

The macro defines the types PluralName and PluralNameTemp.

Definition at line 521 of file kernel/decorator_macros.h.

#define IMP_DECORATORS_DECL (   Name,
  PluralName 
)
Value:
class Name; \
typedef IMP::base::Vector<Name> PluralName

Definition at line 503 of file kernel/decorator_macros.h.

#define IMP_DECORATORS_WITH_TRAITS (   Name,
  PluralName,
  Parent 
)

The macro defines the types PluralName and PluralNameTemp.

Definition at line 528 of file kernel/decorator_macros.h.

#define IMP_SUMMARY_DECORATOR_DECL (   Name,
  Parent,
  Members 
)

Examples include a centroid or a cover for a set of particles.

Parameters
[in]NameThe name for the decorator
[in]Parentthe parent decorator type
[in]Membersthe way to pass a set of particles in

Definition at line 543 of file kernel/decorator_macros.h.

#define IMP_SUMMARY_DECORATOR_DEF (   Name,
  Parent,
  Members,
  create_modifier 
)

See IMP_SUMMARY_DECORATOR_DECL()

Parameters
[in]NameThe name for the decorator
[in]Parentthe parent decorator type
[in]Membersthe way to pass a set of particles in
[in]create_modifierthe statements to create the modifier which computes the summary info. It should be called mod.

Definition at line 576 of file kernel/decorator_macros.h.