NCBI C++ ToolKit
Classes | Macros | Functions | Variables
compound_id.cpp File Reference

Implementations of CCompoundIDPool, CCompoundID, and CCompoundIDField. More...

#include <ncbi_pch.hpp>
#include "compound_id_impl.hpp"
#include <connect/ncbi_socket.hpp>
#include <iomanip>
+ Include dependency graph for compound_id.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CCompoundIDDumpParser
 

Macros

#define CIC_GENERICID_CLASS_NAME   "CompoundID"
 
#define CIC_NETCACHEBLOBKEY_CLASS_NAME   "NetCacheBlobKey"
 
#define CIC_NETSCHEDULEJOBKEY_CLASS_NAME   "NetScheduleJobKey"
 
#define CIC_NETSTORAGEOBJECTLOC_CLASS_NAME_V1   "NetStorageObjectLocV1"
 
#define CIC_NETSTORAGEOBJECTLOC_CLASS_NAME   "NetStorageObjectLoc"
 
#define CIT_ID_TYPE_NAME   "id"
 
#define CIT_INTEGER_TYPE_NAME   "int"
 
#define CIT_SERVICE_NAME_TYPE_NAME   "service"
 
#define CIT_DATABASE_NAME_TYPE_NAME   "database"
 
#define CIT_TIMESTAMP_TYPE_NAME   "time"
 
#define CIT_RANDOM_TYPE_NAME   "rand"
 
#define CIT_IPV4_ADDRESS_TYPE_NAME   "ipv4_addr"
 
#define CIT_HOST_TYPE_NAME   "host"
 
#define CIT_PORT_TYPE_NAME   "port"
 
#define CIT_IPV4_SOCK_ADDR_TYPE_NAME   "ipv4_sock_addr"
 
#define CIT_OBJECTREF_TYPE_NAME   "object"
 
#define CIT_STRING_TYPE_NAME   "str"
 
#define CIT_BOOLEAN_TYPE_NAME   "bool"
 
#define CIT_FLAGS_TYPE_NAME   "flags"
 
#define CIT_LABEL_TYPE_NAME   "label"
 
#define CIT_CUE_TYPE_NAME   "cue"
 
#define CIT_SEQ_ID_TYPE_NAME   "seq_id"
 
#define CIT_TAX_ID_TYPE_NAME   "tax_id"
 
#define CIT_NESTED_CID_TYPE_NAME   "nested"
 
#define CIF_GET_IMPL(ret_type, method, type, member)    CIF_GET_IMPL_(ret_type, method, type, m_Impl->m_Type != type, member)
 
#define CIF_GET_IMPL_(ret_type, method, type, cond, member)
 
#define CID_APPEND_IMPL(method, field_type, val_type, member)
 
#define CID_PARSER_EXCEPTION(message)
 
#define SCRAMBLE_PASS()
 
#define UNSCRAMBLE_PASS()
 

Functions

static void s_Indent (CNcbiOstrstream &sstr, int indent_depth, const char *indent)
 
static void s_DumpCompoundID (CNcbiOstrstream &sstr, SCompoundIDImpl *cid_impl, int indent_depth, const char *indent)
 
static void s_Scramble (unsigned char *seq, size_t seq_len)
 
void g_PackID (void *binary_id, size_t binary_id_len, string &packed_id)
 
static void s_Unscramble (unsigned char *seq, size_t seq_len)
 
bool g_UnpackID (const string &packed_id, string &binary_id)
 

Variables

static const char * s_ClassNames [eCIC_NumberOfClasses]
 
static const char * s_TypeNames [eCIT_NumberOfTypes]
 

Detailed Description

Implementations of CCompoundIDPool, CCompoundID, and CCompoundIDField.

Definition in file compound_id.cpp.

Macro Definition Documentation

◆ CIC_GENERICID_CLASS_NAME

#define CIC_GENERICID_CLASS_NAME   "CompoundID"

Definition at line 45 of file compound_id.cpp.

◆ CIC_NETCACHEBLOBKEY_CLASS_NAME

#define CIC_NETCACHEBLOBKEY_CLASS_NAME   "NetCacheBlobKey"

Definition at line 46 of file compound_id.cpp.

◆ CIC_NETSCHEDULEJOBKEY_CLASS_NAME

#define CIC_NETSCHEDULEJOBKEY_CLASS_NAME   "NetScheduleJobKey"

Definition at line 47 of file compound_id.cpp.

◆ CIC_NETSTORAGEOBJECTLOC_CLASS_NAME

