NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ncbimisc.hpp File Reference

Miscellaneous common-use basic types and functionality. More...

#include <corelib/ncbidbg.hpp>
#include <stdlib.h>
+ Include dependency graph for ncbimisc.hpp:
+ 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

class  pair_base_member< Base, Member >
 Template used for empty base class optimization. More...
 
class  CBoolEnum< TEnum >
 Template used to replace bool type arguments with some strict equivalent. More...
 
struct  Creater< X >
 Functor template for allocating object. More...
 
struct  Deleter< X >
 Functor template for deleting object. More...
 
struct  ArrayDeleter< X >
 Functor template for deleting array of objects. More...
 
struct  CDeleter< X >
 Functor template for the C language deallocation function, free(). More...
 
class  AutoPtr< X, Del >
 AutoPtr –. More...
 
struct  AutoPtr< X, Del >::SSafeBoolTag
 Bool operator for use in if() clause. More...
 
class  AutoArray< X, Del >
 AutoArray –. More...
 
struct  AutoArray< X, Del >::SSafeBoolTag
 Bool operator for use in if() clause. More...
 
struct  SThrowOnNull< TValue >
 
class  CNullable< TValue, TNullToValue >
 Template class allowing to store a value or null (unassigned) state. More...
 
class  CStrictId< TKey, TStorage >
 Template class for strict ID types. More...
 
struct  SStrictId_Gi
 Key structs must always be defined - they are used in aliasinfo.cpp. More...
 
struct  SStrictId_Entrez
 
struct  SStrictId_Tax
 
class  CConstIdChecker< TId, id >
 a helper template to enforce constness of argument to GI_CONST macro More...
 
class  CRawPointer
 Helper address class. More...
 
class  CFastBuffer< KEmbeddedSize, TType >
 
class  CSafeFlags< Enum >
 Support for safe enum flags. More...
 
struct  CSafeFlags< Enum >::SSafeBoolTag
 
class  CNcbiActionGuard
 CNcbiActionGuard class Executes registered callbacks on request or on destruction. More...
 
class  CNcbiActionGuard::CAction_Base
 
class  CNcbiActionGuard::CAction< TFunc >
 
struct  hash< ncbi::CStrictId< TKey, TStorage > >
 

Macros

#define nullptr   NULL
 
#define NCBI_ESWITCH_DEFINED
 
#define NCBI_EOWNERSHIP_DEFINED
 NCBI_ESWITCH_DEFINED. More...
 
#define DECLARE_SAFE_BOOL_METHOD(Expr)
 Support for safe bool operators. More...
 
#define DECLARE_OPERATOR_BOOL(Expr)    DECLARE_SAFE_BOOL_METHOD(Expr)
 Declaration of safe bool operator from boolean expression. More...
 
#define DECLARE_OPERATOR_BOOL_PTR(Ptr)    DECLARE_OPERATOR_BOOL((Ptr) != 0)
 Declaration of safe bool operator from pointer expression. More...
 
#define DECLARE_OPERATOR_BOOL_REF(Ref)    DECLARE_OPERATOR_BOOL((Ref).NotNull())
 Declaration of safe bool operator from CRef<>/CConstRef<> expression. More...
 
#define OVERRIDE_OPERATOR_BOOL(TAncestorClass, NewBoolExpr)
 Override the DECLARE_OPERATOR_BOOL, etc. More...
 
#define ITERATE_CONST(Cont)   NCBI_NS_NCBI::s_ITERATE_ConstRef(Cont)
 
#define ITERATE_BEGIN(Cont, Begin)
 
#define ITERATE_VAR(Type)   Type
 
#define ITERATE(Type, Var, Cont)
 ITERATE macro to sequence through container elements. More...
 
#define NON_CONST_ITERATE(Type, Var, Cont)
 Non constant version of ITERATE macro. More...
 
#define REVERSE_ITERATE(Type, Var, Cont)
 ITERATE macro to reverse sequence through container elements. More...
 
#define NON_CONST_REVERSE_ITERATE(Type, Var, Cont)
 Non constant version of REVERSE_ITERATE macro. More...
 
#define ERASE_ITERATE(Type, Var, Cont)
 Non-constant version with ability to erase current element, if container permits. More...
 
#define VECTOR_ERASE(Var, Cont)   (NCBI_NAME2(Var,_next) = (Cont).erase(Var))
 Use this macro inside body of ERASE_ITERATE cycle to erase from vector-like container. More...
 
