home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / hl10osrc.lzh / Include / Card.h next >
Text File  |  1994-04-23  |  2KB  |  67 lines

  1. /* -*- Mode: C -*- */
  2. /* Card.h - Structure for representing catalog cards
  3.  * Created by Robert Heller on Fri Dec  6 20:11:05 1991
  4.  *
  5.  * ------------------------------------------------------------------
  6.  * Home Libarian by Deepwoods Software
  7.  * Common Header Files
  8.  * ------------------------------------------------------------------
  9.  * Modification History:
  10.  * ------------------------------------------------------------------
  11.  * Contents:
  12.  * ------------------------------------------------------------------
  13.  * 
  14.  * 
  15.  * Copyright (c) 1991,1992 by Robert heller (D/B/A Deepwoods Software)
  16.  *        All Rights Reserved
  17.  * 
  18.  */
  19. #ifndef _CARD_
  20. #define _CARD_
  21. #include <common.h>        // common defs
  22.  
  23. // Card class.  This class is really just a structure pointing to
  24. // various pieces of data describing an item in the library.
  25. // To avoid pounding on the simple heap memory management,  Cards are
  26. // allocated 100 at a time (upto a max of 100,000 cards), and "old"
  27. // cards are reused, rather than returned to the general heap.
  28. class Card {
  29.     const blocksize = 100;    // number of cards to allocate at a time
  30.     const maxblocks = 1000;    // maximum number blocks to allocate
  31.     static int numblocks;    // current number of allocated blocks
  32.     static Card* blocks[maxblocks]; // allocated cards
  33.     static Card* freelist;    // linked list of available cards
  34.     void   moreblocks();    // internal function to get another block of cards
  35. public:
  36.     CardType type;        // Type of item (book, magazine, etc.)
  37.     char* author;        // Who wrote it.
  38.     char* title;        // What it is called
  39.     char* publisher;    // Who published it
  40.     char* city;        // Where it was published
  41.     char* description;    // What is it really??
  42.     int vol;        // If multi-volume
  43.     int year;        // Year it was published
  44.           Card()        // New blank card
  45.         {Card(Other,"Unknown","Unknown","Unknown","Unknown","",0,0);}
  46.                 // New initialized card
  47.           Card(CardType type,char* author,char* title,char* publisher,
  48.                char* city,char* description,int vol,int year)
  49.             {
  50.                 Card::type = type;
  51.                 Card::author = author;
  52.                 Card::title = title;
  53.                 Card::publisher = publisher;
  54.                 Card::city = city;
  55.                 Card::description = description;
  56.                 Card::vol = vol;
  57.                 Card::year = year;
  58.             }
  59.     void* operator new (long bytes);    // dyn. allocated card
  60.     void  operator delete  (void* ptr);    // free a dyn. allocated card
  61. };
  62.  
  63. extern char* TypeName(CardType);
  64. extern CardType NameType(char*);
  65. extern Boolean CardTypeNameP(char*);
  66. #endif
  67.