Common Pipeline Library Reference Manual  6.6
Macros
Recipe Definition

Macros

#define cpl_get_license(PACKAGE_NAME, YEAR)
 Generate the recipe copyright and license text (GPL v.2) More...
 
#define cpl_recipe_define(RECIPE_NAME, RECIPE_VERSION, RECIPE_AUTHOR, RECIPE_EMAIL, RECIPE_YEAR, RECIPE_SYNOPSIS, RECIPE_DESCRIPTION)
 Define a standard CPL recipe. More...
 
#define CPL_RECIPE_DEFINE(RECIPE_NAME, RECIPE_VERSION, RECIPE_FILL_PARAMS, RECIPE_AUTHOR, RECIPE_AUTHOR_EMAIL, RECIPE_YEAR, RECIPE_SYNOPSIS, RECIPE_DESCRIPTION)
 Define a standard CPL recipe. More...
 

Detailed Description

This module implements the support for recipe defition.

Synopsis:
#include <cpl_recipedefine.h>

Macro Definition Documentation

#define cpl_get_license (   PACKAGE_NAME,
  YEAR 
)

Generate the recipe copyright and license text (GPL v.2)

Parameters
PACKAGE_NAMEThe name as a string literal, e.g. from config.h
YEARThe year(s) as a string literal
Returns
The recipe copyright and license text as a string literal

Example:

1 const char * eso_gpl_license = cpl_get_license(PACKAGE_NAME, "2005, 2008");
#define cpl_recipe_define (   RECIPE_NAME,
  RECIPE_VERSION,
  RECIPE_AUTHOR,
  RECIPE_EMAIL,
  RECIPE_YEAR,
  RECIPE_SYNOPSIS,
  RECIPE_DESCRIPTION 
)

Define a standard CPL recipe.

Parameters
RECIPE_NAMEThe name as an identifier
RECIPE_VERSIONThe binary version number
RECIPE_AUTHORThe author as a string literal
RECIPE_EMAILThe contact email as a string literal
RECIPE_YEARThe copyright year as a string literal
RECIPE_SYNOPSISThe synopsis as a string literal
RECIPE_DESCRIPTIONThe man-page as a string literal

A CPL-based recipe may use this macro to define its four mandatory functions: cpl_plugin_get_info(), <recipe>_create(), <recipe>_exec() and <recipe>_destroy(), as well as declaring the actual data reduction function, <recipe>() as

1 static int <recipe>(cpl_frameset *, const cpl_parameterlist *);

The macro also declares the recipe-specific function that fills the recipe parameterlist with the supported parameters as

1 static cpl_error_code <recipe>_fill_parameterlist(cpl_parameterlist *self);

A recipe that invokes cpl_recipe_define() must define this function.

The macro cpl_recipe_define() may be used by defining a macro, e.g. in my_recipe.h:

1 #define MY_RECIPE_DEFINE(NAME, SYNOPSIS, DESCRIPTION) \
2  cpl_recipe_define(NAME, MY_BINARY_VERSION, \
3  "Firstname Lastname", "2006, 2008", SYNOPSIS, DESCRIPTION)
  • and then by invoking this macro in each recipe:
1 #include "my_recipe.h"
2 
3 MY_RECIPE_DEFINE(instrume_img_dark,
4  "Dark recipe",
5  "instrume_img_dark -- imaging dark recipe.\n"
6  " ... recipe man-page\n");
7 
8 static
9 cpl_error_code instrume_img_dark_fill_parameterlist(cpl_parameterlist *self);
10 {
11 
12  // Fill the parameterlist with the parameters supported by the recipe.
13 
14  retun CPL_ERROR_NONE;
15 }
#define CPL_RECIPE_DEFINE (   RECIPE_NAME,
  RECIPE_VERSION,
  RECIPE_FILL_PARAMS,
  RECIPE_AUTHOR,
  RECIPE_AUTHOR_EMAIL,
  RECIPE_YEAR,
  RECIPE_SYNOPSIS,
  RECIPE_DESCRIPTION 
)

Define a standard CPL recipe.

Parameters
RECIPE_NAMEThe name as an identifier
RECIPE_VERSIONThe binary version number
RECIPE_FILL_PARAMSA function call to fill the recipe parameterlist. Must evaluate to zero if and only if successful
RECIPE_AUTHORThe author as a string literal
RECIPE_AUTHOR_EMAILThe author email as a string literal
RECIPE_YEARThe copyright year as a string literal
RECIPE_SYNOPSISThe synopsis as a string literal
RECIPE_DESCRIPTIONThe man-page as a string literal
Deprecated:
Use cpl_recipe_define()