#define ITERATE_BOTH_BOOL_VALUES(BoolVar)    for( bool BoolVar##BOTH_BOOL_VALUES_DONE##__LINE__ = false, BoolVar = false; ! BoolVar##BOTH_BOOL_VALUES_DONE##__LINE__ ; BoolVar##BOTH_BOOL_VALUES_DONE##__LINE__ = BoolVar, BoolVar = true )
 The body of the loop will be run with Var equal to false and then true. More...
 
#define ITERATE_0_IDX(idx, up_to)    for( TSeqPos idx = 0; idx < up_to; ++idx )
 idx loops from 0 (inclusive) to up_to (exclusive) More...
 
#define ITERATE_SIMPLE(num_iters)    ITERATE_0_IDX( _dummy_idx_94768308_##__LINE__, num_iters )
 Just repeat the body of the loop num_iters times. More...
 
#define NCBI_INT8_GI
 Type for sequence GI. More...
 
#define STRICT_ID_TO(TId, TInt, id)   (static_cast<TInt>((id).Get()))
 Macros to convert TGi to other types (int, unsigned etc.). More...
 
#define STRICT_ID_FROM(TIdType, TIntType, id)   (TIdType(static_cast<TIdType::TId>(id)))
 
#define STRICT_ID_CONST(type, id)    (type(static_cast<type::TId>(ncbi::CConstIdChecker<type::TId, id>::value)))
 
#define STRICT_ID_ZERO(type)   STRICT_ID_CONST(type, 0)
 
#define STRICT_ID_INVALID(type)   STRICT_ID_CONST(type, -1)
 
#define GI_TO(T, gi)   STRICT_ID_TO(ncbi::TGi, T, gi)
 
#define GI_FROM(T, value)   STRICT_ID_FROM(ncbi::TGi, T, value)
 
#define GI_CONST(gi)   STRICT_ID_CONST(ncbi::TGi, gi)
 
#define ZERO_GI   STRICT_ID_ZERO(ncbi::TGi)
 
#define INVALID_GI   STRICT_ID_INVALID(ncbi::TGi)
 
#define ENTREZ_ID_TO(T, entrez_id)   (static_cast<T>(entrez_id))
 
#define ENTREZ_ID_FROM(T, value)   (static_cast<ncbi::TEntrezId>(value))
 
#define ENTREZ_ID_CONST(id)   id
 
#define ZERO_ENTREZ_ID   ENTREZ_ID_CONST(0)
 
#define INVALID_ENTREZ_ID   ENTREZ_ID_CONST(-1)
 
#define TAX_ID_TO(T, tax_id)   (static_cast<T>(tax_id))
 
#define TAX_ID_FROM(T, value)   (static_cast<ncbi::TTaxId>(value))
 
#define TAX_ID_CONST(id)   id
 
#define ZERO_TAX_ID   TAX_ID_CONST(0)
 
#define INVALID_TAX_ID   TAX_ID_CONST(-1)
 
#define INT_ID_TO(T, id)   (static_cast<T>(id))
 Convert gi-compatible int to/from other types. More...
 
#define INT_ID_FROM(T, value)   (static_cast<ncbi::TIntId>(value))
 
#define NCBI_DEPRECATED_CTOR(decl)   decl NCBI_DEPRECATED
 Macro used to mark a constructor as deprecated. More...
 
#define NCBI_DEPRECATED_CLASS   NCBI_DEPRECATED_CTOR(class)
 Macro used to mark a class as deprecated. More...
 
#define DECLARE_SAFE_FLAGS_TYPE(E, T)    typedef NCBI_NS_NCBI::CSafeFlags<E> T
 Macro DECLARE_SAFE_FLAGS_TYPE defines a typedef for safe-flags. More...
 
#define DECLARE_SAFE_FLAGS(E)
 Macro DECLARE_SAFE_FLAGS marks a enum as safe-flags enum. More...
 
#define NCBI_EXPORT_FUNC_DECLARE(lib, func)
 
#define NCBI_EXPORT_FUNC_DEFINE(lib, func)
 

Typedefs

typedef enum ENcbiSwitch ESwitch
 Aux. More...
 
typedef enum ENcbiOwnership EOwnership
 Ownership relations between objects. More...
 
typedef unsigned int TSeqPos
 Type for sequence locations and lengths. More...
 
typedef int TSignedSeqPos
 Type for signed sequence position. More...
 
typedef Int8 TIntId
 
typedef Uint8 TUintId
 
typedef CStrictId< SStrictId_Gi, SStrictId_Gi::TIdTGi
 
typedef TGi CStrictGi
 
typedef SStrictId_Entrez::TId TEntrezId
 TEntrezId type for entrez ids which require the same strictness as TGi. More...
 