#define CIC_NETSTORAGEOBJECTLOC_CLASS_NAME   "NetStorageObjectLoc"

Definition at line 49 of file compound_id.cpp.

◆ CIC_NETSTORAGEOBJECTLOC_CLASS_NAME_V1

#define CIC_NETSTORAGEOBJECTLOC_CLASS_NAME_V1   "NetStorageObjectLocV1"

Definition at line 48 of file compound_id.cpp.

◆ CID_APPEND_IMPL

#define CID_APPEND_IMPL (   method,
  field_type,
  val_type,
  member 
)
Value:
void CCompoundID::method(val_type value) \
{ \
m_Impl->AppendField(field_type)->member = value; \
}
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227

Definition at line 240 of file compound_id.cpp.

◆ CID_PARSER_EXCEPTION

#define CID_PARSER_EXCEPTION (   message)
Value:
NCBI_THROW_FMT(CCompoundIDException, eInvalidDumpSyntax, \
"line " << m_ErrLine << ", column " << \
(m_ErrPos - m_LineBegin + 1) << ": " << message)
Exception class for use by CCompoundIDPool, CCompoundID, and CCompoundIDField.
Definition: compound_id.hpp:91
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
Definition: ncbiexpt.hpp:719

Definition at line 452 of file compound_id.cpp.

◆ CIF_GET_IMPL

#define CIF_GET_IMPL (   ret_type,
  method,
  type,
  member 
)     CIF_GET_IMPL_(ret_type, method, type, m_Impl->m_Type != type, member)

Definition at line 139 of file compound_id.cpp.

◆ CIF_GET_IMPL_

#define CIF_GET_IMPL_ (   ret_type,
  method,
  type,
  cond,
  member 
)
Value:
ret_type CCompoundIDField::method() const \
{ \
if (cond) { \
NCBI_THROW_FMT(CCompoundIDException, eInvalidType, \
"Compound ID field type mismatch (requested: " << \
s_TypeNames[type] << "; actual: " << \
s_TypeNames[m_Impl->m_Type] << ')'); \
} \
return (ret_type) m_Impl->member; \
}
CNetRef< SCompoundIDFieldImpl > m_Impl
static const char * s_TypeNames[eCIT_NumberOfTypes]
Definition: compound_id.cpp:81
Definition: type.c:6
#define const
Definition: zconf.h:232

Definition at line 142 of file compound_id.cpp.

◆ CIT_BOOLEAN_TYPE_NAME

#define CIT_BOOLEAN_TYPE_NAME   "bool"

Definition at line 63 of file compound_id.cpp.

◆ CIT_CUE_TYPE_NAME

#define CIT_CUE_TYPE_NAME   "cue"

Definition at line 66 of file compound_id.cpp.

◆ CIT_DATABASE_NAME_TYPE_NAME

#define CIT_DATABASE_NAME_TYPE_NAME   "database"

Definition at line 54 of file compound_id.cpp.

◆ CIT_FLAGS_TYPE_NAME

#define CIT_FLAGS_TYPE_NAME   "flags"

Definition at line 64 of file compound_id.cpp.

◆ CIT_HOST_TYPE_NAME

#define CIT_HOST_TYPE_NAME   "host"

Definition at line 58 of file compound_id.cpp.

◆ CIT_ID_TYPE_NAME

#define CIT_ID_TYPE_NAME   "id"

Definition at line 51 of file compound_id.cpp.

◆ CIT_INTEGER_TYPE_NAME

#define CIT_INTEGER_TYPE_NAME   "int"

Definition at line 52 of file compound_id.cpp.

◆ CIT_IPV4_ADDRESS_TYPE_NAME

#define CIT_IPV4_ADDRESS_TYPE_NAME   "ipv4_addr"

Definition at line 57 of file compound_id.cpp.

◆ CIT_IPV4_SOCK_ADDR_TYPE_NAME

#define CIT_IPV4_SOCK_ADDR_TYPE_NAME   "ipv4_sock_addr"

Definition at line 60 of file compound_id.cpp.

◆ CIT_LABEL_TYPE_NAME

#define CIT_LABEL_TYPE_NAME   "label"

Definition at line 65 of file compound_id.cpp.

◆ CIT_NESTED_CID_TYPE_NAME

#define CIT_NESTED_CID_TYPE_NAME   "nested"

Definition at line 69 of file compound_id.cpp.

◆ CIT_OBJECTREF_TYPE_NAME

