NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions
ncbi_std.h File Reference

Type and macro definitions from C toolkit that are not defined in C++ toolkit. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <assert.h>
#include "blast_toolkit.h"
#include <algo/blast/core/blast_export.h>
+ Include dependency graph for ncbi_std.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  ListNode
 A generic linked list node structure. More...
 

Macros

#define NCBI_INLINE   inline
 "inline" seems to work on our remaining in-house compilers (WorkShop, Compaq, ICC, MPW) More...
 
#define TRUE   1
 bool replacment for C indicating true. More...
 
#define FALSE   0
 bool replacment for C indicating false. More...
 
#define ASSERT   assert
 macro for assert. More...
 
#define MIN(a, b)   ((a)>(b)?(b):(a))
 returns smaller of a and b. More...
 
#define MAX(a, b)   ((a)>=(b)?(a):(b))
 returns larger of a and b. More...
 
#define ABS(a)   ((a)>=0?(a):-(a))
 returns absolute value of a (|a|) More...
 
#define SIGN(a)   ((a)>0?1:((a)<0?-1:0))
 return +1 for a > 0, -1 for a < 0 More...
 
#define UINT4_MAX   4294967295U
 largest number represented by unsigned int. More...
 
#define INT4_MAX   2147483647
 largest nubmer represented by signed int More...
 
#define INT4_MIN   (-2147483647-1)
 Smallest (most negative) number represented by signed int. More...
 
#define NCBIMATH_LN2   0.69314718055994530941723212145818
 natural log of 2. More...
 
#define INT2_MAX   32767
 largest number represented by signed (two byte) short More...
 
#define INT2_MIN   (-32768)
 smallest (most negative) number represented by signed (two byte) short More...
 
#define INT1_MAX   127
 largest number represented by signed short (one byte) More...
 
#define INT1_MIN   (-128)
 smallest (most negative) number represented by signed short (one byte) More...
 
#define DIM(A)   (sizeof(A)/sizeof((A)[0]))
 dimension of an array. More...
 
#define NULLB   '\0'
 terminating byte of a char* string. More...
 
#define NCBI_CONST_INT8(v)   v##LL
 64-bit integers More...
 
#define NCBI_CONST_UINT8(v)   v##ULL
 

Typedefs

typedef Uint1 Boolean
 bool replacment for C More...
 
typedef struct ListNode ListNode
 A generic linked list node structure. More...
 

Functions

void * BlastMemDup (const void *orig, size_t size)
 Copies memory using memcpy and malloc. More...
 
ListNodeListNodeNew (ListNode *vnp)
 Create a new list node. More...
 
ListNodeListNodeAdd (ListNode **head)
 Add a node to the list. More...
 
ListNodeListNodeAddPointer (ListNode **head, Uint1 choice, void *value)
 Add a node to the list with a given choice and data pointer. More...
 
ListNodeListNodeFree (ListNode *vnp)
 Free all list's nodes, does not attempt to free data. More...
 
ListNodeListNodeFreeData (ListNode *vnp)
 Free nodes as well as data (vnp->ptr) assuming it is one contiguous chunk. More...
 
ListNodeListNodeCopyStr (ListNode **head, Uint1 choice, const char *str)
 Add a node to the list with a provided choice, and attached data pointing to a provided string. More...
 

Detailed Description

Type and macro definitions from C toolkit that are not defined in C++ toolkit.

Definition in file ncbi_std.h.

Macro Definition Documentation

◆ ABS

#define ABS (   a)    ((a)>=0?(a):-(a))

returns absolute value of a (|a|)

Definition at line 122 of file ncbi_std.h.

◆ ASSERT

#define ASSERT   assert

macro for assert.

Definition at line 107 of file ncbi_std.h.

◆ DIM

#define DIM (   A)    (sizeof(A)/sizeof((A)[0]))

dimension of an array.

Definition at line 176 of file ncbi_std.h.

◆ FALSE

#define FALSE   0

bool replacment for C indicating false.

Definition at line 101 of file ncbi_std.h.

◆ INT1_MAX

#define INT1_MAX   127

largest number represented by signed short (one byte)

Definition at line 166 of file ncbi_std.h.

◆ INT1_MIN

#define INT1_MIN   (-128)

smallest (most negative) number represented by signed short (one byte)

Definition at line 171 of file ncbi_std.h.

◆ INT2_MAX

#define INT2_MAX   32767

largest number represented by signed (two byte) short

Definition at line 156 of file ncbi_std.h.

◆ INT2_MIN

#define INT2_MIN   (-32768)

smallest (most negative) number represented by signed (two byte) short

Definition at line 161 of file ncbi_std.h.

◆ INT4_MAX

#define INT4_MAX   2147483647

largest nubmer represented by signed int

Definition at line 141 of file ncbi_std.h.

◆ INT4_MIN

#define INT4_MIN   (-2147483647-1)

