• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef bbs_UINT32ARR_EM_H
18 #define bbs_UINT32ARR_EM_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/MemSeg.h"
24 
25 /* ---- related objects  --------------------------------------------------- */
26 
27 /* ---- typedefs ----------------------------------------------------------- */
28 
29 /* ---- constants ---------------------------------------------------------- */
30 
31 /* ---- object definition -------------------------------------------------- */
32 
33 /** byte array */
34 struct bbs_UInt32Arr
35 {
36 
37 	/* ---- private data --------------------------------------------------- */
38 
39 	/** pointer to exclusive memory segment used for allocation */
40 	struct bbs_MemSeg* mspE;
41 
42 	/* ---- public data ---------------------------------------------------- */
43 
44 	/** pointer to array of uint32 */
45 	uint32* arrPtrE;
46 
47 	/** current size */
48 	uint32 sizeE;
49 
50 	/** allocated size */
51 	uint32 allocatedSizeE;
52 
53 };
54 
55 /* ---- associated objects ------------------------------------------------- */
56 
57 /* ---- external functions ------------------------------------------------- */
58 
59 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
60 
61 /** initializes bbs_UInt32Arr  */
62 void bbs_UInt32Arr_init( struct bbs_Context* cpA,
63 						 struct bbs_UInt32Arr* ptrA );
64 
65 /** frees bbs_UInt32Arr  */
66 void bbs_UInt32Arr_exit( struct bbs_Context* cpA,
67 						 struct bbs_UInt32Arr* ptrA );
68 
69 /* ---- \ghd{ operators } -------------------------------------------------- */
70 
71 /** copy operator */
72 void bbs_UInt32Arr_copy( struct bbs_Context* cpA,
73 						 struct bbs_UInt32Arr* ptrA,
74 						 const struct bbs_UInt32Arr* srcPtrA );
75 
76 /** equal operator */
77 flag bbs_UInt32Arr_equal( struct bbs_Context* cpA,
78 						  const struct bbs_UInt32Arr* ptrA,
79 						  const struct bbs_UInt32Arr* srcPtrA );
80 
81 /* ---- \ghd{ query functions } -------------------------------------------- */
82 
83 /** calculates the amount of heap memory needed (16bit words) if created with given parameters */
84 uint32 bbs_UInt32Arr_heapSize( struct bbs_Context* cpA,
85 							   const struct bbs_UInt32Arr* ptrA,
86 							   uint32 sizeA );
87 
88 /* ---- \ghd{ modify functions } ------------------------------------------- */
89 
90 /** allocates memory for bbs_UInt32Arr */
91 void bbs_UInt32Arr_create( struct bbs_Context* cpA,
92 						   struct bbs_UInt32Arr* ptrA,
93 						  uint32 sizeA,
94 						  struct bbs_MemSeg* mspA );
95 
96 /** sets array size */
97 void bbs_UInt32Arr_size( struct bbs_Context* cpA,
98 						 struct bbs_UInt32Arr* ptrA, uint32 sizeA );
99 
100 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
101 
102 /** size object needs when written to memory */
103 uint32 bbs_UInt32Arr_memSize( struct bbs_Context* cpA,
104 							  const struct bbs_UInt32Arr* ptrA );
105 
106 /** writes object to memory; returns number of bytes written */
107 uint32 bbs_UInt32Arr_memWrite( struct bbs_Context* cpA,
108 							   const struct bbs_UInt32Arr* ptrA,
109 							   uint16* memPtrA );
110 
111 /** reads object from memory; returns number of bytes read */
112 uint32 bbs_UInt32Arr_memRead( struct bbs_Context* cpA,
113 							  struct bbs_UInt32Arr* ptrA,
114 							 const uint16* memPtrA,
115 							 struct bbs_MemSeg* mspA );
116 
117 /* ---- \ghd{ exec functions } --------------------------------------------- */
118 
119 /** fills array with a value */
120 void bbs_UInt32Arr_fill( struct bbs_Context* cpA,
121 						 struct bbs_UInt32Arr* ptrA,
122 						 uint32 valA );
123 
124 #endif /* bbs_UINT32ARR_EM_H */
125 
126