/usr/include/mama/dictionary.h is in libmama-dev 2.2.2.1-11.1ubuntu1.
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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MamaDictionaryH__
#define MamaDictionaryH__
#if defined (__cplusplus)
extern "C" {
#endif
#include "mama/types.h"
#include "mama/fielddesc.h"
/**
* The mamaDictionary class maps field identifiers (FIDs) to
* human readable strings. Any incoming mamaMsg might contain FIDs but
* no field names. The dictionary allows applications to determine the name
* associated with a given FID.
*/
/**
* Typedefs for the dictionary callbacks.
*
* - mamaDictionary_setErrorCallback ()
* - mamaDictionary_setCompleteCallback ()
* - mamaDictionary_setTimeoutCallback ()
*/
typedef void (MAMACALLTYPE *mamaDictionary_completeCallback)(mamaDictionary,void*);
typedef void (MAMACALLTYPE *mamaDictionary_timeoutCallback)(mamaDictionary,void*);
typedef void (MAMACALLTYPE *mamaDictionary_errorCallback)(mamaDictionary,const char*,void*);
/**
* A structure containing the callbacks for dictionary creation.
*/
typedef struct mamaDictionaryCallbackSet
{
mamaDictionary_completeCallback onComplete;
mamaDictionary_timeoutCallback onTimeout;
mamaDictionary_errorCallback onError;
} mamaDictionaryCallbackSet;
/**
* Create a data dictionary from a subscription.
*
* @param dictionary A pointer for the dictionary being created.
* @param queue The mama queue.
* @param dictionaryCallbacks A mamaDictionaryCallbackSet with the callbacks
* for completion, errors and timeouts.
* @param source The mamaSource identifying the source of the dictionary.
* @param timeout the timeout
* @param retries number of retries
* @param closure A user supplied value passed to the callbacks.
*
*/
MAMAExpDLL
extern mama_status
mama_createDictionary (
mamaDictionary* dictionary,
mamaQueue queue,
mamaDictionaryCallbackSet dictionaryCallbacks,
mamaSource source,
double timeout,
int retries,
void* closure);
/**
* Create an empty mamaDictionary so that can be populated at
* a later stage via a call to buildDictionaryFromMessage () or populated
* manually via calls to addFieldDescriptor ()
*
* @param dictionary The address to where the dictionary will be written
*/
MAMAExpDLL
extern mama_status
mamaDictionary_create (
mamaDictionary* dictionary);
/**
* Destroy this mamaDictionary object and free all its resources.
*
* @param dictionary The dictionary.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_destroy (
mamaDictionary dictionary);
/**
* Return the dictionary source feed name
*
* @param dictionary The dictionary.
* @param result (out) points to the feed name
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFeedName (
mamaDictionary dictionary,
const char** result);
/**
* Return the dictionary source feed host
*
* @param dictionary The dictionary.
* @param result (out) points to the feed host
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFeedHost (
mamaDictionary dictionary,
const char** result);
/**
* Return the mamaFieldDescriptor with the specified field FID. This method
* is very efficient (constant time).
*
* @param dictionary The dictionary.
* @param fid The field id.
* @param result (out) points to the mamaFieldDescriptor (not a copy)
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFieldDescriptorByFid (
mamaDictionary dictionary,
mamaFieldDescriptor* result,
mama_fid_t fid);
/**
* Return the field with the corresponding zero based index. This method
* is O (N) with respect to the size of the dictionary.
*
* @param dictionary The dictionary.
* @param index The zero-based index.
* @param result The result.
*
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFieldDescriptorByIndex (
mamaDictionary dictionary,
mamaFieldDescriptor* result,
unsigned short index);
/**
* Return the descriptor of the field with the specified name. If there
* is more than one field with the same name, the one with the lowest
* field id is returned.
*
* @param dictionary The dictionary.
* @param result the result * or NULL if no such field
* @param fname The name of the field to search for.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFieldDescriptorByName (
mamaDictionary dictionary,
mamaFieldDescriptor* result,
const char* fname);
/**
* Return an array of mamaFieldDescriptor which includes every field
* in the dictionary with the specified name.
* The caller is responsible for allocating descList with room enough
* for all possible duplicate fields (use mamaDictionary_getSize () to
* be safe).
*
* @param dictionary The dictionary.
* @param fname (in) The name to search dictionary for.
* @param descList (out) An array of mamaFieldDescriptor objects, which are
* not copies and should not be destroyed by the caller.
* @param size (out) The final number of entries in descList. The value should
* be intialised to the size allocated to decList. This will be modified to the
* actual number found on return, or will return once this value has been found.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getFieldDescriptorByNameAll (
mamaDictionary dictionary,
const char* fname,
mamaFieldDescriptor* descList,
size_t* size);
/**
* Return the highest field identifier.
*
* @param dictionary The dictionary.
* @param value A pointer that will contain highest FID.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getMaxFid (
mamaDictionary dictionary,
mama_fid_t* value);
/**
* Return the number of fields in the dictionary.
*
* @param dictionary The dictionary.
* @param value The number of entries in the dictionary.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getSize (
mamaDictionary dictionary,
size_t* value);
/**
* Return true if there are multiple fields with the same name.
*
* @param dictionary The dictionary.
* @param value 1 if there are duplicates, 0 otherwise.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_hasDuplicates (
mamaDictionary dictionary,
int* value);
/**
* Build a data dictionary from the specified message.
*
* @param dictionary The dictionary
* @param msg A mamaMsg representing the contents of a data dictionary.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_buildDictionaryFromMessage (
mamaDictionary dictionary,
const mamaMsg msg );
/**
* Get the underlying message for the data dictionary.
*
* A new message instance is created each time this function is called. It is
* the responsibility for the caller to destroy the message when no longer
* required.
*
* @param dictionary The Dictionary
* @param msg The address of the mamaMsg where the result is to be written
*/
MAMAExpDLL
extern mama_status
mamaDictionary_getDictionaryMessage (
mamaDictionary dictionary,
mamaMsg* msg);
/**
* Create a new field descriptor and add it to the dictionary.
* New fields can be added to an existing dictionary obtained
* from the MAMA infrastructure. This function can also be used
* to manually populate a new data dictionary.
*
* @param dictionary The dictionary to which the field is to be added.
* @param fid The fid for the new field descriptor.
* @param name The name for the new field descriptor.
* @param type The type for the new field descriptor.
* @param descriptor The newly created fieldDescriptor. NULL can be specified.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_createFieldDescriptor (
mamaDictionary dictionary,
mama_fid_t fid,
const char* name,
mamaFieldType type,
mamaFieldDescriptor* descriptor);
/**
* Tell the dictionary what the probable maximum fid in the data dictionary
* may be. This is not necessary but will aid performance for manually
* creating a new dictionary or adding new fields to an existing dictionary.
*
* Calling this function ensures that there is capacity in the dictionary for
* field descriptors with fids up to the max specified.
*
* Fields with fids greater than specified can be added to the dictionary
* but this will incur the overhead of allocating more memory and copying
* dictionary elements.
*
* @param dictionary The mamaDictionary.
* @param maxFid The probable maximum fid being added to the dictionary.
*/
MAMAExpDLL
extern mama_status
mamaDictionary_setMaxFid (
mamaDictionary dictionary,
mama_size_t maxFid);
/**
* Write the data dictionary to a file.
* The dictionary will be written in the form:
* fid|fieldName|fieldType
*
* @param dictionary The dictionary to serialize.
* @param fileName The name of the file to serialize the dictionary to. This
* can be a fully qualified name, relative or a file on the
* \$WOMBAT_PATH
*/
MAMAExpDLL
extern mama_status
mamaDictionary_writeToFile (
mamaDictionary dictionary,
const char* fileName);
/**
* Populate a dictionary from the contents of a file.
* Can be used to add additional fields to an existing dictionary or
* to populate a new dictionary.
*
* @param dictionary The dictionary to populate.
* @param fileName The file from which to populate the dictionary. This
* can be a fully qualified name, relative or a file on the
* \$WOMBAT_PATH
*/
MAMAExpDLL
extern mama_status
mamaDictionary_populateFromFile (
mamaDictionary dictionary,
const char* fileName);
#if defined (__cplusplus)
}
#endif
#endif /* MamaDictionaryH__ */
|