Windows: Use widechar instead of char when loading drivers.
[jack2.git] / common / JackMetadata.h
bloba6cf18f9c2163917f25adfef2ce402d07c94b658
1 /*
2 Copyright (C) 2011 David Robillard
3 Copyright (C) 2013 Paul Davis
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or (at
8 your option) any later version.
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __JackMetadata__
21 #define __JackMetadata__
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
27 // libdb does not work in 32bit mixed mode
28 #ifdef BUILD_WITH_32_64
29 #undef HAVE_DB
30 #define HAVE_DB 0
31 #endif
33 #include <stdint.h>
35 #if HAVE_DB
36 #include <db.h>
37 #endif
39 #include <jack/uuid.h>
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 typedef struct {
46 const char* key;
47 const char* data;
48 const char* type;
49 } jack_property_t;
51 typedef struct {
52 jack_uuid_t subject;
53 uint32_t property_cnt;
54 jack_property_t* properties;
55 uint32_t property_size;
56 } jack_description_t;
58 typedef enum {
59 PropertyCreated,
60 PropertyChanged,
61 PropertyDeleted
62 } jack_property_change_t;
64 typedef void (*JackPropertyChangeCallback)(jack_uuid_t subject,
65 const char* key,
66 jack_property_change_t change,
67 void* arg);
69 #ifdef __cplusplus
71 #endif
74 namespace Jack
77 class JackClient;
79 /*!
80 \brief Metadata base.
83 class JackMetadata
85 private:
87 #if HAVE_DB
88 DB* fDB;
89 DB_ENV* fDBenv;
90 const bool fIsEngine;
91 #endif
93 int PropertyInit();
94 int PropertyChangeNotify(JackClient* client, jack_uuid_t subject, const char* key, jack_property_change_t change);
96 #if HAVE_DB
97 void MakeKeyDbt(DBT* dbt, jack_uuid_t subject, const char* key);
98 #endif
100 public:
102 JackMetadata(bool isEngine);
103 ~JackMetadata();
105 int GetProperty(jack_uuid_t subject, const char* key, char** value, char** type);
106 int GetProperties(jack_uuid_t subject, jack_description_t* desc);
107 int GetAllProperties(jack_description_t** descriptions);
109 int GetDescription(jack_uuid_t subject, jack_description_t* desc);
110 int GetAllDescriptions(jack_description_t** descs);
111 void FreeDescription(jack_description_t* desc, int free_actual_description_too);
113 int SetProperty(JackClient* client, jack_uuid_t subject, const char* key, const char* value, const char* type);
115 int RemoveProperty(JackClient* client, jack_uuid_t subject, const char* key);
116 int RemoveProperties(JackClient* client, jack_uuid_t subject);
117 int RemoveAllProperties(JackClient* client);
122 } // end of namespace
124 #endif