## ## OSSP act - Abstract Container Types ## Copyright (c) 1999-2003 Ralf S. Engelschall ## Copyright (c) 1999-2003 The OSSP Project ## ## This file is part of OSSP act, an abstract container type library ## which can be found at http://www.ossp.org/pkg/lib/act/. ## ## Permission to use, copy, modify, and distribute this software for ## any purpose with or without fee is hereby granted, provided that ## the above copyright notice and this permission notice appear in all ## copies. ## ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ## SUCH DAMAGE. ## ## act.pod: manual page ## =pod =head1 NAME B -- Bbstracted Bontainer Bypes =head1 GLOBAL SYNOPSIS The following synopsis applies to all container types. B =over 4 =item act_ctx_t I; Declare a context object I for container type I. =item act_ctx_t B(void); Create a new context object, initialized with default context information. =item act_ctx_t B(act_ctx_t I); Duplicate context object I. =item void B(act_ctx_t I); Reset object to default ingredients. =item long B(act_ctx_t I, I, ...) Control or query various ingredients of context object I by sending it the command I. The following Is exists for all container types: ... =item void B(act_ctx_t I); Destroy the context object I. =back B =over 4 =item I_t I; Declare an object I of a container type I. =item I_t I_B(I_ctx_t I, ...); Create a new (empty) object of container type I. Usually one also specifies the type or size of the to be contained data. =item I_ctx_t I_B(I_t I); Duplicate object I. =item void I_B(I_t I); Clean out the object. =item I_t I_B(I_t *I, unsigned char **I, long I); Create a new (initialized) object of container type I in object I from an object stream (previously created with a I_B) under I with len I. The pointer I is incremented by the number of actually read bytes. =item long I_B(I_t I, unsigned char **I); Streamline container type object I into an object stream under I. Returns the number of written number bytes and increments I by this number. =item long I_B(I_t I, I, ...) Control or query various ingredients of container object I by sending it the command I. The following Is exists for all container types: I_C (peeks the number of contained data elements), I_C (peeks the total number of memory bytes the object is in size), I_C (sets the malloc(3) function to use), I_C (sets the realloc(3) function to use), I_C (sets the free(3) function to use), I_C (sets the fatal error function to use). =item I I_I(I_t I, [ I<...> ]); Perform I on object I of container type I. The available Is are dependent on the container type itself. Read below for more details. =item void I_B(I_t I); Destroy the object I of container type I. =back =head1 OVERVIEW The following container type data structures exists: =over 4 =item B - Bit Vector (Bit Mask) A bit vector type implemented by an array of bits. The elements are of type B. The usual use case is a mathematical set or a feature set mask. Specific Operations: B(k,v), B(k), B(k), B. =item B - Byte Buffer (Octet Stream) A buffer type implemented by an array of bytes. The elements are of type B. The usual use case is an I/O buffer or the underlaying object of a string type. Specific Operations: B, B, B, B, B, B. =item B - Array A generic array type implemented by a pointer array. The elements are of type B. The usual use case is for stroring arbitrary data where elements are accessed by index positions and where more read-only operations are performed than read/write operations. Specific Operations: B, B, B, B, B =item B - Linear List This is a generic list type implemented by lineary chained nodes. The elements are of type B. The usual use cases are sorted list, queue and stack and where read/write operations occur often. Specific Operations: B, B, B, B, B =item B - Hierarchical Tree This is a generic tree type implemented by hierachically chained nodes. The elements are of type B. The usual use case is for storing hierachical structures. Specific Operations: B, B, B, B, B =item B - Hashing Table This is a generic table type implemented by a hash. The elements are of type B. The usual use case is for storing elements which are accessed by a unique key and where lookup operation occur more often than store operations. Specific Operations: B, B, B, B, B =back =head1 DESCRIPTION =head2 Bit Vector (bits) B =over 4 =item bits_t B(unsigned int I); Create a new bit vector with I initial bits. =item bits_t B(bits_t *I, unsigned char **I, long I); Create bit vector object in I from I/I. =item long B(bits_t I, unsigned char **I); Streamline I into I. =item long B(bits_t I, I, ...) Send I to bit vector object I. =item void B(bits_t I); Destroy the bit vector object I. =back B =over 4 =item int B(bits_t I, I); Set the I bit. =item int B(bits_t I, I); Clear the I bit. =item int B(bits_t I, I); Test whether the I bit is set. =back =head2 Byte Buffer (buf) =head2 Array (array) =head2 Linear List (list) =head2 Hierarchical Tree (tree) =head2 Hash Table (hash) =cut