--- parser3/src/main/Attic/pa_array.C 2001/01/27 15:00:04 1.1 +++ parser3/src/main/Attic/pa_array.C 2001/01/27 15:45:24 1.3 @@ -1,5 +1,5 @@ /* - $Id: pa_array.C,v 1.1 2001/01/27 15:00:04 paf Exp $ + $Id: pa_array.C,v 1.3 2001/01/27 15:45:24 paf Exp $ */ #include @@ -15,10 +15,14 @@ void Array::construct(Pool *apool, int i curr_chunk_rows=initial_rows; head=static_cast( pool->malloc(sizeof(int)+sizeof(Chunk::Row)*curr_chunk_rows+sizeof(Chunk *))); + head->count=curr_chunk_rows; append_here=head->rows; link_row=&head->rows[curr_chunk_rows]; link_row->link=0; fused_rows=0; + + cache_chunk_base=0; + cache_chunk=head; } void Array::expand() { @@ -65,4 +69,34 @@ break2: *copy_here=0; return result; } -*/ \ No newline at end of file +*/ +/* +void Array::put(int index, Item item) { +} + +Array::Item Array::get(int index) { +} +*/ + +Array::Item& Array::operator [] (int index) { + if(!(index>=0 && index=cache_chunk_base && indexcount)) { + int count=cache_chunk->count; + cache_chunk_base+=count; + cache_chunk=cache_chunk->rows[count].link; + } + + return cache_chunk->rows[index-cache_chunk_base].item; +} \ No newline at end of file