Vblock(3C++)


Vblock -- Similar to Block

Synopsis

   # include <Vblock.h>
   

template <class T> class Vblock{ public: // similar to Block(3C++) };

Description

A Vblock is just like a Block (see Block(3C++)), except that (for technical reasons having to do with G2++) some of its member functions are virtual. If a G2++ record definition (see G2++.4C++) specifies an array, the corresponding declaration generated by g2++comp(1C++) in the .h file will contain a Vblock (see the Example).

Example

When compiled by g2++comp(1C++), the following record definition

       usr.g
           usr
                   name    *
                   proj
                           *(100)  LONG

generates a .h file containing the following:

       usr.h
           ... 
           typedef struct USR{
                   String name;
                   Vblock<LONG>     proj;
                   USR();
           }USR;

A client program may manipulate the proj field just as though it were a Block, e.g.,

           #include "usr.h"
           main(){
               USR u;
               for(int i=0;i<100;i++){
                   u.proj.reserve(i);
                   u.proj[i] = i;
               }
           }

References

Block(3C++), G2++(3C++), g2++comp(1C++), typed_io(3C++)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004