Index: trunk/archive/scripts/src/papFocalPlane.h
===================================================================
--- trunk/archive/scripts/src/papFocalPlane.h	(revision 4092)
+++ trunk/archive/scripts/src/papFocalPlane.h	(revision 4309)
@@ -3,12 +3,19 @@
 
 #include "pslib.h"
+#include "papStuff.h"
+
+// Temporary metadata types
+#define PS_META_CHIP PS_META_UNKNOWN
+#define PS_META_CELL PS_META_UNKNOWN
+
 
 typedef struct {
     // How to get information
-    psMetadata *defaults;		// IPP concepts supplied with defaults
-    psMetadata *database;		// IPP concepts supplied from database lookup
-    psMetadata *fits;			// IPP concepts supplied from FITS headers
-
+    const psMetadata *defaults;		// IPP concepts supplied with defaults
+    const psMetadata *database;		// IPP concepts supplied from database lookup
+    const psMetadata *fits;		// IPP concepts supplied from FITS headers
+    
     // A source of information
+    psMetadata *values;			// Important values (cached)
     psMetadata *header;			// The FITS header
     psDB *db;				// The database handle
@@ -17,6 +24,6 @@
     psMetadata *chips;			// The chips (referred to by name)
 
-    psImage *image;			// The pixel data, if it corresponds to this level
-} psFPA;
+    psArray *images;			// The pixel data, if it corresponds to this level
+} papFPA;
 
 typedef struct {
@@ -28,6 +35,6 @@
     psMetadata *cells;			// The cells (referred to by name)
 
-    psImage *image;			// The pixel data, if it corresponds to this level
-} psChip;
+    psArray *images;			// The pixel data, if it corresponds to this level
+} papChip;
 
 typedef struct {
@@ -39,6 +46,6 @@
     psArray *readouts;			// The readouts (referred to by number)
 
-    psImage *image;			// The pixel data, if it corresponds to this level
-} psCell;
+    psArray *images;			// The pixel data, if it corresponds to this level
+} papCell;
 
 
@@ -53,9 +60,9 @@
     psList *overscans;			// Array of subimages containing the overscan region(s)
     psMetadata* values;			// readout-level metadata
-} psReadout;
+} papReadout;
 
 
 // Look for a particular value for a given cell (referred to by FPA+chip+cell)
-psMetadataItem *psCellGetValue(const psFPA *fpa, // The FPA that contains the cell
+psMetadataItem *psCellGetValue(papFPA *fpa, // The FPA that contains the cell
 			       const char *chipName, // The name of the chip
 			       const char *cellName, // The name of the cell
@@ -64,20 +71,20 @@
 
 // Type-specific functions provided as a convenience to the user
-float psCellGetValueF32(const psFPA *fpa, // The FPA that contains the cell
+float psCellGetValueF32(papFPA *fpa, // The FPA that contains the cell
 			const char *chipName, // The name of the chip
 			const char *cellName, // The name of the cell
 			const char *valueName // Name of value
 			);
-int psCellGetValueS32(const psFPA *fpa, // The FPA that contains the cell
+int psCellGetValueS32(papFPA *fpa, // The FPA that contains the cell
 		      const char *chipName, // The name of the chip
 		      const char *cellName, // The name of the cell
 		      const char *valueName // Name of value
 		      );
-double psCellGetValueF64(const psFPA *fpa, // The FPA that contains the cell
+double psCellGetValueF64(papFPA *fpa, // The FPA that contains the cell
 			 const char *chipName, // The name of the chip
 			 const char *cellName, // The name of the cell
 			 const char *valueName // Name of value
 			 );
-psString psCellGetValueString(const psFPA *fpa, // The FPA that contains the cell
+psString psCellGetValueString(papFPA *fpa, // The FPA that contains the cell
 			      const char *chipName, // The name of the chip
 			      const char *cellName, // The name of the cell
@@ -86,3 +93,30 @@
 
 
+// Allocators and deallocators
+papFPA *papFPAAlloc(psMetadata *fits, // FITS translation info
+		    psMetadata *database, // Database lookup info
+		    psMetadata *defaults, // Defaults info
+		    psDB *db		// Database handle
+    );
+void p_papFPAFree(papFPA *fpa);
+
+papChip *papChipAlloc(papFPA *fpa,		// FPA to which the chip belongs
+		    const char *name	// Name of the chip
+    );
+void p_papChipFree(papChip *chip);
+
+papCell *papCellAlloc(papChip *chip,	// Chip to which the cell belongs
+		    const char *name,	// Name of the cell
+		    int nReadouts	// Number of readouts contained
+    );
+void p_papCellFree(papCell *cell);
+
+papReadout *papReadoutAlloc(papCell *cell,	// Cell to which the readout belongs
+			  int readoutNum, // Number of the readout
+			  psImage *image, // The pixels
+			  psList *overscans, // The overscan images
+			  int col0, int row0, int colParity, int rowParity, int colBin, int rowBin // Data
+    );
+void p_papReadoutFree(papReadout *readout);
+
 #endif
