43 #define CKSUM_ADD_INTEGER(cksum, value) \
44 CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value))
46 #define CKSUM_INTEGER_FIELD(cksum, Type, field) \
47 if (obj.IsSet##field()) { \
48 Type::T##field value = obj.Get##field(); \
49 CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value)); \
52 #define CKSUM_INTEGER_FIELD2(cksum, Type, field) \
54 Type::T##field value = obj.Get##field(); \
55 CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value)); \
75 objects::CScope* scope)
88 objects::CScope* scope)
const
91 if(vcf_variant !=
NULL) {
103 it->second(checksum, obj, scope, *
this);
108 m_Map[type_info] = func;
136 #ifdef WORDS_BIGENDIAN
153 objects::CScope* scope,
const string& data_source,
154 const string& sAdditionalInfo)
156 return GetFeatSignature(feat, feat.GetLocation(), scope, data_source, sAdditionalInfo);
162 objects::CScope* scope,
const objects::CSeq_annot_Handle& annot_handle,
163 const string& sAdditionalInfo)
165 return GetFeatSignature(feat, feat.GetLocation(), scope, annot_handle, sAdditionalInfo);
170 const objects::CSeq_loc& loc,
171 objects::CScope* scope,
172 const objects::CSeq_annot_Handle& annot_handle,
173 const string& sAdditionalInfo)
175 string annot_name =
"Unnamed";
176 if (annot_handle.IsNamed()) {
177 annot_name = annot_handle.GetName();
192 const objects::CSeq_loc& loc,
193 objects::CScope* scope,
194 const string& data_source,
195 const string& sAdditionalInfo)
208 type |= feat.GetData().GetSubtype() & 0xff;
217 if (data_source.empty()) {
218 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
220 }
else if (is_naa || is_rmt) {
221 sprintf(
buf,
"-%08x-%08x-%04x-%08x-",
227 sprintf(
buf,
"-%08x-%08x-%04x-%08x-%08x",
230 string sAdditionalInfoDigest;
231 if(!sAdditionalInfo.empty()) {
233 AdditionalInfoCS.
AddLine(sAdditionalInfo);
234 sAdditionalInfoDigest = AdditionalInfoCS.
GetHexSum();
237 return id_str +
buf + ((is_naa || is_rmt) ? data_source :
"") + (sAdditionalInfoDigest.empty() ?
"" : (
"-" + sAdditionalInfoDigest));
242 objects::CScope* scope,
const string& data_source)
259 if (data_source.empty()) {
260 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
263 sprintf(
buf,
"-%08x-%08x-%04x-%08x-",
269 sprintf(
buf,
"-%08x-%08x-%04x-%08x-%08x",
273 return id_str +
buf + (is_naa ? data_source :
"");
278 const objects::CSeq_loc& on_loc,
279 objects::CScope* scope,
280 const objects::CSeq_annot_Handle& annot_handle)
282 string annot_name =
"Unnamed";
283 if (annot_handle.IsNamed()) {
284 annot_name = annot_handle.GetName();
291 const objects::CSeq_loc& on_loc, objects::CScope* scope,
292 const string& data_source)
313 string AdjustedDS(data_source);
315 if (data_source.empty()) {
316 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
318 }
else if (is_include_ds) {
319 sprintf(
buf,
"-%08x-%08x-%04x-%08x-",
322 AdjustedDS =
"AlignDb";
327 bool batch_found(align.GetNamedScore(
"batch_id", batch)); (void)batch_found;
328 NCBI_ASSERT(batch_found,
"AlignDb sourced alignment does not have a \"batch_id\" score!");
334 string sIsQuery(
"N");
336 if(align.GetSeq_id(0).AsFastaString() == id_str) {
347 sprintf(
buf,
"-%08x-%08x-%04x-%08x-%08x",
352 return id_str +
buf + (is_include_ds ? AdjustedDS :
"");
357 objects::CScope* scope)
374 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
383 objects::CScope* scope,
385 const string& data_source,
396 type |= subtype & 0xff;
405 if (data_source.empty()) {
406 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
408 }
else if (is_naa || is_rmt) {
409 sprintf(
buf,
"-%08x-%08x-%04x-%08x-",
415 sprintf(
buf,
"-%08x-%08x-%04x-%08x-%08x",
419 return id_str +
buf + ((is_naa || is_rmt) ? data_source :
"");
425 const objects::CSeq_loc& mapped_loc,
426 objects::CScope* scope)
443 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
464 sprintf(
buf,
"-%08x-%08x-%04x-%08x", pnt, pnt,
type, checksum);
484 sprintf(
buf,
"-%08x-%08x-%04x-%08x",
491 objects::CSeq_id_Handle& sih,
497 Uint4& ds_fingerprint,
499 objects::CScope* scope)
507 vector<string>::const_iterator iter = toks.begin();
510 string id_str = *iter++;
517 "failed to retrieve sequence (ParseSignature) : " + id_str);
527 subtype =
tmp & 0xff;
533 if (iter != toks.end()) {
534 const string& ds = *iter++;
552 return toks.size() > 5 ? toks[5] :
"";
static void PutInt4(unsigned char *ptr, Int4 value)
CChecksum – Checksum calculator.
static void AddDouble(CChecksum &checksum, double value)
void Fingerprint(CChecksum &checksum, const CObject &obj, objects::CScope *scope) const
void x_Register(TTypeInfo type_info, TFingerPFunc func)
static void ParseSignature(const string &sig, objects::CSeq_id_Handle &sih, TSeqPos &from, TSeqPos &to, EObjectType &type, int &subtype, Uint4 &fingerprint, Uint4 &ds_fingerprint, string &ds_name, objects::CScope *scope)
parse signature with data source info.
static string GetRsiteSignature(const objects::CSeq_feat &feat, int pnt, objects::CScope *scope)
static void Register(TTypeInfo type_info, TFingerPFunc func)
static string GetHistogramSignature(const objects::CSeq_loc &loc, EObjectType obj_type, objects::CScope *scope, const string &title, const string &data_source="", int subtype=0)
static string GetGraphSignature(const objects::CSeq_graph &graph, objects::CScope *scope, const string &data_source="")
static void GetFingerprint(CChecksum &checksum, const CObject &obj, objects::CScope *scope=NULL)
static string GetComponentSignature(const objects::CSeq_loc &comp_loc, const objects::CSeq_loc &mapped_loc, objects::CScope *scope)
void(* TFingerPFunc)(CChecksum &checksum, const CObject &obj, objects::CScope *scope, const CObjFingerprint &fingerP)
static string GetVcfVariantSignature(const objects::CVcfVariant &vcf_variant, objects::CScope *scope)
static string ParseSignatureDS(const string &sig)
static string GetFeatSignature(const objects::CSeq_feat &feat, objects::CScope *scope, const string &data_source="", const string &sAdditionalInfo="")
static string GetSeqLocSignature(const objects::CSeq_loc &loc, objects::CScope *scope)
static string GetAlignSignature(const objects::CSeq_align &align, const objects::CSeq_loc &on_loc, objects::CScope *scope, const objects::CSeq_annot_Handle &annot_handle)
static void AddInteger(CChecksum &checksum, unsigned char *pvalue, int size)
static CObjFingerprint & x_GetInstance()
namespace ncbi::objects::
Base class for all serializable objects.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
string GetHexSum(void) const
Return string with checksum in hexadecimal form.
void AddLine(const char *line, size_t len)
Uint4 GetChecksum(void) const
Return calculated checksum.
void AddChars(const char *str, size_t len)
Update current control sum with data provided.
#define NCBI_ASSERT(expr, mess)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static bool IsNAA(const string &annot, bool isStrict=false)
check if a given annotation is a named annotation accession[.version][number] when isSctrict == false...
static bool IsAlignDb(const string &annot)
check if a given annotation is AlignDb (potentially suffixed with batch identication string after a '...
static bool isRmtAnnotName(const string &sAnnotname)
check if a given annotation was created by a remote file pipeline
static void TokenizeWithEscape(const string &str, const string &delim, vector< string > &tokens, bool remove_escape=false)
Tokenize a string using the delim.
const objects::CSeq_loc & GetLocation() const
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
const string AsFastaString(void) const
CConstRef< CSeq_id > GetSeqId(void) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint16_t Uint2
2-byte (16-bit) unsigned integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static bool MatchesMask(CTempString str, CTempString mask, ECase use_case=eCase)
Match "str" against the "mask".
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
const TLocation & GetLocation(void) const
Get the Location member data.
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Multi-threading – mutexes; rw-locks; semaphore.
DEFINE_STATIC_MUTEX(s_Mutex)
static void s_EscapeDash(string &id)