Free
Frees all image data memory associated with the XL buffer.
Syntax
void Free();
Parameters
None
Returns
None
Required Headers
CXLBuffer.h
Namespace
arc
Throws
None
Remarks
Example
        // This code demonstrates how to create an XL Buffer,
        // fill it with data, and then clear it.

        #include <iostream>
        #include "CXLBuffer.h"
        #include "CFitsFile.h"

        using namespace std;
        using namespace arc;

        int main()
        {
            long lRows       = 10500;
            long lCols       = 10500;
            long lPixelCount = lXLRows * lXLCols;
            long lNumOfBuffs = lPixelCount / ( lRows * lCols );
            long l           = 0;
            unsigned short *pBuffer = NULL;

            try
            {
                CXLBuffer<unsigned short> cXLBuff;

                //
		        // Create a buffer for writing to the XL buffer
		        //
		        pBuffer = new unsigned short[ lRows * lCols ];

		        for ( l=0; l<lNumOfBuffs; l++ )
		        {
			        //
			        // Fill the buffer
			        //
        #ifdef WIN32
			        FillMemory( pBuffer, sizeof( unsigned short ) * lRows * lCols, l );
        #else
			        memset( pBuffer, l, sizeof( unsigned short ) * lRows * lCols );
        #endif

			        //
			        // Add the buffer to the XL buffer
			        //
                    cout << "Adding " << ( lRows * lCols * sizeof( unsigned short ) )
                         << " bytes to sub-buffer " << l << " ... ";

			        cXLBuff.Append( pBuffer, lRows * lCols );

			        cout << "success" << endl;
		        }
		        delete [] pBuffer;

                //
                // Clear the XL buffer
                //
                cXLBuff.Clear();

		        //
		        // Free the XL buffer
		        //
		        cXLBuff.Free();
	        }
	        catch ( bad_alloc &memAllocException )
	        {
		        cout << endl << "MemoryAllocationException: "
                     << memAllocException.what() << endl;
	        }
	        catch( exception e )
	        {
		        cout << endl << e.what() << endl;
	        }
        }

© Astronomical Research Cameras, Inc.