home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
-
-
- Class: Big2D
-
- This class implements two dimensional arrays that can be larger than
- 32K and store any kind of elements.
-
- By: Eric Yiskis
- November 19, 1989
-
- ******************************************************************************/
-
- #define _H_CBig2D
-
- #include <Global.h> /* handy declarations */
- #include <CObject.h> /* Interface for its superclass */
- #include <CDataFile.h>
- #include <CApplication.h>
-
- extern CApplication *gApplication;
-
- /*-------------------------------------------------------------------------------*/
-
- typedef struct {
- int nXLimit,nYLimit; /* X and Y dimensions of array */
- int nElementSize; /* length in bytes of each element */
- } AMFData2D; /* Array Mapping Function data */
-
- /*-------------------------------------------------------------------------------*/
-
- struct CBig2D : CObject {
-
- /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
- /* Instance Variables */
-
- Handle hData;
- AMFData2D amf;
-
- /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
- /* Instance Methods */
-
- /*-- Creation/Termination --*/
- void IBig2D(void);
- /* pre - Object has been allocated but not initialized */
- /* post- Object has been initialized */
-
- Boolean CreateData(int nXMax,int nYMax,int nElementSizeIn,Handle hDataIn);
- /* pre - Object has been initialized but not created by CreateData or */
- /* LoadData. */
- /* hDataIn contains NULL or contains data that matches nXMax */
- /* nYMax, and nElementSizeIn dimension parameters. */
- /* post- if hDataIn == NULL, returns TRUE if array matching the */
- /* dimensions could be allocated, otherwise returns FALSE. */
- /* if hDataIn != NULL, hDataIn is assumed to be an array that */
- /* matches the dimension parameters. */
- /* note- If loading an object from a file, use the LoadData method to */
- /* instead. */
-
- void Dispose(void); /* OVERRIDE */
-
-
- /*-- Element Manipulation --*/
- void SetValue(int nX,int nY,char *pSource);
- /* pre - Object has been created by CreateData or LoadData methods */
- /* post- data at pSource is copied into location nX,nY */
-
- void GetValue(int nX,int nY,char *pDestination);
- /* pre - Object has been created by CreateData or LoadData methods */
- /* post- data at pSource is copied into location nX,nY */
-
- /*-- I/O --*/
- OSErr LoadData(CDataFile *datafile);
- /* pre - Object has been initialized but not created by CreateData or */
- /* LoadData. */
- /* datafile is open. */
- /* post- returns the error condition of the attempt to read. */
- /* if the error condition == NoErr then the object is */
- /* initialized with the data from datafile. */
-
- OSErr SaveData(CDataFile *datafile);
- /* pre - Object has been created by CreateData or LoadData methods */
- /* datafile is open. */
- /* post- returns the error condition of the attempt to write. */
- /* if the error condition == NoErr then the data has been written */
-
-
- /*-- Misc --*/
- void GetDimensions(int *nX, int *nY, int *nElementSizeOut);
- /* pre - Object has been created by CreateData or LoadData methods */
- /* post- parameters contain dimensions of the array. */
-
- Handle GetData(void);
- /* pre - Object has been created by CreateData or LoadData methods */
- /* post- Returns a handle to the data. */
-
- /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
- /* private */
-
- long Offset(int nX,int nY);
- /* returns offset (bytes) of element from the beginning of the data handle */
- };
-