typedef SStrictId_Tax::TId TTaxId
 Taxon id type. More...
 

Enumerations

enum  ENcbiSwitch {
  eOff = 0 , eOn , eDefault , eOff = 0 ,
  eOn , eDefault
}
 Aux. More...
 
enum  ENcbiOwnership { eNoOwnership , eTakeOwnership , eNoOwnership , eTakeOwnership }
 Ownership relations between objects. More...
 
enum  ENullable { eNullable , eNotNullable }
 Whether a value is nullable. More...
 
enum  ESign { eNegative = -1 , eZero = 0 , ePositive = 1 }
 Signedness of a value. More...
 
enum  ETriState { eTriState_Unknown = -1 , eTriState_False = 0 , eTriState_True = 1 }
 Enumeration to represent a tristate value. More...
 
enum  ERound { eTrunc , eRound }
 Whether to truncate/round a value. More...
 
enum  EFollowLinks { eIgnoreLinks , eFollowLinks }
 Whether to follow symbolic links (also known as shortcuts or aliases) More...
 
enum  ENormalizePath { eNormalizePath , eNotNormalizePath }
 Whether to normalize a path. More...
 
enum  EInterruptOnSignal { eInterruptOnSignal , eRestartOnSignal }
 Interrupt on signal mode. More...
 
enum  ERetriable { eRetriable_No , eRetriable_Unknown , eRetriable_Yes }
 Can the action be retried? More...
 
enum  ENull { null = 0 }
 CNullable –. More...
 

Functions

NCBI_XNCBI_EXPORT void g_ThrowOnNull (void)
 
template<class TValue , class TNullToValue = SThrowOnNull<TValue>>
bool operator== (const CNullable< TValue, TNullToValue > &l, const CNullable< TValue, TNullToValue > &r)
 
template<class TValue , class TNullToValue = SThrowOnNull<TValue>>
bool operator!= (const CNullable< TValue, TNullToValue > &l, const CNullable< TValue, TNullToValue > &r)
 
char * strdup (const char *str)
 Supply string duplicate function, if one is not defined. More...
 
template<typename Type >
const Types_ITERATE_ConstRef (const Type &obj)
 
template<typename Type >
bool s_ITERATE_SameObject (const Type &obj1, const Type &obj2)
 
template<class TKey , class TStorage >
CNcbiOstreamoperator<< (CNcbiOstream &out, const CStrictId< TKey, TStorage > &id)
 
template<class TKey , class TStorage >
CNcbiIstreamoperator>> (CNcbiIstream &in, CStrictId< TKey, TStorage > &id)
 
template<class E >
CSafeFlags< Eoperator| (E a, CSafeFlags< E > b)
 Helper operators for safe-flags enums. More...
 
template<class E >
CSafeFlags< Eoperator& (E a, CSafeFlags< E > b)
 
template<class E >
CSafeFlags< Eoperator^ (E a, CSafeFlags< E > b)
 
template<class E >
ostream & operator<< (ostream &out, const CSafeFlags< E > &v)
 
template<class T1 , class T2 >
void swap (NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
 
template<class P , class D >
void swap (NCBI_NS_NCBI::AutoPtr< P, D > &ptr1, NCBI_NS_NCBI::AutoPtr< P, D > &ptr2)
 
template<class Element , size_t Size>
constexpr size_t ArraySize (const Element(&)[Size])
 

Variables

 BEGIN_NCBI_NAMESPACE
 NCBI_EOWNERSHIP_DEFINED. More...
 
const TSeqPos kInvalidSeqPos = ((TSeqPos) (-1))
 Define special value for invalid sequence position. More...
 
 END_NCBI_NAMESPACE
 
 BEGIN_STD_NAMESPACE
 
 END_STD_NAMESPACE
 
template<class T >
using c_unique_ptr = unique_ptr< T, void(*)(T *)>
 Template helpers for unique_ptr to work with resource allocating/deallocating C functions. More...
 
template<class T , typename TDeleter >
unique_ptr< T, TDeleter > make_c_unique (T *p, TDeleter d)
 Eliminates the necessity for specifying types of both allocated resource and deallocating C function. More...
 
template<class T >
unique_ptr< T, void(*)(void *)> make_c_unique (T *p)
 Overload for the above for all types of allocated memory that are to be deallocated by free() More...
 

Detailed Description

Miscellaneous common-use basic types and functionality.

Definition in file ncbimisc.hpp.

Macro Definition Documentation

◆ nullptr

#define nullptr   NULL

Definition at line 45 of file ncbimisc.hpp.

Modified on Sat Dec 02 09:22:03 2023 by modify_doxy.py rev. 669887