~ubuntu-branches/ubuntu/trusty/geis/trusty

« back to all changes in this revision

Viewing changes to libgeis/geis_backend_protected.h

  • Committer: Package Import Robot
  • Author(s): Chase Douglas
  • Date: 2012-07-30 08:51:42 UTC
  • Revision ID: package-import@ubuntu.com-20120730085142-jrc33ygjvt0ob1wl
Tags: upstream-2.2.11
ImportĀ upstreamĀ versionĀ 2.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file geis_backend_protected.h
 
3
 * @brief internal GEIS back end base class "protected" interface
 
4
 *
 
5
 * This file contains the implementation interface for the various GEIS v2 back
 
6
 * ends.
 
7
 */
 
8
 
 
9
/*
 
10
 * Copyright 2010, 2012 Canonical Ltd.
 
11
 *
 
12
 * This library is free software; you can redistribute it and/or modify it under
 
13
 * the terms of the GNU Lesser General Public License as published by the Free
 
14
 * Software Foundation; either version 3 of the License, or (at your option) any
 
15
 * later version.
 
16
 *
 
17
 * This library is distributed in the hope that it will be useful, but WITHOUT
 
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
19
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 
20
 * details.
 
21
 *
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
24
 */
 
25
#ifndef GEIS_BACKEND_PROTECTED_H_
 
26
#define GEIS_BACKEND_PROTECTED_H_
 
27
 
 
28
#include "geis/geis.h"
 
29
#include "geis_backend.h"
 
30
#include "geis_backend_token.h"
 
31
 
 
32
 
 
33
/**
 
34
 * The custom dispatch table for "derived" GEIS v2 backends.
 
35
 */
 
36
typedef struct GeisBackendVtable
 
37
{
 
38
  void             (* construct)(void *mem, Geis geis);
 
39
  void             (* finalize)(GeisBackend);
 
40
  GeisBackendToken (* create_token)(GeisBackend, GeisBackendTokenInitState);
 
41
  GeisStatus       (* accept_gesture)(GeisBackend, GeisGroup, GeisGestureId);
 
42
  GeisStatus       (* reject_gesture)(GeisBackend, GeisGroup, GeisGestureId);
 
43
  GeisStatus       (* get_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer);
 
44
  GeisStatus       (* set_configuration)(GeisBackend, GeisSubscription, GeisString, GeisPointer);
 
45
} *GeisBackendVtable;
 
46
 
 
47
 
 
48
/**
 
49
 * The custom dispatch table for backend-specific tokens.
 
50
 *
 
51
 * Backend tokens are used when creating subscriptions (including filters and
 
52
 * filter terms).
 
53
 */
 
54
typedef struct GeisBackendTokenVtable
 
55
{
 
56
  GeisBackendToken (* clone)(GeisBackendToken);
 
57
  void             (* finalize)(GeisBackendToken);
 
58
  void             (* compose)(GeisBackendToken, GeisBackendToken);
 
59
  GeisStatus       (* activate)(GeisBackendToken, GeisSubscription);
 
60
  GeisStatus       (* deactivate)(GeisBackendToken, GeisSubscription);
 
61
} *GeisBackendTokenVtable;
 
62
 
 
63
 
 
64
struct GeisBackendToken
 
65
{
 
66
  GeisBackendTokenVtable vtbl;
 
67
};
 
68
 
 
69
/**
 
70
 * Registers back ends with the API.
 
71
 *
 
72
 * @param[in] name The name of the back end.
 
73
 * @param[in] size The size of the back end data structure.
 
74
 * @param[in] vtbl A pointer to a (static) function dispatch table.
 
75
 *
 
76
 * This registration function should be called from a module init routine
 
77
 * decorated with the GCC attribute((constructor)) so the back end gets
 
78
 * registered with the API.
 
79
 */
 
80
void geis_register_backend(GeisString        name,
 
81
                           GeisSize          size,
 
82
                           GeisBackendVtable vtbl);
 
83
 
 
84
#endif /* GEIS_BACKEND_PROTECTED_H_ */