#define CIT_OBJECTREF_TYPE_NAME   "object"

Definition at line 61 of file compound_id.cpp.

◆ CIT_PORT_TYPE_NAME

#define CIT_PORT_TYPE_NAME   "port"

Definition at line 59 of file compound_id.cpp.

◆ CIT_RANDOM_TYPE_NAME

#define CIT_RANDOM_TYPE_NAME   "rand"

Definition at line 56 of file compound_id.cpp.

◆ CIT_SEQ_ID_TYPE_NAME

#define CIT_SEQ_ID_TYPE_NAME   "seq_id"

Definition at line 67 of file compound_id.cpp.

◆ CIT_SERVICE_NAME_TYPE_NAME

#define CIT_SERVICE_NAME_TYPE_NAME   "service"

Definition at line 53 of file compound_id.cpp.

◆ CIT_STRING_TYPE_NAME

#define CIT_STRING_TYPE_NAME   "str"

Definition at line 62 of file compound_id.cpp.

◆ CIT_TAX_ID_TYPE_NAME

#define CIT_TAX_ID_TYPE_NAME   "tax_id"

Definition at line 68 of file compound_id.cpp.

◆ CIT_TIMESTAMP_TYPE_NAME

#define CIT_TIMESTAMP_TYPE_NAME   "time"

Definition at line 55 of file compound_id.cpp.

◆ SCRAMBLE_PASS

#define SCRAMBLE_PASS ( )
Value:
pos = seq; \
counter = seq_len - 1; \
do { \
pos[1] = (unsigned char)(pos[1] ^ *pos ^ length_factor--); \
++pos; \
} while (--counter > 0);

Definition at line 924 of file compound_id.cpp.

◆ UNSCRAMBLE_PASS

#define UNSCRAMBLE_PASS ( )
Value:
counter = seq_len - 1; \
do { \
*pos = (unsigned char)(*pos ^ pos[-1] ^ ++length_factor); \
--pos; \
} while (--counter > 0);

Definition at line 963 of file compound_id.cpp.

Function Documentation

◆ g_PackID()

void g_PackID ( void *  binary_id,
size_t  binary_id_len,
string packed_id 
)

Definition at line 947 of file compound_id.cpp.

References base64url_encode, NULL, and s_Scramble().

◆ g_UnpackID()

bool g_UnpackID ( const string packed_id,
string binary_id 
)

Definition at line 987 of file compound_id.cpp.

References base64url_decode, eBase64_OK, NULL, and s_Unscramble().

◆ s_DumpCompoundID()

static void s_DumpCompoundID ( CNcbiOstrstream sstr,
SCompoundIDImpl cid_impl,
int  indent_depth,
const char *  indent 
)
static

◆ s_Indent()

static void s_Indent ( CNcbiOstrstream sstr,
int  indent_depth,
const char *  indent 
)
static

Definition at line 301 of file compound_id.cpp.

References indent().

Referenced by s_DumpCompoundID().

◆ s_Scramble()

static void s_Scramble ( unsigned char *  seq,
size_t  seq_len 
)
static

Definition at line 932 of file compound_id.cpp.

References SCRAMBLE_PASS.

Referenced by g_PackID().

◆ s_Unscramble()

static void s_Unscramble ( unsigned char *  seq,
size_t  seq_len 
)
static

Definition at line 970 of file compound_id.cpp.

References UNSCRAMBLE_PASS.

Referenced by g_UnpackID().

Variable Documentation

◆ s_ClassNames

const char* s_ClassNames[eCIC_NumberOfClasses]
static
Initial value:
= {
"CompoundID" ,
"NetCacheBlobKey" ,
"NetScheduleJobKey" ,
"NetStorageObjectLocV1" ,
"NetStorageObjectLoc"
}

Definition at line 73 of file compound_id.cpp.

Referenced by s_DumpCompoundID().

◆ s_TypeNames

const char* s_TypeNames[eCIT_NumberOfTypes]
static
Initial value:
= {
"id" ,
"int" ,
"service" ,
"database" ,
"time" ,
"rand" ,
"ipv4_addr" ,
"host" ,
"port" ,
"ipv4_sock_addr" ,
"object" ,
"str" ,
"bool" ,
"flags" ,
"label" ,
"cue" ,
"seq_id" ,
"tax_id" ,
"nested"
}

Definition at line 81 of file compound_id.cpp.

Referenced by s_DumpCompoundID().

Modified on Sat Apr 20 12:21:54 2024 by modify_doxy.py rev. 669887