1.5.1 (revision 4026)
otf2/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  *
00007  * Copyright (c) 2009-2011,
00008  * Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
00009  *
00010  * Copyright (c) 2009-2011, 2013,
00011  * Technische Universitaet Dresden, Germany
00012  *
00013  * Copyright (c) 2009-2011,
00014  * University of Oregon, Eugene, USA
00015  *
00016  * Copyright (c) 2009-2011,
00017  * Forschungszentrum Juelich GmbH, Germany
00018  *
00019  * Copyright (c) 2009-2011,
00020  * German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
00021  *
00022  * Copyright (c) 2009-2011,
00023  * Technische Universitaet Muenchen, Germany
00024  *
00025  * This software may be modified and distributed under the terms of
00026  * a BSD-style license.  See the COPYING file in the package base
00027  * directory for details.
00028  *
00029  */
00030 
00031 
00032 #ifndef OTF2_IDMAP_H
00033 #define OTF2_IDMAP_H
00034 
00035 
00056 #include <stddef.h>
00057 #include <stdint.h>
00058 #ifndef __cplusplus
00059 #include <stdbool.h>
00060 #endif
00061 
00062 
00063 #include <otf2/OTF2_ErrorCodes.h>
00064 
00065 
00067 typedef struct OTF2_IdMap_struct OTF2_IdMap;
00068 
00069 
00072 typedef uint8_t OTF2_IdMapMode;
00073 
00078 enum OTF2_IdMapMode_enum
00079 {
00080     OTF2_ID_MAP_DENSE,   
00081     OTF2_ID_MAP_SPARSE   
00082 };
00083 
00084 
00087 typedef void
00088 ( *OTF2_IdMap_TraverseCallback )( uint64_t localId,
00089                                   uint64_t globalId,
00090                                   void*    userData );
00091 
00092 
00093 #ifdef __cplusplus
00094 extern "C" {
00095 #endif
00096 
00097 
00109 OTF2_IdMap*
00110 OTF2_IdMap_Create( OTF2_IdMapMode mode,
00111                    uint64_t       capacity );
00112 
00113 
00134 OTF2_IdMap*
00135 OTF2_IdMap_CreateFromUint64Array( uint64_t        length,
00136                                   const uint64_t* mappings,
00137                                   bool            optimizeSize );
00138 
00139 
00154 OTF2_IdMap*
00155 OTF2_IdMap_CreateFromUint32Array( uint64_t        length,
00156                                   const uint32_t* mappings,
00157                                   bool            optimizeSize );
00158 
00159 
00166 void
00167 OTF2_IdMap_Free( OTF2_IdMap* instance );
00168 
00169 
00179 OTF2_ErrorCode
00180 OTF2_IdMap_GetSize( const OTF2_IdMap* instance,
00181                     uint64_t*         size );
00182 
00183 
00193 OTF2_ErrorCode
00194 OTF2_IdMap_GetMode( const OTF2_IdMap* instance,
00195                     OTF2_IdMapMode*   mode );
00196 
00197 
00206 OTF2_ErrorCode
00207 OTF2_IdMap_Clear( OTF2_IdMap* instance );
00208 
00209 
00224 OTF2_ErrorCode
00225 OTF2_IdMap_AddIdPair( OTF2_IdMap* instance,
00226                       uint64_t    localId,
00227                       uint64_t    globalId );
00228 
00229 
00242 OTF2_ErrorCode
00243 OTF2_IdMap_GetGlobalId( const OTF2_IdMap* instance,
00244                         uint64_t          localId,
00245                         uint64_t*         globalId );
00246 
00247 
00261 OTF2_ErrorCode
00262 OTF2_IdMap_GetGlobalIdSave( const OTF2_IdMap* instance,
00263                             uint64_t          localId,
00264                             uint64_t*         globalId );
00265 
00266 
00276 OTF2_ErrorCode
00277 OTF2_IdMap_Traverse( const OTF2_IdMap*           instance,
00278                      OTF2_IdMap_TraverseCallback callback,
00279                      void*                       userData );
00280 
00281 
00282 #ifdef __cplusplus
00283 }
00284 #endif /* __cplusplus */
00285 
00286 
00287 #endif /* OTF2_IDMAP_H */