#ifndef CCMIO_PRIVATE_H
#define CCMIO_PRIVATE_H

/*@@
 *  Program: Star File Format Library  - $RCSfile: ccmioprivate.h,v $
 *  Author:  Geoff Prewett
 *  Date:    July 31, 2003
 *
 *
 *  Star File Format Library - Copyright (C) 2003 by adapco, Ltd.
 *
 *  This program is the property of adapco, Ltd. and contains
 *  confidential and proprietary information.  The unauthorized use,
 *  distribution, or duplication of this program is prohibited.
 *  All rights reserved.
 *
 *  $Id: ccmioprivate.h,v 1.2 2004/07/07 20:13:50 prewett Exp $
 */

#include <stdarg.h>
#include "ccmio.h"

#ifdef __cplusplus
extern "C" {
#endif

#define StoreCStyleArrays	0	/* If set to 1, stores arrays in the
					   ADF file in C order (by reversing
					   the dimensions) */

typedef int ADFError;

/** Writes an invalid CCMIO node in 'node'. */
void MakeInvalidNode( CCMIONode *node );

/** Returns TRUE if 'node' is the root node, FALSE otherwise. */
int IsRootNode( CCMIONode node );

/** Returns the size of the specified datatype */
unsigned int CCMIOGetDataTypeSize( CCMIODataType type );

/** Returns an ADF typename string from the specified type */
const char* CCMIOGetDataTypeADFName( CCMIODataType type );

/** Returns an CCMIODataType from an ADF string. */
CCMIODataType CCMIOGetCCMIODataType( const char *dataStr );

/** Checks to see if the node has the same datatype and dimension
    size as specified */
CCMIOError IsSameFormat( CCMIONode node, CCMIODataType type, int dimSize );

/** Parses a va_list of dimension arguments */
int ParseArgs( va_list args, int *out );

#if StoreCStyleArrays
/** Converts an array of Fortran dimensions to C dimensions (i.e. reverses
    them */
void FortranToCArray( int size, int *ary );
#endif /* StoreCStyleArrays */

/** Takes a coordinate and size of array and returns the offset
    of the index into the array (if StoreCStyleArrays is enabled then
    the array is assumed to be in C-ordering, otherwise it is in FORTRAN
    ordering). */
int CalcOffset( int n, int coord[], int dimWidth[] );

/** Returns 1 if adfErr is an ADF error, 0 otherwise. */
int IsADFError( int adfErr );

/** Returns the appropriate CCMIOError from the specified adfErr */
CCMIOError ADFToCCMIOError( int adfErr );


#ifdef __cplusplus
}
#endif
#endif /* CCMIO_PRIVATE_H */
