~thomas-voss/biometryd/remove-obsolete-configuration-header

« back to all changes in this revision

Viewing changes to include/biometry/devices/plugin/interface.h

  • Committer: Thomas Voß
  • Date: 2016-05-02 06:16:01 UTC
  • Revision ID: thomas.voss@canonical.com-20160502061601-vqzwfw4c0rxfna04
Initial commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Thomas Voß <thomas.voss@canonical.com>
 
17
 *
 
18
 */
 
19
 
 
20
#ifndef BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_
 
21
#define BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_
 
22
 
 
23
#include <biometry/version.h>
 
24
 
 
25
#define BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR_SECTION "BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR"
 
26
 
 
27
namespace biometry
 
28
{
 
29
class Device;
 
30
 
 
31
namespace devices
 
32
{
 
33
namespace plugin
 
34
{
 
35
static constexpr const std::uint32_t name_length        = 256;
 
36
static constexpr const std::uint32_t author_length      = 256;
 
37
static constexpr const std::uint32_t description_length = 256;
 
38
 
 
39
struct Version
 
40
{
 
41
    std::uint32_t major, minor, patch;
 
42
};
 
43
 
 
44
struct Descriptor
 
45
{
 
46
    const char name[name_length];
 
47
    const char author[author_length];
 
48
    const char description[description_length];
 
49
 
 
50
    struct
 
51
    {
 
52
        Version host;
 
53
        Version plugin;
 
54
    } const version;
 
55
};
 
56
}
 
57
}
 
58
}
 
59
 
 
60
/// @brief BiometrydPluginDeviceCreate defines the function used to create biometry::Device instances.
 
61
typedef biometry::Device*   (*BiometrydPluginDeviceCreate)    ();
 
62
/// @brief BiometrydPluginDeviceDestroy defines the function used to destroy biometry::Device instances.
 
63
typedef void                (*BiometrydPluginDeviceDestroy)   (biometry::Device*);
 
64
 
 
65
/// @snippet tests/biometryd_devices_plugin_dl.cpp Describing the plugin
 
66
#define BIOMETRYD_DEVICES_PLUGIN_DESCRIBE(name, author, description, major, minor, patch) \
 
67
    biometry::devices::plugin::Descriptor biometryd_devices_plugin_descriptor __attribute((section(BIOMETRYD_DEVICES_PLUGIN_DESCRIPTOR_SECTION))) = \
 
68
        { name, author, description, {{biometry::build::version_major, biometry::build::version_minor, biometry::build::version_patch}, {major, minor, patch}}};
 
69
 
 
70
/// @brief Starts the implementation of the create function exposed from a dynamic library.
 
71
///
 
72
/// @snippet tests/biometryd_devices_plugin_dl.cpp Defining the create function
 
73
#define BIOMETRYD_DEVICES_PLUGIN_CREATE \
 
74
    extern "C" __attribute__ ((visibility ("default"))) biometry::Device* CreateBiometrydDevice()
 
75
 
 
76
/// @snippet tests/biometryd_devices_plugin_dl.cpp Defining the destroy function
 
77
/// @brief Starts implementation of the destroy function exposed from a dynamic library.
 
78
///
 
79
/// @code
 
80
/// @endcode
 
81
#define BIOMETRYD_DEVICES_PLUGIN_DESTROY \
 
82
    extern "C" __attribute__ ((visibility ("default"))) void DestroyBiometrydDevice(biometry::Device* d)
 
83
 
 
84
/// @brief Tags the symbol name of the create function.
 
85
#define BIOMETRYD_DEVICES_PLUGIN_CREATE_SYMBOL_NAME "CreateBiometrydDevice"
 
86
/// @brief Tags the symbol name of the destroy function.
 
87
#define BIOMETRYD_DEVICES_PLUGIN_DESTROY_SYMBOL_NAME "DestroyBiometrydDevice"
 
88
 
 
89
 
 
90
 
 
91
#endif // BIOMETRYD_DEVICES_PLUGIN_INTERFACE_H_