IMP logo
Macros
container_macros.h File Reference

Macros to define containers of objects. More...

+ Include dependency graph for container_macros.h:

Go to the source code of this file.

Macros

#define IMP_CONTAINER_DEPENDENCIES(Name, input_deps)
#define IMP_EXPOSE_ITERATORS(ContainerType, container_name, Ucname, Ucnames, lcname, lcnames)
#define IMP_FORCE_EXPORT(x)   x
#define IMP_LIST(protection, Ucname, lcname, Data, PluralData)
 A macro to provide a uniform interface for storing lists of objects.
#define IMP_LIST_ACTION(protection, Ucname, Ucnames, lcname, lcnames,Data, PluralData, OnAdd,OnChanged, OnRemoved)
#define IMP_LIST_ACTION_IMPL(Class, Ucname, Ucnames, lcname, lcnames,Data, PluralData)
#define IMP_LIST_IMPL(Class, Ucname, lcname, Data, PluralData)
 This should go in a .cpp file for the respective class.
#define IMP_PROTECTION(protection)   protection:

Detailed Description

Macros to define containers of objects.

Copyright 2007-2012 IMP Inventors. All rights reserved.


Macro Definition Documentation

#define IMP_CONTAINER_DEPENDENCIES (   Name,
  input_deps 
)

Report dependencies of the container Name. Add the line deps_(new DependenciesScoreState(this), model) to the constructor initializer list. The input_deps argument should add the input containers to a variable ret.

#define IMP_EXPOSE_ITERATORS (   ContainerType,
  container_name,
  Ucname,
  Ucnames,
  lcname,
  lcnames 
)

Internal use only.

#define IMP_LIST (   protection,
  Ucname,
  lcname,
  Data,
  PluralData 
)
Value:
IMP_LIST_ACTION(protection, Ucname, Ucname##s, lcname, \
lcname##s, Data, PluralData,,,)

A macro to provide a uniform interface for storing lists of objects.

This macro is designed to be used in the body of an object to add
a set of methods for manipulating a list of contained objects. It adds
methods
- get_foo
- set_foo
- set_foos
- foos_begin, foos_end
- remove_foo
- remove_foos
etc. where foo is the lcname provided.

\param[in] protection The level of protection for the container
(public, private).
\param[in] Ucname The name of the type of container in uppercase.
\param[in] lcname The name of the type of container in lower case.
\param[in] Data The type of the data to store.
\param[in] PluralData The plural of the data name. This should be a
container type.

An accompanying IMP_LIST_IMPL must go in a \c .cpp file.

\note This macro should be given an appropriate name and wrapped in a
doxygen comment block such as by starting with a C++ comment like
     @name short description
     longer description
     @{

and ending with one like

     @}
#define IMP_LIST_ACTION (   protection,
  Ucname,
  Ucnames,
  lcname,
  lcnames,
  Data,
  PluralData,
  OnAdd,
  OnChanged,
  OnRemoved 
)

A version of IMP_LIST() for types where the spelling of the plural is irregular (eg geometry-> geometries) and where actions can be taken upon addition and removal:

Parameters:
[in]protectionThe level of protection for the container (public, private).
[in]UcnameThe name of the type of container in uppercase.
[in]lcnameThe name of the type of container in lower case.
[in]DataThe type of the data to store.
[in]PluralDataThe plural of the data name. This should be a container type.
[in]OnAddCode to modify the passed in object. The object is obj and its index index.
[in]OnChangedCode to get executed when the container changes.
[in]OnRemovedCode to get executed when the an object is removed.
#define IMP_LIST_IMPL (   Class,
  Ucname,
  lcname,
  Data,
  PluralData 
)
Value:
IMP_LIST_ACTION_IMPL(Class, Ucname, Ucname##s, lcname, lcname##s, \
Data, PluralData)

This should go in a .cpp file for the respective class.

This code should go in a .cpp file. One macro for each IMP_CONTAINER.

Parameters:
[in]ClassThe name of the class containing this container.
[in]UcnameThe name of the type of container in uppercase.
[in]lcnameThe name of the type of container in lower case.
[in]DataThe type of the data to store.
[in]PluralDataThe plural of the data name. This should be a container type.

For all of these the current object is called obj and is of type Data.


Generated on Tue May 22 2012 23:33:17 for IMP by doxygen 1.8.1