HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
object.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2013 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 #ifndef _OBJECT_H
26 #define _OBJECT_H
27 
28 #include <stddef.h>
29 #include <assert.h>
30 #include "hbbtv_js.h"
31 
32 #define JS_CHECK_OBJECT(o, c) \
33  assert(((o) != NULL) && \
34  ((S_JS_OBJECT *)(o))->vtab == (c))
35 
36 #define JS_INC_OBJ_REF(o) (o == NULL) ? HBBTV_JSObject_DbgNull(__FILE__, __LINE__) : HBBTV_JSObject_incref(o)
37 
38 #define HBBTV_UNUSED_OBJ(x) if (x) {}
39 
40 typedef struct
41 {
42  void *(*create)(void);
43  void (*release)(void *obj);
44  HBBTV_JSObjType_CONST type;
45 #ifdef DEBUG_JS_OBJECTS
46  const char *name;
47  const char *(*objstr)(void *obj);
48 #endif
50 
51 typedef struct s_obj_reference
52 {
53  void *reference;
54  struct s_obj_reference *next;
56 
57 typedef struct
58 {
59  S_JS_OBJ_VTAB *vtab;
60  S32BIT refcount;
61  S_OBJ_REFERENCE *referenceList;
62  void *referenceSemaphore;
63  U32BIT extReferenceCount;
64 } S_JS_OBJECT;
65 
66 #ifdef DEBUG_JS_OBJECTS
67 void HBBTV_JSObjectPrint(void);
68 #endif
69 
76 
77 void* HBBTV_JSObject_DbgNull(char *file, int line);
78 
79 #endif /* _OBJECT_H */
Definition: object.h:51
Definition: object.h:57
Definition of functions implementing the HbbTV Javascript extension.
Definition: object.h:40
void * HBBTV_JSObjectCreate(S_JS_OBJ_VTAB *vtab)
Initialise an object.
Definition: object.c:161