NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ncbi_util.h File Reference
#include <connect/ncbi_core.h>
#include <stdio.h>
+ Include dependency graph for ncbi_util.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

struct  SHASH_Descriptor
 

Macros

#define LOG_WRITE(lg, code, subcode, level, message)
 Auxiliary plain macros to write message (maybe, with raw data) to the log. More...
 
#define LOG_DATA(lg, code, subcode, level, data, size, message)
 
#define THIS_MODULE   0
 Default for THIS_MODULE. More...
 
#define CORE_CURRENT_FUNCTION   0
 Get current function name. More...
 
#define CORE_LOGFILE_CUTOFF_LEVEL   eLOG_Note
 Default CORE LOG cut off log level. More...
 
#define fLOG_Short   fLOG_Level
 
#define fLOG_Full   (fLOG_Level | fLOG_Module | fLOG_FileLine)
 
#define UTIL_PRINTABLE_WIDTH_MIN   80 /** Default minimum printable width */
 
#define UTIL_PRINTABLE_WIDTH   130 /** Default printable width for data */
 
#define UTIL_PrintableString(d, s, b, f)   UTIL_PrintableStringEx((d),(s),(b),(f),0)
 Same as UTIL_PrintableStringEx(..., 0) – i.e. More...
 
#define UTIL_TcharToUtf8OnHeap(x)   (x)
 Conversion from Unicode to UTF8, and back. More...
 
#define UTIL_TcharToUtf8(x)   (x)
 
#define UTIL_Utf8ToTchar(x)   (x)
 
#define UTIL_ReleaseBuffer(x)   /*void*/
 

Typedefs

typedef unsigned int TLOG_FormatFlags
 bitwise OR of "ELOG_FormatFlag" More...
 
typedef int TUTIL_PrintableFlags
 Bitwise "OR" of EUTIL_PrintableFlags. More...
 

Enumerations

enum  ELOG_FormatFlag {
  fLOG_Default = 0x0 , fLOG_Level = 0x1 , fLOG_Module = 0x2 , fLOG_FileLine = 0x4 ,
  fLOG_DateTime = 0x8 , fLOG_Function = 0x10 , fLOG_FullOctal = 0x2000 , fLOG_OmitNoteLevel = 0x4000 ,
  fLOG_None = 0x8000
}
 LOG formatting flags: what parts of the message to actually appear. More...
 
enum  ENcbiRequestID { eNcbiRequestID_None = 0 , eNcbiRequestID_HitID , eNcbiRequestID_SID }
 NCBI request ID enumerator. More...
 
enum  ECORE_Username { eCORE_UsernameCurrent , eCORE_UsernameLogin , eCORE_UsernameReal }
 Select which username is the most preferable to obtain from the system. More...
 
enum  EUTIL_PrintableFlags { fUTIL_PrintableFullOctal = 1 , eUTIL_PrintableFullOctal = fUTIL_PrintableFullOctal , fUTIL_PrintableNoNewLine = 2 , eUTIL_PrintableNoNewLine = fUTIL_PrintableNoNewLine }
 

Functions

void CORE_SetLOCK (MT_LOCK lk)
 Set the MT critical section lock/unlock handler – to be used by the core internals for protection of internal static variables and other MT-sensitive code from being accessed/changed by several threads simultaneously. More...
 
MT_LOCK CORE_GetLOCK (void)
 Get the lock handle that is to be used by the core internals. More...
 
void CORE_SetLOG (LOG lg)
 Set the log handle (no logging if "lg" is passed zero) – to be used by the core internals (CORE LOG). More...
 
LOG CORE_GetLOG (void)
 Get the log handle that is to be used by the core internals (CORE LOG). More...
 
void CORE_SetLOGFILE_Ex (FILE *fp, ELOG_Level cut_off, ELOG_Level fatal_err, int auto_close)
 Standard logging (CORE LOG) to the specified file stream. More...
 
void CORE_SetLOGFILE (FILE *fp, int auto_close)
 Same as CORE_SetLOGFILE_Ex(fp, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal, auto_close). More...
 
int CORE_SetLOGFILE_NAME_Ex (const char *logfile, ELOG_Level cut_off, ELOG_Level fatal_err)
 Same as CORE_SetLOGFILE_Ex(fopen(logfile, "a"), cut_off, fatal_err, TRUE). More...
 
