54 #define NCBI_USE_ERRCODE_X Serial_Core
65 type1 =
t->GetPointedType();
70 type2 =
t->GetPointedType();
72 return (type1 == type2);
88 "CSerialObject::Assign(): an attempt to assign a serial object to itself");
92 string msg(
"Assignment of incompatible types: ");
93 msg +=
typeid(*this).name();
104 if (
typeid(
object) !=
typeid(*
this) && !
IsSameTypeInfo(
object, *
this) ) {
105 string msg(
"Cannot compare types: ");
106 msg +=
typeid(*this).name();
108 msg +=
typeid(object).name();
120 ostr <<
"\n****** begin ASN dump ******\n";
124 oos->SetAutoSeparator(
false);
128 ostr <<
"\n****** end ASN dump ******\n";
159 TSerialVerifyData::ResetThreadDefault();
161 TSerialVerifyData::SetThreadDefault(
verify);
173 TSerialVerifyData::ResetDefault();
175 TSerialVerifyData::SetDefault(
verify);
184 now = TSerialVerifyData::GetDefault();
236 if ( e_pos !=
NPOS ) {
240 bool capitalize =
true;
255 c = (char)
toupper((
unsigned char)c);
288 if ( !member_name.empty() ) {
292 s <<
": Attempt to get unassigned member "
293 <<
type->GetAccessModuleName() <<
"::"<<
type->GetAccessName() <<
'.';
294 if ( !member_name.empty() ) {
297 s <<
'[' << index <<
']';
300 #undef DIAG_COMPILE_INFO
301 #define DIAG_COMPILE_INFO \
302 NCBI_NS_NCBI::CDiagCompileInfo(file_name? file_name: __FILE__, \
303 file_line? file_line: __LINE__, \
304 NCBI_CURRENT_FUNCTION, \
305 NCBI_MAKE_MODULE(NCBI_MODULE))
308 #undef DIAG_COMPILE_INFO
309 #define DIAG_COMPILE_INFO \
310 NCBI_NS_NCBI::CDiagCompileInfo(__FILE__, \
312 NCBI_CURRENT_FUNCTION, \
313 NCBI_MAKE_MODULE(NCBI_MODULE))
345 : m_Name(name), m_NsName(ns_name), m_Value(
value)
349 : m_Name(other.m_Name), m_NsName(other.m_NsName), m_Value(other.m_Value)
404 vector<CSerialAttribInfoItem>::const_iterator it;
465 const vector<CSerialAttribInfoItem>&
474 #define eFmt_AsnText (1l << 0)
475 #define eFmt_AsnBinary (1l << 1)
476 #define eFmt_Xml (1l << 2)
477 #define eFmt_Json (1l << 3)
478 #define eFmt_All (eFmt_AsnText | eFmt_AsnBinary | eFmt_Xml | eFmt_Json)
480 #define eVerify_No (1l << 8)
481 #define eVerify_Yes (1l << 9)
482 #define eVerify_DefValue (1l << 10)
483 #define eVerify_All (eVerify_No | eVerify_Yes | eVerify_DefValue)
485 #define eSkipUnkMembers_No (1l << 11)
486 #define eSkipUnkMembers_Yes (1l << 12)
487 #define eSkipUnkMembers_All (eSkipUnkMembers_No | eSkipUnkMembers_Yes)
489 #define eSkipUnkVariants_No (1l << 13)
490 #define eSkipUnkVariants_Yes (1l << 14)
491 #define eSkipUnkVariants_All (eSkipUnkVariants_No | eSkipUnkVariants_Yes)
493 #define eEncoding_All (255l << 16)
494 #define eFmtFlags_All (255l << 24)
496 #define eFixNonPrint_Default 0
497 #define eFixNonPrint_Skip 1
498 #define eFixNonPrint_Allow 2
499 #define eFixNonPrint_Replace 3
500 #define eFixNonPrint_ReplaceAndWarn 4
501 #define eFixNonPrint_Throw 5
502 #define eFixNonPrint_Abort 6
504 #define eFixNonPrint_All 7
506 #define eSerIndex_Format 0
507 #define eSerIndex_Verify 0
508 #define eSerIndex_SkipUnkMembers 0
509 #define eSerIndex_SkipUnkVariants 0
510 #define eSerIndex_Encoding 0
511 #define eSerIndex_FixNonPrint 1
512 #define eSerIndex_Count 2
518 static atomic<bool> s_HaveIndex;
520 if ( !s_HaveIndex.load(memory_order_acquire) ) {
524 if ( !s_HaveIndex.load(memory_order_acquire) ) {
526 s_SerIndex[
i] = CNcbiIos::xalloc();
528 s_HaveIndex.store(
true, memory_order_release);
533 return io.iword(s_SerIndex[idx]);
644 default: enc = 0;
break;
702 : m_Index(idx), m_All(
all), m_Flags(
flags)
826 ostr->Write(ptr,
info);
838 "ReadObject: ignoring unknown formatting flags");
845 istr->Read(ptr,
info);
Serializable object that stores any combination of parsable data.
void SetFrame(const string &frame)
void Log(const string &name, const char *value, CDebugDumpFormatter::EValueType type=CDebugDumpFormatter::eValue, const string &comment=kEmptyStr)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
XML attribute information item.
Root class for all serialization exceptions.
Base class for all serializable objects.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Thrown on an attempt to write unassigned data member.
static unsigned char depth[2 *(256+1+29)+1]
std::ofstream out("events_result.xml")
main entry point for tests
static const char * str(char *buf, int n)
#define ERR_POST_XX_ONCE(error_name, err_subcode, message)
Error posting only once during program execution with given error code name and given error subcode.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
const CMemberId & GetId(void) const
const string & GetName(void) const
const CItemInfo * GetItemInfo(TMemberIndex index) const
static TMemberIndex FirstIndex(void)
TMemberIndex LastIndex(void) const
ESerialRecursionMode
How to assign and compare child sub-objects of serial objects.
CAnyContentObject & operator=(const CAnyContentObject &other)
unsigned int TSerial_Json_Flags
virtual ~CAnyContentObject(void)
static bool HasSerialFormatting(CNcbiIos &io)
virtual void DebugDump(CDebugDumpContext ddc, unsigned int depth) const
Define method for dumping debug information.
MSerial_SkipUnknownMembers(ESerialSkipUnknown fmt)
static const CTypeInfo * GetTypeInfo(void)
bool operator==(const CAnyContentObject &other) const
ESerialSkipUnknown
Skip unknown members parameters.
static void SetVerifyDataGlobal(ESerialVerifyData verify)
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
CNcbiIstream & operator>>(CNcbiIstream &is, CSerialObject &obj)
const CStringUTF8 & GetValue(void) const
Get normalized value.
unsigned int TSerial_AsnText_Flags
const CStringUTF8 & GetValue(void) const
Get normalized value of the information item.
size_t TMemberIndex
Type used for indexing class members and choice variants.
static ESerialVerifyData x_GetVerifyData(void)
const string & GetNamespaceName(void) const
Get namespace name.
MSerial_Format(ESerialDataFormat fmt, TSerial_Format_Flags flags=0)
ESerialVerifyData
Data verification parameters.
CNcbiIstream & ReadObject(CNcbiIstream &is, TObjectPtr ptr, TTypeInfo info)
const void * TConstObjectPtr
CNcbiOstream & WriteObject(CNcbiOstream &os, TConstObjectPtr ptr, TTypeInfo info)
static const char ms_UnassignedByte
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define SERIAL_VERIFY_DATA_GET
void SetFlags(CNcbiIos &io) const
CNcbiIos & MSerial_VerifyNo(CNcbiIos &io)
void ThrowUnassigned(TMemberIndex index) const
const string & GetNamespaceName(void) const
Get namespace name of the information item.
CNcbiIos & MSerial_None(CNcbiIos &io)
Reset all formatting flags for the I/O stream.
void SetName(const string &name)
Set local name.
MSerial_Format & operator()(TSerial_Json_Flags flags)
void AddAttribute(const string &name, const string &ns_name, const CStringUTF8 &value)
Add attribute.
MSerial_Format & operator()(TSerial_AsnText_Flags flags)
const string & GetNamespaceName(void) const
Get namespace name.
bool HasNamespaceName(void) const
Check if object data type has namespace name.
void SetFormatFlags(unsigned long flags)
MSerial_SkipUnknownVariants(ESerialSkipUnknown fmt)
void SetNamespacePrefix(const string &ns_prefix)
Set namespace prefix.
CSerialAttribInfoItem(const string &name, const string &ns_name, const CStringUTF8 &value)
const string & GetNamespacePrefix(void) const
Get namespace prefix.
void x_Decode(const CStringUTF8 &value)
static void SetVerifyDataThread(ESerialVerifyData verify)
MSerial_FixNonPrint(EFixNonPrint fnp)
void x_Copy(const CAnyContentObject &other)
void SetNamespaceName(const string &ns_name)
Set namespace name.
const string & GetName(void) const
Get local name of the information item.
virtual ~CSerialAttribInfoItem(void)
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
CNcbiIos & MSerial_VerifyDefault(CNcbiIos &io)
Define verification of un-initialized data members.
vector< CSerialAttribInfoItem > m_Attlist
static const char * ms_UnassignedStr
bool HasNamespacePrefix(void) const
Check if data type has namespace prefix.
unsigned int TSerial_Format_Flags
MSerial_Format –.
MSerialXml_DefaultStringEncoding(EEncoding fmt)
unsigned int TSerial_Xml_Flags
MSerial_VerifyData(ESerialVerifyData fmt)
const string & GetName(void) const
Get local name.
void SetValue(const CStringUTF8 &value)
Set normalized value.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
MSerial_Format & operator()(TSerial_Xml_Flags flags)
const string & GetNamespacePrefix(void) const
Get namespace prefix.
ESerialDataFormat
Data file format.
CNcbiIos & MSerial_VerifyYes(CNcbiIos &io)
const vector< CSerialAttribInfoItem > & GetAttributes(void) const
Get object attributes.
virtual ~CSerialObject(void)
CNcbiIos & MSerial_VerifyDefValue(CNcbiIos &io)
@ eSerialSkipUnknown_Never
never skip (even if set to skip later on)
@ eSerialSkipUnknown_No
do not skip (throw exception)
@ eSerialSkipUnknown_Yes
do skip
@ eSerialSkipUnknown_Always
always skip (even if set not to later on)
@ eSerialSkipUnknown_Default
use current default
@ eFNP_Allow
pass through unchanged, post no error message
@ eFNP_Skip
skip, post no error message
@ eFNP_Throw
replace with '#', throw an exception
@ eFNP_Abort
replace with '#', post an error of severity FATAL
@ eFNP_ReplaceAndWarn
replace with '#', post an error of severity ERROR
@ eFNP_Replace
replace with '#' silently
@ eSerialVerifyData_Never
never verify (even if set to verify later on)
@ eSerialVerifyData_DefValueAlways
initialize field with default
@ eSerialVerifyData_DefValue
initialize field with default
@ eSerialVerifyData_Yes
do verify
@ eSerialVerifyData_Always
always verify (even if set not to later on)
@ eSerialVerifyData_No
do not verify
@ eSerialVerifyData_Default
use current default
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
EFixNonPrint FixNonPrint(EFixNonPrint how)
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
TTypeInfo GetTypeInfo(void) const
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
EFixNonPrint FixNonPrint(EFixNonPrint how)
TConstObjectPtr GetObjectPtr(void) const
Get pointer to object.
virtual void DebugDump(CDebugDumpContext ddc, unsigned int depth) const
Define method for dumping debug information.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ios CNcbiIos
Portable alias for ios.
NCBI_NS_STD::string::size_type SIZE_TYPE
size_type rfind(const CTempString match, size_type pos=npos) const
Find the first instance of the entire matching string within the current string in a backward directi...
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
size_type size(void) const
Return the length of the represented array.
@ eEncoding_ISO8859_1
Note: From the point of view of the C++.
#define DEFINE_STATIC_FAST_MUTEX(id)
Define static fast mutex and initialize it.
bool HasNamespaceName(void) const
Check if data type has namespace name.
const CItemsInfo & GetItems(void) const
ETypeFamily GetTypeFamily(void) const
const string & GetNamespacePrefix(void) const
Get namespace prefix.
const string & GetNamespaceName(void) const
Get namespace name.
bool HasNamespacePrefix(void) const
Check if data type has namespace prefix.
virtual void Assign(TObjectPtr dst, TConstObjectPtr src, ESerialRecursionMode how=eRecursive) const =0
Set object to copy of another one.
virtual bool Equals(TConstObjectPtr object1, TConstObjectPtr object2, ESerialRecursionMode how=eRecursive) const =0
Check if both objects contain the same values.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is smart and slim</td> n<td> orig</td> n</tr> n<tr> n<td> last_modified</td> n<td> optional</td> n<td> Integer</td> n<td class=\"description\"> The blob last modification If provided then the exact match will be requested with n the Cassandra storage corresponding field value</td> n<td> Positive integer Not provided means that the most recent match will be selected</td> n<td></td> n</tr> n<tr> n<td> use_cache</td> n<td> optional</td> n<td> String</td> n<td class=\"description\"> The option controls if the Cassandra LMDB cache and or database should be used It n affects the seq id resolution step and the blob properties lookup step The following n options are BIOSEQ_INFO and BLOB_PROP at all
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
Static variables safety - create on demand, destroy on application termination.
Multi-threading – mutexes; rw-locks; semaphore.
Multi-threading – classes, functions, and features.
static EFixNonPrint s_FlagsToFixNonPrint(CNcbiIos &io)
typedef NCBI_PARAM_TYPE(SERIAL, VERIFY_DATA_GET) TSerialVerifyData
static long s_SkipUnkMembersToFlags(ESerialSkipUnknown fmt)
#define eFixNonPrint_Skip
#define eSerIndex_SkipUnkVariants
#define eFixNonPrint_Replace
#define eSkipUnkVariants_Yes
#define eSerIndex_SkipUnkMembers
static long & s_SerFlags(CNcbiIos &io, size_t idx)
static ESerialVerifyData s_FlagsToVerify(CNcbiIos &io)
#define eSerIndex_Encoding
static ESerialDataFormat s_FlagsToFormat(CNcbiIos &io)
static long s_VerifyToFlags(ESerialVerifyData fmt)
static TSerial_Format_Flags s_FlagsToFormatFlags(CNcbiIos &io)
#define eSkipUnkMembers_No
#define eSkipUnkVariants_No
static long s_FixNonPrintToFlags(EFixNonPrint fnp)
NCBI_PARAM_ENUM_ARRAY(ESerialVerifyData, SERIAL, VERIFY_DATA_GET)
static long s_EncodingToFlags(EEncoding fmt)
#define eSkipUnkMembers_Yes
static bool IsSameTypeInfo(const CSerialObject &obj1, const CSerialObject &obj2)
NCBI_PARAM_ENUM_DECL(ESerialVerifyData, SERIAL, VERIFY_DATA_GET)
static long s_FormatFlagsToFlags(unsigned long flags)
static long s_SkipUnkVariantsToFlags(ESerialSkipUnknown fmt)
NCBI_PARAM_ENUM_DEF(ESerialVerifyData, SERIAL, VERIFY_DATA_GET, eSerialVerifyData_Default)
#define eFixNonPrint_Throw
#define eFixNonPrint_Allow
static ESerialSkipUnknown s_FlagsToSkipUnkMembers(CNcbiIos &io)
#define eSkipUnkVariants_All
#define eFixNonPrint_ReplaceAndWarn
static ESerialSkipUnknown s_FlagsToSkipUnkVariants(CNcbiIos &io)
static EEncoding s_FlagsToEncoding(CNcbiIos &io)
#define eFixNonPrint_Default
CNcbiOstream & operator<<(CNcbiOstream &out, SPrintIdentifier s)
static long s_FormatToFlags(ESerialDataFormat fmt)
#define eFixNonPrint_Abort
#define eSkipUnkMembers_All
#define eSerIndex_FixNonPrint
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
SPrintIdentifier(const CTempString &s)