home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / base / objseq.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  3KB  |  98 lines

  1.  
  2.  
  3. #ifndef _objseq_h_ /* Wed Apr 20 22:52:00 1994 */
  4. #define _objseq_h_
  5.  
  6.  
  7.  
  8.  
  9.  
  10. /*
  11.  *
  12.  *          Copyright (C) 1994, M. A. Sridhar
  13.  *  
  14.  *
  15.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  16.  *     to copy, modify or distribute this software  as you see fit,
  17.  *     and to use  it  for  any  purpose, provided   this copyright
  18.  *     notice and the following   disclaimer are included  with all
  19.  *     copies.
  20.  *
  21.  *                        DISCLAIMER
  22.  *
  23.  *     The author makes no warranties, either expressed or implied,
  24.  *     with respect  to  this  software, its  quality, performance,
  25.  *     merchantability, or fitness for any particular purpose. This
  26.  *     software is distributed  AS IS.  The  user of this  software
  27.  *     assumes all risks  as to its quality  and performance. In no
  28.  *     event shall the author be liable for any direct, indirect or
  29.  *     consequential damages, even if the  author has been  advised
  30.  *     as to the possibility of such damages.
  31.  *
  32.  */
  33.  
  34.  
  35.  
  36.  
  37. // The ObjectSequence is a derived class, rather than a typedef, so that
  38. // we can support storage and retrieval of object sequences.
  39.  
  40.  
  41.  
  42. #ifdef __GNUC__
  43. #pragma interface
  44. #endif
  45.  
  46.  
  47. #include "base/sequence.h"
  48. #include "base/iofilter.h"
  49.  
  50.  
  51. class CL_EXPORT CL_ObjectSequence: public CL_Sequence<CL_ObjectPtr> {
  52.  
  53. public:
  54.  
  55.     CL_ObjectSequence (long initial_size = 0,
  56.                        CL_ObjectIOFilter* builder = NULL);
  57.     // The second parameter specifies an object builder function; it will
  58.     // only be used by the ReadFrom method when this sequence needs to be
  59.     // read from a stream, to construct an object from its passive
  60.     // representation in the stream. If the second parameter is NULL, the
  61.     // ReadFrom method will always return FALSE. The builder object is
  62.     // {\it not\/} owned by the sequence, but it must
  63.     // exist as long as the sequence does.
  64.     
  65.  
  66.     CL_ObjectSequence (const CL_ObjectPtr data[], long count,
  67.                        CL_ObjectIOFilter* builder = NULL);
  68.     // Create ourselves from a C-style array.
  69.     
  70.     CL_ObjectSequence (const CL_ObjectSequence& s);
  71.     // Copy constructor.
  72.  
  73.     ~CL_ObjectSequence ();
  74.     // Destructor.
  75.  
  76.     
  77.     void DestroyContents ();
  78.     // Invoke the destructors of all the contained objects, and set our
  79.     // size to zero. Note that this is not the same as the inherited
  80.     // method MakeEmpty, since the latter does not destroy contained
  81.     // objects.
  82.  
  83.     bool ReadFrom (const CL_Stream& s);
  84.     // Reconstruct this ObjectSequence from the given stream, using the
  85.     // builder specified at construction time.
  86.     
  87.  
  88.     CL_ClassId ClassId() const {return _CL_ObjectSequence_CLASSID;};
  89.     
  90.     const char* ClassName () const {return "CL_ObjectSequence";};
  91.     
  92. protected:
  93.     CL_ObjectIOFilter* _builder;
  94. };
  95.  
  96.  
  97. #endif /* _objseq_h_ */
  98.