Coin Logo http://www.sim.no/
http://www.coin3d.org/

tidbits.h
00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) by Kongsberg Oil & Gas Technologies.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  ("GPL") version 2 as published by the Free Software Foundation.
00009  *  See the file LICENSE.GPL at the root directory of this source
00010  *  distribution for additional information about the GNU GPL.
00011  *
00012  *  For using Coin with software that can not be combined with the GNU
00013  *  GPL, and for taking advantage of the additional benefits of our
00014  *  support services, please contact Kongsberg Oil & Gas Technologies
00015  *  about acquiring a Coin Professional Edition License.
00016  *
00017  *  See http://www.coin3d.org/ for more information.
00018  *
00019  *  Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
00020  *  http://www.sim.no/  sales@sim.no  coin-support@coin3d.org
00021  *
00022 \**************************************************************************/
00023 
00024 #ifndef COIN_TIDBITS_H
00025 #define COIN_TIDBITS_H
00026 
00027 #include <Inventor/C/basic.h>
00028 #include <stdarg.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif /*__cplusplus */
00033 
00034 /* ********************************************************************** */
00035 
00036 enum CoinEndiannessValues {
00037   COIN_HOST_IS_UNKNOWNENDIAN = -1,
00038   COIN_HOST_IS_LITTLEENDIAN = 0,
00039   COIN_HOST_IS_BIGENDIAN = 1
00040 };
00041 
00042 COIN_DLL_API int coin_host_get_endianness(void);
00043 
00044 COIN_DLL_API int coin_snprintf(char * dst, unsigned int n, const char * fmtstr, ...);
00045 COIN_DLL_API int coin_vsnprintf(char * dst, unsigned int n, const char * fmtstr, va_list args);
00046 
00047 COIN_DLL_API const char * coin_getenv(const char * name);
00048 COIN_DLL_API SbBool coin_setenv(const char * name, const char * value, int overwrite);
00049 COIN_DLL_API void coin_unsetenv(const char * name);
00050 
00051 COIN_DLL_API int coin_strncasecmp(const char * str1, const char * str2, int len);
00052   
00053 COIN_DLL_API uint16_t coin_hton_uint16(uint16_t value);
00054 COIN_DLL_API uint16_t coin_ntoh_uint16(uint16_t value);
00055 COIN_DLL_API uint32_t coin_hton_uint32(uint32_t value);
00056 COIN_DLL_API uint32_t coin_ntoh_uint32(uint32_t value);
00057 COIN_DLL_API uint64_t coin_hton_uint64(uint64_t value);
00058 COIN_DLL_API uint64_t coin_ntoh_uint64(uint64_t value);
00059 
00060 COIN_DLL_API void coin_hton_float_bytes(float value, char * result); /* expects room for 4 bytes in result*/
00061 COIN_DLL_API float coin_ntoh_float_bytes(const char * value);   /* expects 4 bytes input */
00062 
00063 COIN_DLL_API void coin_hton_double_bytes(double value, char * result); /* expects room for 8 bytes in result */
00064 COIN_DLL_API double coin_ntoh_double_bytes(const char * value); /* expects 8 bytes input */
00065 
00066 COIN_DLL_API SbBool coin_isascii(const int c);
00067 COIN_DLL_API SbBool coin_isspace(const char c);
00068 
00069 COIN_DLL_API SbBool coin_is_power_of_two(uint32_t x);
00070 COIN_DLL_API uint32_t coin_next_power_of_two(uint32_t x);
00071 COIN_DLL_API uint32_t coin_geq_power_of_two(uint32_t x);
00072 
00073 COIN_DLL_API void coin_viewvolume_jitter(int numpasses, int curpass, const int * vpsize, float * jitter);
00074 
00075 typedef void coin_atexit_f(void);
00076 COIN_DLL_API void cc_coin_atexit(coin_atexit_f * fp);
00077 
00078 /* Used internally to clean up static data. Do not use in application code */
00079 COIN_DLL_API void cc_coin_atexit_static_internal(coin_atexit_f * fp);
00080 
00081 /* ********************************************************************** */
00082 
00083 /* OBSOLETED! These are not safe. Don't use them. */
00084 COIN_DLL_API float coin_hton_float(float value);
00085 COIN_DLL_API float coin_ntoh_float(float value);
00086   
00087 COIN_DLL_API double coin_hton_double(double value);
00088 COIN_DLL_API double coin_ntoh_double(double value);
00089 
00090 /* ********************************************************************** */
00091 
00092 #ifdef __cplusplus
00093 } /* extern "C" */
00094 #endif /* __cplusplus */
00095 
00096 #endif /* !COIN_TIDBITS_H */

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen 1.7.5.1.