1.2.1 (revision 3238)
OTF2_IdMap.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of the Score-P software (http://www.score-p.org)
00003  *
00004  * Copyright (c) 2009-2011,
00005  *    RWTH Aachen University, Germany
00006  *    Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
00007  *    Technische Universitaet Dresden, Germany
00008  *    University of Oregon, Eugene, USA
00009  *    Forschungszentrum Juelich GmbH, Germany
00010  *    German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
00011  *    Technische Universitaet Muenchen, Germany
00012  *
00013  * See the COPYING file in the package base directory for details.
00014  *
00015  */
00016 
00017 
00018 #ifndef OTF2_IDMAP_H
00019 #define OTF2_IDMAP_H
00020 
00021 
00043 #include <stddef.h>
00044 #include <stdint.h>
00045 #ifndef __cplusplus
00046 #include <stdbool.h>
00047 #endif
00048 
00049 
00050 #include <otf2/OTF2_ErrorCodes.h>
00051 
00052 
00054 typedef struct OTF2_IdMap_struct OTF2_IdMap;
00055 
00056 
00059 typedef uint8_t OTF2_IdMapMode;
00060 
00065 enum OTF2_IdMapMode_enum
00066 {
00067     OTF2_ID_MAP_DENSE,   
00068     OTF2_ID_MAP_SPARSE   
00069 };
00070 
00071 
00074 typedef void
00075 ( *OTF2_IdMap_TraverseCallback )( uint64_t localId,
00076                                   uint64_t globalId,
00077                                   void*    userData );
00078 
00079 
00080 #ifdef __cplusplus
00081 extern "C" {
00082 #endif
00083 
00084 
00096 OTF2_IdMap*
00097 OTF2_IdMap_Create( OTF2_IdMapMode mode,
00098                    uint64_t       capacity );
00099 
00100 
00121 OTF2_IdMap*
00122 OTF2_IdMap_CreateFromUint64Array( uint64_t        length,
00123                                   const uint64_t* mappings,
00124                                   bool            optimizeSize );
00125 
00126 
00141 OTF2_IdMap*
00142 OTF2_IdMap_CreateFromUint32Array( uint64_t        length,
00143                                   const uint32_t* mappings,
00144                                   bool            optimizeSize );
00145 
00146 
00153 void
00154 OTF2_IdMap_Free( OTF2_IdMap* instance );
00155 
00156 
00166 OTF2_ErrorCode
00167 OTF2_IdMap_GetSize( const OTF2_IdMap* instance,
00168                     uint64_t*         size );
00169 
00170 
00180 OTF2_ErrorCode
00181 OTF2_IdMap_GetMode( const OTF2_IdMap* instance,
00182                     OTF2_IdMapMode*   mode );
00183 
00184 
00193 OTF2_ErrorCode
00194 OTF2_IdMap_Clear( OTF2_IdMap* instance );
00195 
00196 
00211 OTF2_ErrorCode
00212 OTF2_IdMap_AddIdPair( OTF2_IdMap* instance,
00213                       uint64_t    localId,
00214                       uint64_t    globalId );
00215 
00216 
00229 OTF2_ErrorCode
00230 OTF2_IdMap_GetGlobalId( const OTF2_IdMap* instance,
00231                         uint64_t          localId,
00232                         uint64_t*         globalId );
00233 
00234 
00244 OTF2_ErrorCode
00245 OTF2_IdMap_Traverse( const OTF2_IdMap*           instance,
00246                      OTF2_IdMap_TraverseCallback callback,
00247                      void*                       userData );
00248 
00249 
00250 #ifdef __cplusplus
00251 }
00252 #endif /* __cplusplus */
00253 
00254 
00255 #endif /* OTF2_IDMAP_H */