/usr/include/cpl_plugin.h is in libcpl-dev 7.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | /*
* This file is part of the ESO Common Pipeline Library
* Copyright (C) 2001-2017 European Southern Observatory
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CPL_PLUGIN_H
#define CPL_PLUGIN_H
#include <stdio.h>
#include <cpl_macros.h>
#include <cpl_error.h>
CPL_BEGIN_DECLS
/**
* @ingroup cpl_plugin
*
* @brief
* Plugin API version
*
* @hideinitializer
*/
#define CPL_PLUGIN_API (1)
/**
* @ingroup cpl_plugin
*
* @brief
* Definition of plugin types
*
* Predefined plugin types supported by the Common Pipeline Library itself.
*/
enum _cpl_plugin_type_ {
/**
* Plugin is of unknown or undefined type
*/
CPL_PLUGIN_TYPE_NONE = 0,
/**
* Plugin is a complete data reduction task, i.e. a sequence of individual
* data reduction steps, turning a raw frame into a `final' product.
*/
CPL_PLUGIN_TYPE_RECIPE = 1 << 0,
/**
* Plugin is a recipe, i.e. a complete data reduction task. In addition,
* this recipe version provides extra data about the required input
* data. This plugin is a subclass of @c CPL_PLUGIN_TYPE_RECIPE.
*/
CPL_PLUGIN_TYPE_RECIPE_V2 = (1 << 1) | CPL_PLUGIN_TYPE_RECIPE
};
/**
* @ingroup cpl_plugin
*
* @brief
* Data type used to store the plugin type code.
*/
typedef enum _cpl_plugin_type_ cpl_plugin_type;
/**
* @ingroup cpl_plugin
*
* @brief
* The plugin data type.
*
* This defines the (public) plugin data type.
*/
typedef struct _cpl_plugin_ cpl_plugin;
typedef int (*cpl_plugin_func)(cpl_plugin *);
/**
* @ingroup cpl_plugin
*
* @brief
* The type representation of the generic plugin interface.
*/
struct _cpl_plugin_ {
/**
* @brief
* The API version the Plugin complies to.
*
* The API version number identifies the internal layout of the plugin
* interface structure. It may be used by an application calling a plugin
* to setup the correct interface to communicate with the plugin or, in
* the simplest case, to ignore any plugin which does not match the plugin
* API an application has been buid for.
*/
unsigned int api; /* Must always be the first entry in the interface! */
/**
* @brief
* The Plugin version.
*
* The Plugin version number defines the version number for the plugin.
* The Plugin version number is an encoded version of the
* usual @b MAJOR.MINOR.MICRO form for version numbers.
*/
unsigned long version;
/**
* @brief
* The Plugin type.
*
* The Plugin type identifies the type of plugin. The data type is not a
* cpl_plugin_type in order to keep this interface as generic as possible.
*/
unsigned long type;
/**
* @brief
* Plugin's unique name.
*
* Variable contains the unique name of the Plugin. To ensure uniqueness
* across all possible Plugins one should follow the hierarchical naming
* convention mentioned in the CPL documentation.
*/
const char *name;
/**
* @brief
* Plugin's short help string.
*
* Variable contains the plugin's null-terminated short help string.
* The short help string should summarize the plugin's purpose in not more
* than a few lines. It may contain new line characters. If the plugin
* does not provide a short help the pointer should be set
* to a @c NULL pointer.
*/
const char *synopsis;
/**
* @brief
* Plugin's detailed description.
*
* Variable contains the plugin's null-terminated detailed
* description string. The description is the detailed help for the
* plugin. For formatting the output the C special characters @c '\\n',
* @c '\\t' maybe embedded in the returned string. If the plugin does not
* provide a detailed description the pointer should be set to a @c NULL
* pointer.
*/
const char *description;
/**
* @brief
* Name of the plugin's author.
*
* Variable contains the null-terminated identifier string of
* the plugins author. If the plugin does not specify an author this
* pointer should be set to a @c NULL pointer.
*/
const char *author;
/**
* @brief
* Author's email address.
*
* Variable contains the null-terminated string of the author's
* email address. If the plugin does not specify an email address this
* pointer should be set to a @c NULL pointer.
*/
const char *email;
/**
* @brief
* Plugin's copyright.
*
* Variable contains the copyright and license string applying
* to the plugin. The returned string must be null-terminated. If no
* copyright applies this pointer should be set to a @c NULL pointer.
*/
const char *copyright;
/**
* @brief
* Initializes a plugin instance.
*
* @param plugin The plugin to instantiate.
*
* @return The function must return 0 on success, and a non-zero value
* if the plugin instantiation failed.
*
* The function to initialize a plugin instance. This maybe NULL
* if the initialization of the plugin is not needed. Otherwise it
* has to be called before plugin type specific members are accessed.
*/
cpl_plugin_func initialize;
/**
* @brief
* Executes a plugin instance.
*
* @param plugin The plugin to execute.
*
* @return The function must return 0 on success, and a non-zero value
* if the plugin execution failed.
*
* The function executes the plugin instance @em plugin.
*/
cpl_plugin_func execute;
/**
* @brief
* Deinitialization a plugin instance.
*
* @return The function must return 0 on success, and a non-zero value
* if the plugin deinitalization failed.
*
* The function to deinitialize the plugin instance @em plugin. If this is
* @c NULL no deinitialization of the plugin instance is needed.
*/
cpl_plugin_func deinitialize;
};
/*
* Create, copy and destroy operations.
*/
cpl_plugin *cpl_plugin_new(void) CPL_ATTR_ALLOC;
cpl_error_code cpl_plugin_copy(cpl_plugin *self, const cpl_plugin *other);
void cpl_plugin_delete(cpl_plugin *self);
/*
* Accessor Functions
*/
cpl_error_code cpl_plugin_set_api(cpl_plugin *self , unsigned int api);
unsigned int cpl_plugin_get_api(const cpl_plugin *self);
int cpl_plugin_set_version(cpl_plugin *self, unsigned long version);
unsigned long cpl_plugin_get_version(const cpl_plugin *self);
char *cpl_plugin_get_version_string(const cpl_plugin *self) CPL_ATTR_ALLOC;
cpl_error_code cpl_plugin_set_type(cpl_plugin *self, unsigned long type);
unsigned long cpl_plugin_get_type(const cpl_plugin *self);
char *cpl_plugin_get_type_string(const cpl_plugin *self) CPL_ATTR_ALLOC;
cpl_error_code cpl_plugin_set_name(cpl_plugin *self, const char *name);
const char *cpl_plugin_get_name(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_synopsis(cpl_plugin *self, const char *synopsis);
const char *cpl_plugin_get_synopsis(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_description(cpl_plugin *self,
const char *description);
const char *cpl_plugin_get_description(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_author(cpl_plugin *self, const char *author);
const char *cpl_plugin_get_author(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_email(cpl_plugin *self, const char *email);
const char *cpl_plugin_get_email(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_copyright(cpl_plugin *self,
const char *copyright);
const char *cpl_plugin_get_copyright(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_init(cpl_plugin *self, cpl_plugin_func);
cpl_plugin_func cpl_plugin_get_init(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_exec(cpl_plugin *self, cpl_plugin_func);
cpl_plugin_func cpl_plugin_get_exec(const cpl_plugin *self);
cpl_error_code cpl_plugin_set_deinit(cpl_plugin *self, cpl_plugin_func);
cpl_plugin_func cpl_plugin_get_deinit(const cpl_plugin *self);
/*
* Convenience Functions
*/
cpl_error_code cpl_plugin_init(cpl_plugin *self, unsigned int api,
unsigned long version, unsigned long type,
const char *name, const char *synopsis,
const char *description, const char *author,
const char *email, const char *copyright,
cpl_plugin_func initialize,
cpl_plugin_func execute,
cpl_plugin_func deinitialize);
/*
* Debugging
*/
void cpl_plugin_dump(const cpl_plugin *self, FILE *stream);
CPL_END_DECLS
#endif /* CPL_PLUGIN_H */
|