The Android Open Source Project | 30957f5 | 2008-10-21 07:00:00 -0700 | [diff] [blame^] | 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_COMPLEX_ARR_EM_H |
| 18 | #define bbs_COMPLEX_ARR_EM_H |
| 19 | |
| 20 | /* ---- includes ----------------------------------------------------------- */ |
| 21 | |
| 22 | #include "b_BasicEm/Context.h" |
| 23 | #include "b_BasicEm/MemSeg.h" |
| 24 | #include "b_BasicEm/Complex.h" |
| 25 | |
| 26 | /* ---- related objects --------------------------------------------------- */ |
| 27 | |
| 28 | /* ---- typedefs ----------------------------------------------------------- */ |
| 29 | |
| 30 | /* ---- constants ---------------------------------------------------------- */ |
| 31 | |
| 32 | /* ---- object definition -------------------------------------------------- */ |
| 33 | |
| 34 | /** complex array */ |
| 35 | struct bbs_ComplexArr |
| 36 | { |
| 37 | |
| 38 | /* ---- private data --------------------------------------------------- */ |
| 39 | |
| 40 | /** pointer to exclusive memory segment used for allocation */ |
| 41 | struct bbs_MemSeg* mspE; |
| 42 | |
| 43 | /* ---- public data ---------------------------------------------------- */ |
| 44 | |
| 45 | /** pointer to array of bytes */ |
| 46 | struct bbs_Complex* arrPtrE; |
| 47 | |
| 48 | /** current size */ |
| 49 | uint32 sizeE; |
| 50 | |
| 51 | /** allocated size */ |
| 52 | uint32 allocatedSizeE; |
| 53 | |
| 54 | }; |
| 55 | |
| 56 | /* ---- associated objects ------------------------------------------------- */ |
| 57 | |
| 58 | /* ---- external functions ------------------------------------------------- */ |
| 59 | |
| 60 | /* ---- \ghd{ constructor/destructor } ------------------------------------- */ |
| 61 | |
| 62 | /** initializes bbs_ComplexArr */ |
| 63 | void bbs_ComplexArr_init( struct bbs_Context* cpA, |
| 64 | struct bbs_ComplexArr* ptrA ); |
| 65 | |
| 66 | /** frees bbs_ComplexArr */ |
| 67 | void bbs_ComplexArr_exit( struct bbs_Context* cpA, |
| 68 | struct bbs_ComplexArr* ptrA ); |
| 69 | |
| 70 | /* ---- \ghd{ operators } -------------------------------------------------- */ |
| 71 | |
| 72 | /** copy operator */ |
| 73 | void bbs_ComplexArr_copy( struct bbs_Context* cpA, |
| 74 | struct bbs_ComplexArr* ptrA, |
| 75 | const struct bbs_ComplexArr* srcPtrA ); |
| 76 | |
| 77 | /** equal operator */ |
| 78 | flag bbs_ComplexArr_equal( struct bbs_Context* cpA, |
| 79 | const struct bbs_ComplexArr* ptrA, |
| 80 | const struct bbs_ComplexArr* srcPtrA ); |
| 81 | |
| 82 | /* ---- \ghd{ query functions } -------------------------------------------- */ |
| 83 | |
| 84 | /** calculates the amount of heap memory needed (16bit words) if created with given parameters */ |
| 85 | uint32 bbs_ComplexArr_heapSize( struct bbs_Context* cpA, |
| 86 | const struct bbs_ComplexArr* ptrA, |
| 87 | uint32 sizeA ); |
| 88 | |
| 89 | /* ---- \ghd{ modify functions } ------------------------------------------- */ |
| 90 | |
| 91 | /** creates bbs_ComplexArr object */ |
| 92 | void bbs_ComplexArr_create( struct bbs_Context* cpA, |
| 93 | struct bbs_ComplexArr* ptrA, |
| 94 | uint32 sizeA, |
| 95 | struct bbs_MemSeg* mspA ); |
| 96 | |
| 97 | /** sets array size */ |
| 98 | void bbs_ComplexArr_size( struct bbs_Context* cpA, |
| 99 | struct bbs_ComplexArr* ptrA, |
| 100 | uint32 sizeA ); |
| 101 | |
| 102 | /* ---- \ghd{ memory I/O } ------------------------------------------------- */ |
| 103 | |
| 104 | /** size in 16-bit words object needs when written to memory */ |
| 105 | uint32 bbs_ComplexArr_memSize( struct bbs_Context* cpA, |
| 106 | const struct bbs_ComplexArr* ptrA ); |
| 107 | |
| 108 | /** writes object to memory; returns number of words (16-bit) written */ |
| 109 | uint32 bbs_ComplexArr_memWrite( struct bbs_Context* cpA, |
| 110 | const struct bbs_ComplexArr* ptrA, |
| 111 | uint16* memPtrA ); |
| 112 | |
| 113 | /** reads object from memory; returns number of words (16-bit) read */ |
| 114 | uint32 bbs_ComplexArr_memRead( struct bbs_Context* cpA, |
| 115 | struct bbs_ComplexArr* ptrA, |
| 116 | const uint16* memPtrA, |
| 117 | struct bbs_MemSeg* mspA ); |
| 118 | |
| 119 | /* ---- \ghd{ exec functions } --------------------------------------------- */ |
| 120 | |
| 121 | #endif /* bbs_COMPLEX_ARR_EM_H */ |
| 122 | |