Smallest (most negative) number represented by signed int.

Definition at line 146 of file ncbi_std.h.

◆ MAX

#define MAX (   a,
  b 
)    ((a)>=(b)?(a):(b))

returns larger of a and b.

Definition at line 117 of file ncbi_std.h.

◆ MIN

#define MIN (   a,
  b 
)    ((a)>(b)?(b):(a))

returns smaller of a and b.

Definition at line 112 of file ncbi_std.h.

◆ NCBI_CONST_INT8

#define NCBI_CONST_INT8 (   v)    v##LL

64-bit integers

Definition at line 195 of file ncbi_std.h.

◆ NCBI_CONST_UINT8

#define NCBI_CONST_UINT8 (   v)    v##ULL

Definition at line 196 of file ncbi_std.h.

◆ NCBI_INLINE

#define NCBI_INLINE   inline

"inline" seems to work on our remaining in-house compilers (WorkShop, Compaq, ICC, MPW)

Definition at line 81 of file ncbi_std.h.

◆ NCBIMATH_LN2

#define NCBIMATH_LN2   0.69314718055994530941723212145818

natural log of 2.

Definition at line 151 of file ncbi_std.h.

◆ NULLB

#define NULLB   '\0'

terminating byte of a char* string.

Definition at line 181 of file ncbi_std.h.

◆ SIGN

#define SIGN (   a)    ((a)>0?1:((a)<0?-1:0))

return +1 for a > 0, -1 for a < 0

Definition at line 127 of file ncbi_std.h.

◆ TRUE

#define TRUE   1

bool replacment for C indicating true.

Definition at line 97 of file ncbi_std.h.

◆ UINT4_MAX

#define UINT4_MAX   4294967295U

largest number represented by unsigned int.

Definition at line 136 of file ncbi_std.h.

Typedef Documentation

◆ Boolean

typedef Uint1 Boolean

bool replacment for C

Definition at line 94 of file ncbi_std.h.

◆ ListNode

typedef struct ListNode ListNode

A generic linked list node structure.

Function Documentation

◆ BlastMemDup()

void* BlastMemDup ( const void *  orig,
size_t  size 
)

◆ ListNodeAdd()

ListNode* ListNodeAdd ( ListNode **  head)

Add a node to the list.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
Returns
New node

Definition at line 77 of file ncbi_std.c.

References head, ListNodeNew(), and NULL.

Referenced by ListNodeAddPointer(), and ListNodeCopyStr().

◆ ListNodeAddPointer()

ListNode* ListNodeAddPointer ( ListNode **  head,
Uint1  choice,
void *  value 
)

Add a node to the list with a given choice and data pointer.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
choiceChoice value for the new node. [in]
valueData pointer for the new node. [in]
Returns
New node

Definition at line 99 of file ncbi_std.c.

References ListNode::choice, head, ListNodeAdd(), NULL, ListNode::ptr, and rapidjson::value.

Referenced by BlastLoadMatrixValues().

◆ ListNodeCopyStr()

ListNode* ListNodeCopyStr ( ListNode **  head,
Uint1  choice,
const char *  str 
)

Add a node to the list with a provided choice, and attached data pointing to a provided string.

Parameters
headPointer to the start of the list, if *head is NULL will be Pointer to new node. [in] [out]
choicesets the "choice" field in ListNode [in]
strchar* buffer to be copied [in]
Returns
newly allocated node

Definition at line 124 of file ncbi_std.c.

References ListNode::choice, head, ListNodeAdd(), NULL, ListNode::ptr, str(), and strdup.

Referenced by BlastScoreBlkNucleotideMatrixRead(), and BlastScoreBlkProteinMatrixRead().

◆ ListNodeFree()

ListNode* ListNodeFree ( ListNode vnp)

Free all list's nodes, does not attempt to free data.

Parameters
vnpobjects to be freed [in]
Returns
NULL

Definition at line 148 of file ncbi_std.c.

References ListNode::next, next(), NULL, and sfree.

Referenced by BlastMatrixValuesDestruct().

◆ ListNodeFreeData()

ListNode* ListNodeFreeData ( ListNode vnp)

Free nodes as well as data (vnp->ptr) assuming it is one contiguous chunk.

Parameters
vnpobjects to be freed [in]
Returns
NULL

Definition at line 169 of file ncbi_std.c.

References ListNode::next, next(), NULL, ListNode::ptr, and sfree.

Referenced by BlastScoreBlkFree().

◆ ListNodeNew()

ListNode* ListNodeNew ( ListNode vnp)

Create a new list node.

Parameters
vnpPointer to the start of the list, may be NULL [in]
Returns
newly allocated node

Definition at line 55 of file ncbi_std.c.

References calloc(), ListNode::next, and NULL.

Referenced by ListNodeAdd().

Modified on Fri Sep 20 14:57:09 2024 by modify_doxy.py rev. 669887