IMP Reference Guide
2.20.1
The Integrative Modeling Platform
|
Helper macros for implementing Decorators. More...
#include <IMP/kernel_config.h>
#include "particle_index.h"
#include "Particle.h"
#include "Decorator.h"
#include <IMP/check_macros.h>
#include <IMP/log_macros.h>
#include <IMP/showable_macros.h>
#include <IMP/warning_macros.h>
Go to the source code of this file.
Macros | |
#define | IMP_CHECK_DECORATOR(Name, function) IMP::internal::ParticleCheck Name##pc(Name::get_is_setup, function); |
#define | IMP_CONSTRAINT_DECORATOR_DECL(Name) |
#define | IMP_CONSTRAINT_DECORATOR_DEF(Name, can_skip) |
#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_SETUP_5(Name,FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name,ThirdArgumentType, third_argument_name,FourthArgumentType, fourth_argument_name,FifthArgumentType, fifth_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_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_SUMMARIZE_DECORATOR_DECL(Name, Parent, Members, SetupDoc) |
Create a decorator that computes some sort of summary info on a set. More... | |
#define | IMP_SUMMARIZE_DECORATOR_DEF(Name, Parent, Members,create_pre_modifier,create_post_modifier, can_skip) |
Helper macros for implementing Decorators.
Copyright 2007-2022 IMP Inventors. All rights reserved.
Definition in file decorator_macros.h.
#define IMP_CHECK_DECORATOR | ( | Name, | |
function | |||
) | IMP::internal::ParticleCheck Name##pc(Name::get_is_setup, function); |
Register a function that can be used to check that the particle is valid with respect to the decorator. The function should take a Particle* as an argument and return a bool. It should throw an exception if something is wrong.
This macro should only be used in a .cpp file.
Definition at line 520 of file decorator_macros.h.
#define IMP_CONSTRAINT_DECORATOR_DECL | ( | Name | ) |
Declares Decorator methods that allows (privately) setting a constraint and publicly getting that constraint
Definition at line 463 of file decorator_macros.h.
#define IMP_CONSTRAINT_DECORATOR_DEF | ( | Name, | |
can_skip | |||
) |
Defines Decorator methods that allows (privately) setting a constraint and publicly getting that constraint. The constraint is added as a score state to the model.
Definition at line 487 of file decorator_macros.h.
#define IMP_DECORATOR_GET | ( | AttributeKey, | |
Type, | |||
has_action, | |||
not_has_action | |||
) |
Perform actions dependent on whether a particle has an attribute.
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_index() return the particle being used.
[in] | AttributeKey | The key for the attribute |
[in] | Type | The type for the attribute ("Int", "Float", "String") |
[in] | has_action | The action to take if the Particle has the attribute. The attribute value is stored in the variable VALUE. |
[in] | not_has_action | The action to take if the Particle does not have the attribute. |
Definition at line 351 of file decorator_macros.h.
#define IMP_DECORATOR_GET_SET | ( | name, | |
AttributeKey, | |||
Type, | |||
ReturnType | |||
) |
Define methods for getting and setting a particular simple field.
This macro defines methods to get and set a particular attribute.
[in] | name | The lower case name of the attribute |
[in] | AttributeKey | The AttributeKey object controlling the attribute. |
[in] | Type | The type of the attribute (upper case). |
[in] | ReturnType | The type to return from the get. |
Definition at line 389 of file decorator_macros.h.
#define IMP_DECORATOR_GET_SET_OPT | ( | name, | |
AttributeKey, | |||
Type, | |||
ReturnType, | |||
default_value | |||
) |
Define methods for getting and setting an optional simple field.
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.
[in] | name | The lower case name of the attribute |
[in] | AttributeKey | The expression to get the required attribute key. |
[in] | Type | The type of the attribute (upper case). |
[in] | ReturnType | The type to return from the get. |
[in] | default_value | The value returned if the attribute is missing. |
Definition at line 411 of file decorator_macros.h.
#define IMP_DECORATOR_METHODS | ( | Name, | |
Parent | |||
) |
Implement the needed methods for a decorator based on
Definition at line 25 of file decorator_macros.h.
#define IMP_DECORATOR_SET | ( | AttributeKey, | |
value | |||
) |
Set an attribute, creating it if it does not already exist.
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.
Definition at line 369 of file 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(Model *, ParticleIndex, args...)
function is defined.
Definition at line 109 of file decorator_macros.h.
#define IMP_DECORATOR_SETUP_1 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name | |||
) |
Definition at line 127 of file decorator_macros.h.
#define IMP_DECORATOR_SETUP_2 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name, | |||
SecondArgumentType, | |||
second_argument_name | |||
) |
Definition at line 149 of file decorator_macros.h.
#define IMP_DECORATOR_SETUP_3 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name, | |||
SecondArgumentType, | |||
second_argument_name, | |||
ThirdArgumentType, | |||
third_argument_name | |||
) |
Definition at line 174 of file 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 | |||
) |
Definition at line 203 of file decorator_macros.h.
#define IMP_DECORATOR_SETUP_5 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name, | |||
SecondArgumentType, | |||
second_argument_name, | |||
ThirdArgumentType, | |||
third_argument_name, | |||
FourthArgumentType, | |||
fourth_argument_name, | |||
FifthArgumentType, | |||
fifth_argument_name | |||
) |
Definition at line 237 of file 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(Model *, ParticleIndex, args...)
function is defined. But any docs needed before the macro invocation.
Definition at line 281 of file decorator_macros.h.
#define IMP_DECORATOR_TRAITS_SETUP_1 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name | |||
) |
Definition at line 298 of file decorator_macros.h.
#define IMP_DECORATOR_TRAITS_SETUP_2 | ( | Name, | |
FirstArgumentType, | |||
first_argument_name, | |||
SecondArgumentType, | |||
second_argument_name | |||
) |
Definition at line 315 of file 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
Definition at line 60 of file decorator_macros.h.
#define IMP_DECORATORS | ( | Name, | |
PluralName, | |||
Parent | |||
) |
Define the types for storing sets of decorators.
The macro defines the types PluralName and PluralNameTemp. Parent is unused and remains for backward compatibility
Definition at line 443 of file decorator_macros.h.
#define IMP_DECORATORS_DECL | ( | Name, | |
PluralName | |||
) |
Definition at line 424 of file decorator_macros.h.
#define IMP_DECORATORS_WITH_TRAITS | ( | Name, | |
PluralName, | |||
Parent | |||
) |
Define the types for storing sets of decorators.
The macro defines the types PluralName and PluralNameTemp.
Definition at line 450 of file decorator_macros.h.
#define IMP_SUMMARIZE_DECORATOR_DECL | ( | Name, | |
Parent, | |||
Members, | |||
SetupDoc | |||
) |
Create a decorator that computes some sort of summary info on a set.
Examples include a centroid or a cover for a set of particles.
[in] | Name | The name for the decorator |
[in] | Parent | the parent decorator type |
[in] | Members | the way to pass a set of particles in |
[in] | SetupDoc | extra documentation for setup |
Definition at line 532 of file decorator_macros.h.
#define IMP_SUMMARIZE_DECORATOR_DEF | ( | Name, | |
Parent, | |||
Members, | |||
create_pre_modifier, | |||
create_post_modifier, | |||
can_skip | |||
) |
[in] | Name | The name for the decorator |
[in] | Parent | the parent decorator type |
[in] | Members | the way to pass a set of particles in |
[in] | create_pre_modifier | the statements to create the SingletonModifier which computes the summary info, using refiner 'ref' |
[in] | create_post_modifier | a SingletonDerivativeModifier for the derivatives of the summary back to its members, using refiner 'ref' |
[in] | can_skip | set to true iff the modifiers do not need to be called when the particle did not move |
Definition at line 588 of file decorator_macros.h.