MHEG5  15.3.0
source/classes/inc/mh5variable.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  * Copyright © 2000 Koninklijke Philips Electronics N.V
00005  *
00006  * This file is part of a DTVKit Software Component
00007  * You are permitted to copy, modify or distribute this file subject to the terms
00008  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00009  * 
00010  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00011  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00012  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  * If you or your organisation is not a member of DTVKit then you have access
00015  * to this source code outside of the terms of the licence agreement
00016  * and you are expected to delete this and any associated files immediately.
00017  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00018  *******************************************************************************/
00032 #ifndef _MH5VARIABLE_H
00033 #define _MH5VARIABLE_H
00034 
00035 /*---includes for this file--------------------------------------------------*/
00036 #include "mh5ingredient.h"
00037 
00038 /*---Constant and macro definitions for public use---------------------------*/
00039 
00040 /*---Enumerations for public use---------------------------------------------*/
00041 
00042 /*---Global type defs for public use-----------------------------------------*/
00043 typedef struct
00044 {
00045    /* Base class */
00046    MHEG5Ingredient ingredient;
00047 
00048    /* Exchanged attributes (from Variable class) */
00049    MHEG5Bool originalValue;
00050 
00051    /* Internal attributes (from Variable class) */
00052    MHEG5Bool value;
00053 } MHEG5BooleanVariable;
00054 
00055 
00056 typedef struct
00057 {
00058    /* Base class */
00059    MHEG5Ingredient ingredient;
00060 
00061    /* Exchanged attributes (from Variable class) */
00062    MHEG5Int originalValue;
00063 
00064    /* Internal attributes (from Variable class) */
00065    MHEG5Int value;
00066 } MHEG5IntegerVariable;
00067 
00068 
00069 typedef struct
00070 {
00071    /* Base class */
00072    MHEG5Ingredient ingredient;
00073 
00074    /* Exchanged attributes (from Variable class) */
00075    MHEG5String originalValue;
00076 
00077    /* Internal attributes (from Variable class) */
00078    MHEG5String value;
00079 } MHEG5OctetStringVariable;
00080 
00081 
00082 typedef struct
00083 {
00084    /* Base class */
00085    MHEG5Ingredient ingredient;
00086 
00087    /* Exchanged attributes (from Variable class) */
00088    MH5GroupRef originalValueGid;
00089    MHEG5Int originalValueId;
00090 
00091    /* Internal attributes (from Variable class) */
00092    MHEG5Int valueId;
00093    MHEG5String valueGrp;
00094 } MHEG5ObjectRefVariable;
00095 
00096 
00097 typedef struct
00098 {
00099    /* Base class */
00100    MHEG5Ingredient ingredient;
00101 
00102    /* Exchanged attributes (from Variable class) */
00103    MHEG5String originalContentData;
00104 
00105    /* Internal attributes (from Variable class) */
00106    MHEG5String contentData;
00107 } MHEG5ContentVariable;
00108 
00109 /*---Global variable declarations for public use-----------------------------*/
00110 
00111 /*---Global Function prototypes for public use-------------------------------*/
00112 
00123 void MHEG5booleanVariableInit(MHEG5BooleanVariable *variable);
00124 
00125 
00132 void MHEG5booleanVariablePrepare(MHEG5BooleanVariable *variable);
00133 
00134 
00142 void MHEG5booleanVariableFree(MHEG5BooleanVariable *variable);
00143 
00144 
00150 void MHEG5integerVariableInit(MHEG5IntegerVariable *variable);
00151 
00152 
00159 void MHEG5integerVariablePrepare(MHEG5IntegerVariable *variable);
00160 
00161 
00169 void MHEG5integerVariableFree(MHEG5IntegerVariable *variable);
00170 
00171 
00177 void MHEG5octetStringVariableInit(MHEG5OctetStringVariable *variable);
00178 
00179 
00186 void MHEG5octetStringVariablePrepare(
00187    MHEG5OctetStringVariable *variable);
00188 
00189 
00197 void MHEG5octetStringVariableFree(MHEG5OctetStringVariable *variable);
00198 
00199 void MHEG5octetStringVariableDestruct(MHEG5OctetStringVariable *variable);
00200 
00206 void MHEG5objectRefVariableInit(MHEG5ObjectRefVariable *variable);
00207 
00214 void MHEG5objectRefVariablePrepare(
00215    MHEG5ObjectRefVariable *variable);
00216 
00217 
00225 void MHEG5objectRefVariableFree(MHEG5ObjectRefVariable *variable);
00226 
00227 
00233 void MHEG5contentVariableInit(MHEG5ContentVariable *variable);
00234 
00235 
00242 void MHEG5contentVariablePrepare(MHEG5ContentVariable *variable);
00243 
00244 
00252 void MHEG5contentVariableFree(MHEG5ContentVariable *variable);
00253 
00254 void MHEG5contentVariableDestruct(MHEG5ContentVariable *variable);
00255 
00256 void MHEG5objRefStoreValue( MHEG5ObjectRefVariable *objRef, MH5GroupRef ref, MHEG5Int id );
00257 void MHEG5objRefStoreString( MHEG5ObjectRefVariable *objRef, MHEG5String ref, MHEG5Int id );
00258 
00259 /*
00260     Internal behaviours
00261  */
00262 void MHEG5variablePrepare(MHEG5Ingredient *variable);
00263 void MHEG5variableActivate(MHEG5Ingredient *variable);
00264 void MHEG5variableDeactivate(MHEG5Ingredient *variable);
00265 void MHEG5variableDestruct(MHEG5Ingredient *variable);
00266 
00267 /*
00268     Actions
00269  */
00270 MHEG5ErrorCode MHEG5setVariable(MHEG5Root *target, MHEG5GList *params);
00271 MHEG5ErrorCode MHEG5testVariable(MHEG5Root *target, MHEG5GList *params);
00272 MHEG5ErrorCode MHEG5add(MHEG5Root *target, MHEG5GList *params);
00273 MHEG5ErrorCode MHEG5subtract(MHEG5Root *target, MHEG5GList *params);
00274 MHEG5ErrorCode MHEG5multiply(MHEG5Root *target, MHEG5GList *params);
00275 MHEG5ErrorCode MHEG5divide(MHEG5Root *target, MHEG5GList *params);
00276 MHEG5ErrorCode MHEG5modulo(MHEG5Root *target, MHEG5GList *params);
00277 MHEG5ErrorCode MHEG5append(MHEG5Root *target, MHEG5GList *params);
00278 
00279 /*
00280     Store/Read Persistant helper functions
00281  */
00282 /*
00283    Store the value of the Variable in the Buffer and Return number of Bytes used.
00284    Return -1 for failure
00285  */
00286 MHEG5Int MHEG5variableStore(MHEG5Ingredient *v, void *buf, MHEG5Int bufLen);
00287 
00288 /*
00289    Set the Variable to the Buffer values and Return the Number of Bytes read.
00290    Return -1 for failure
00291  */
00292 MHEG5Int MHEG5variableRead(MHEG5Ingredient *v, char *buf, MHEG5Int max_size);
00293 
00294 /*
00295    Debug
00296  */
00297 #ifdef MH5PRINTOUT
00298 
00305 void MHEG5variablePrint(MHEG5Ingredient *variable, char *out);
00306 
00314 void MHEG5booleanVariablePrint(MHEG5BooleanVariable *v, char *out);
00315 
00323 void MHEG5integerVariablePrint(MHEG5IntegerVariable *v, char *out);
00324 
00332 void MHEG5stringVariablePrint(MHEG5OctetStringVariable *v, char *out);
00333 
00341 void MHEG5oRefVariablePrint(MHEG5ObjectRefVariable *v, char *out);
00342 
00350 void MHEG5cRefVariablePrint(MHEG5ContentVariable *v, char *out);
00351 
00352 #endif /* MH5PRINTOUT */
00353 
00354 
00355 #endif /*_MH5VARIABLE_H*/
 All Data Structures Files Functions Variables Typedefs Defines