OTF_Filenames.h 1.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
/*
 This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2010.
 Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
*/

/** 
 *  @file OTF_Filenames.h
 * 
 *  @brief Handles file naming issues.
 *
 *  \ingroup internal
 */


#ifndef OTF_FILENAMES
#define OTF_FILENAMES


#include "OTF_inttypes.h"
#include "OTF_Definitions.h"


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*#define OTF_FILETYPE_MASTER 		0
#define OTF_FILETYPE_GLOBAL_DEF 	1
#define OTF_FILETYPE_DEF 			2
#define OTF_FILETYPE_EVENT  		3
#define OTF_FILETYPE_SNAPS  		4
#define OTF_FILETYPE_STATS  		5*/
#define OTF_FILETYPE_MASTER 		16
#define OTF_FILETYPE_GLOBAL_DEF 	32
#define OTF_FILETYPE_DEF 			64
#define OTF_FILETYPE_EVENT  		128
#define OTF_FILETYPE_SNAPS  		256
#define OTF_FILETYPE_STATS  		512
#define OTF_FILETYPE_MARKER  		1024
#define OTF_FILETYPE_BITS 			(16+32+64+128+256+512+1024)
typedef uint32_t OTF_FileType;

/* zlevel has to be 0-9 */
#define OTF_FILECOMPRESSION_UNCOMPRESSED 	0
/* default compression level */
#define OTF_FILECOMPRESSION_COMPRESSED  	4
#define OTF_FILECOMPRESSION_BITS			(1+2+4+8)
typedef uint32_t OTF_FileCompression;


/** provide a name stub, a stream id and the type of file. 
the function will create the proper filename in 'ret'. ret may be 
pre-allocated with length 'l' or NULL with 'l=0'. in the latter case 
memory is allocated via malloc internally but has to be freed later on.
on success the resulting string is returned, return NULL indicates an error. */
char* OTF_getFilename( const char* namestub, uint32_t id, OTF_FileType type, 
	unsigned int l, char* ret );


/** strip the a filename from the ".otf" suffix if present */
char* OTF_stripFilename( const char* filename );


/** DEPRICATED Check whether a file exists or not. Return 1 on success. */
int OTF_fileExists( const char* filename );

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* OTF_FILENAMES */