int CORE_SetLOGFILE_NAME (const char *logfile)
 Same as CORE_SetLOGFILE_NAME_Ex(logfile, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal). More...
 
TLOG_FormatFlags CORE_SetLOGFormatFlags (TLOG_FormatFlags)
 
char * LOG_ComposeMessage (const SLOG_Message *mess, TLOG_FormatFlags flags)
 Compose a message using the "call_data" info. More...
 
void LOG_ToFILE_Ex (LOG lg, FILE *fp, ELOG_Level cut_off, ELOG_Level fatal_err, int auto_close)
 LOG_Reset specialized to log to a "FILE*" stream using LOG_ComposeMessage. More...
 
void LOG_ToFILE (LOG lg, FILE *fp, int auto_close)
 Same as LOG_ToFILEx(lg, fp, eLOG_Trace, eLOG_Fatal, auto_close). More...
 
const char * NcbiMessagePlusError (int *dynamic, const char *message, int error, const char *descr)
 Add current "error" (and maybe its description) to the message: <message>[ {error=[[<error>][,]][<descr>]}]. More...
 
void CORE_SetREG (REG rg)
 Set the registry (no registry if "rg" is passed zero) – to be used by the core internals. More...
 
REG CORE_GetREG (void)
 Get the registry that is to be used by the core internals. More...
 
const char * CORE_GetAppName (void)
 Obtain current application name (toolkit dependent). More...
 
char * CORE_GetNcbiRequestID (ENcbiRequestID reqid)
 Obtain current NCBI request ID (if known, per thread). More...
 
const char * CORE_GetPlatform (void)
 Return NCBI platrofm ID (if known). More...
 
const char * CORE_GetUsernameEx (char *buf, size_t bufsize, ECORE_Username username)
 Obtain and store in the buffer provided, the best (as possible) user name that matches the requested username selector. More...
 
const char * CORE_GetUsername (char *buf, size_t bufsize)
 Equivalent to CORE_GetUsernameEx(buf, bufsize, eNCBI_UsernameLogin) except that it always returns non-empty "buf" when successful, or NULL otherwise (i.e. More...
 
size_t CORE_GetVMPageSize (void)
 Obtain virtual memory page size. More...
 
void CORE_Msdelay (unsigned long ms)
 Delay execution of the current thread by the specified number of milliseconds. More...
 
unsigned int UTIL_CRC32_Update (unsigned int checksum, const void *ptr, size_t len)
 Calculate/Update CRC-32 checksum NB: Initial checksum is "0". More...
 
unsigned int UTIL_Adler32_Update (unsigned int checksum, const void *ptr, size_t len)
 Calculate/Update Adler-32 checksum NB: Initial checksum is "1". More...
 
void * UTIL_GenerateHMAC (const SHASH_Descriptor *hash, const void *text, size_t text_len, const void *key, size_t key_len, void *digest)
 Generate an RFC2401 digest (HMAC). More...
 
int UTIL_MatchesMaskEx (const char *text, const char *mask, int ignore_case)
 Match a given text with a given pattern mask. More...
 
int UTIL_MatchesMask (const char *text, const char *mask)
 Shortcut for UTIL_MatchesMaskEx(text, mask, 1), that is matching is done case-insensitively for the letters (a-z). More...
 
char * UTIL_NcbiLocalHostName (char *hostname)
 Cut off well-known NCBI domain suffix out of the passed "hostname". More...
 
size_t UTIL_PrintableStringSize (const char *data, size_t size)
 Calculate size of buffer needed to store printable representation of the block of data of the specified size (or, if size is 0, strlen(data)) but without the '\0' terminator. More...
 
char * UTIL_PrintableStringEx (const char *data, size_t size, char *buf, TUTIL_PrintableFlags flags, int width)
 Create a printable representation of a block of data of the specified size (or, if size is 0, strlen(data)), and return the buffer pointer past the last stored character (non '\0'-terminated). More...
 
int UTIL_HelpRequested (int argc, char **argv)
 Given the main()'s argc and argv return non-zero (true) if the arguments specify that only a help option was requested. More...
 
void UTIL_ReleaseBufferOnHeap (const void *ptr)
 

Variables

char * CORE_GetNcbiRequestDtab
 NCBI request "DTab-Local" header. More...
 
Modified on Sat May 25 14:20:20 2024 by modify_doxy.py rev. 669887