m_CStyleBigInt(
false), m_SkipNextTag(
false), m_AutomaticTagging(
true)
78 #if CHECK_OUTSTREAM_INTEGRITY 79m_CurrentPosition = 0;
80m_CurrentTagState = eTagStart;
81m_CurrentTagLimit = 0;
89m_CStyleBigInt(
false), m_SkipNextTag(
false), m_AutomaticTagging(
true)
92 #if CHECK_OUTSTREAM_INTEGRITY 93m_CurrentPosition = 0;
94m_CurrentTagState = eTagStart;
95m_CurrentTagLimit = 0;
103m_CStyleBigInt(
false), m_SkipNextTag(
false), m_AutomaticTagging(
true)
106 #if CHECK_OUTSTREAM_INTEGRITY 107m_CurrentPosition = 0;
108m_CurrentTagState = eTagStart;
109m_CurrentTagLimit = 0;
115 #if CHECK_OUTSTREAM_INTEGRITY 116 if( !m_Limits.empty() || m_CurrentTagState != eTagStart )
117 ERR_POST_X(9,
"CObjectOStreamAsnBinary not finished");
121 #if CHECK_OUTSTREAM_INTEGRITY 123 voidCObjectOStreamAsnBinary::StartTag(
Uint1 code)
125m_Limits.push(m_CurrentTagLimit);
126m_CurrentTagCode =
code;
127m_CurrentTagPosition = m_CurrentPosition;
132 voidCObjectOStreamAsnBinary::EndTag(
void)
134 if( m_Limits.empty() )
136m_CurrentTagState = eTagStart;
137m_CurrentTagLimit = m_Limits.top();
142 voidCObjectOStreamAsnBinary::SetTagLength(
size_tlength)
144 Int8limit = m_CurrentPosition + 1 + length;
145 if( limit <= m_CurrentPosition ||
146(m_CurrentTagLimit != 0 && limit > m_CurrentTagLimit) )
148m_CurrentTagLimit = limit;
150m_CurrentTagState = eTagStart;
152m_CurrentTagState = eData;
158 #if !CHECK_OUTSTREAM_INTEGRITY 163 #if CHECK_OUTSTREAM_INTEGRITY 165 if( m_CurrentTagLimit != 0 &&
166m_CurrentPosition >= m_CurrentTagLimit )
168 switch( m_CurrentTagState ) {
173 if( (
byte& 0x80) == 0)
174m_CurrentTagState = eLengthStart;
179 if( m_CurrentTagCode == 0 )
182 else if(
byte== 0x80 ) {
185 "cannot use indefinite form for primitive tag");
187m_CurrentTagState = eTagStart;
189 else if(
byte< 0x80 ) {
190SetTagLength(
byte);
193m_CurrentTagLengthSize =
byte- 0x80;
194 if( m_CurrentTagLengthSize >
sizeof(
size_t) )
196m_CurrentTagState = eLengthValueFirst;
199 caseeLengthValueFirst:
202 if( --m_CurrentTagLengthSize == 0 ) {
203SetTagLength(
byte);
206m_CurrentTagLength =
byte;
207m_CurrentTagState = eLengthValue;
212m_CurrentTagLength = (m_CurrentTagLength << 8) |
byte;
213 if( --m_CurrentTagLengthSize == 0 )
214SetTagLength(m_CurrentTagLength);
217 _ASSERT( m_CurrentTagLimit != 0);
218 if( m_CurrentPosition + 1 == m_CurrentTagLimit )
222m_CurrentPosition += 1;
227 #if !CHECK_OUTSTREAM_INTEGRITY 234 #if CHECK_OUTSTREAM_INTEGRITY 236 if( m_CurrentTagState != eData )
238 Int8new_pos = m_CurrentPosition +
size;
239 if( new_pos < m_CurrentPosition ||
240(m_CurrentTagLimit != 0 && new_pos > m_CurrentTagLimit) )
242m_CurrentPosition = new_pos;
243 if( new_pos == m_CurrentTagLimit )
249 template<
typenameT>
253 for(
size_tshift = (
count- 1) * 8; shift > 0; shift -= 8 ) {
295 staticatomic<TByte> s_UTF8StringTag{0};
296 auto tag= s_UTF8StringTag.load(memory_order_acquire);
299s_UTF8StringTag.store(
tag, memory_order_release);
320 if( tag_value <= 0 )
326 size_tshift = (
sizeof(
TLongTag) * 8 - 1) / 7 * 7;
329 while( (bits = (tag_value >> shift) & 0x7f) == 0 ) {
334 while( shift != 0 ) {
351 if( tag_value >= 0 && tag_value <
eLongTag)
397 if( length <= 0xffU )
399 else if( length <= 0xffffU )
401 else if( length <= 0xffffffU )
404 count=
sizeof(length);
405 if(
sizeof(length) > 4 ) {
406 for(
size_tshift = (
count-1)*8;
408 if(
Uint1(length >> shift) != 0 )
442 "CObjectOStreamAsnBinary::WriteAnyContentObject: " 443 "unable to write AnyContent object in ASN");
449 "CObjectOStreamAsnBinary::CopyAnyContentObject: " 450 "unable to copy AnyContent object in ASN");
455 #if BITSTRING_AS_VECTOR 456 boolcompressed =
false;
463CBitString::statistics
st;
480 const size_treserve=128;
486 #if BITSTRING_AS_VECTOR 487 for( CBitString::const_iterator
i= obj.begin(); !
done; ) {
494bytes[
b++] =
data;
495 if(
b==reserve ||
done) {
515 done= (++
i== ilast);
517bytes[
b++] =
data;
518 if(
b==reserve ||
done) {
529 in.ReadBitString(obj);
550length =
sizeof(
data);
593length =
sizeof(
data);
602 if(
data<= 0x7fU ) {
605 else if(
data<= 0x7fffU ) {
609 else if(
data<= 0x7fffffU ) {
613 else if(
data<= 0x7fffffffU ) {
619 if( (
data& (
Uint4(1) << (
sizeof(
data) * 8 - 1))) != 0 ) {
628length =
sizeof(
data);
638 if(
data<= 0x7fUL ) {
641 else if(
data<= 0x7fffUL ) {
645 else if(
data<= 0x7fffffUL ) {
649 else if(
data<= 0x7fffffffUL ) {
667 if( (
data& (
Uint8(1) << (
sizeof(
data) * 8 - 1))) != 0 ) {
676length =
sizeof(
data);
713 return type!=
nullptr&&
type->GetCodeVersion() < 21600;
758 if(memcmp(&
data, &zero,
sizeof(
double)) == 0) {
789 if( width <= 0 || width >=
int(
sizeof(
buffer) - 1) )
792 char* dot = strchr(
buffer,
',');
804 for(
const char* p =
buffer+ width - 1; p >=
buffer; --p) {
808}
else if(*p ==
'e'|| *p ==
'E') {
833 size_tlength =
str.size(), fixed = 0;
836 for(
size_t i= 0;
i< length; ++
i) {
845 for(
size_t i= 0;
i< length; ++
i) {
848 #if SERIAL_ALLOW_UTF8_IN_VISIBLESTRING_ON_WRITING 865 if(
done< length ) {
877 size_tlength =
str.size();
885 size_tlength =
in.ReadLength();
887 while( length > 0 ) {
889 size_tc =
min(length,
sizeof(
buffer));
892 if( checkVisible ) {
894 for(
size_t i= 0;
i< c;
i++) {
912 const boolcheckVisible =
false;
923 size_tlength =
str.size();
925 if( checkVisible ) {
950 in.ReadStringStore(
str);
951 size_tlength =
str.size();
964 size_tlength = strlen(
str), fixed = 0;
970 for(
size_t i= 0;
i< length; ++
i) {
973 #if SERIAL_ALLOW_UTF8_IN_VISIBLESTRING_ON_WRITING 993 if(
done< length ) {
1039 "must be either sizeof(Int4) or sizeof(Int8)");
1069 #ifdef VIRTUAL_MID_LEVEL_IO 1074 boolneed_eoc =
false;
1075 #if USE_VERIFY_TAGGING 1078 if(namedTypeInfo->
HasTag()) {
1079 #if USE_VERIFY_TAGGING 1088namedTypeInfo->
GetTag());
1114 #ifndef VIRTUAL_MID_LEVEL_IO 1119 #ifndef VIRTUAL_MID_LEVEL_IO 1125 boolneed_eoc =
false;
1126 #if USE_VERIFY_TAGGING 1129 if(namedTypeInfo->
HasTag()) {
1130 #if USE_VERIFY_TAGGING 1139namedTypeInfo->
GetTag());
1184 #if USE_VERIFY_TAGGING 1224 #if USE_VERIFY_TAGGING 1245 "NULL element while writing container "+
1316 #if USE_VERIFY_TAGGING 1324 #if USE_VERIFY_TAGGING 1352 if(
id.HasTag()) {
1358 #if USE_VERIFY_TAGGING 1380 #ifdef VIRTUAL_MID_LEVEL_IO 1391 #if USE_VERIFY_TAGGING 1399 #if USE_VERIFY_TAGGING 1430 boolneed_eoc =
false;
1431 if(memberId.
HasTag()) {
1438 #if USE_VERIFY_TAGGING 1469 boolneed_eoc =
false;
1470 if(memberId.
HasTag()) {
1477 #if USE_VERIFY_TAGGING 1525 if( read[index] ) {
1529read[index] =
true;
1557 if( !read[*
i] ) {
1618pos.SetIndex(index + 1);
1627 for( ; pos.Valid(); ++pos ) {
1672 if(
id.HasTag()) {
1678 #if USE_VERIFY_TAGGING 1711 const char* bytes,
size_tlength)
1729 const char*
str,
size_tlength)
1733 size_t done= 0, fixed = 0;
1734 for(
size_t i= 0;
i< length; ++
i) {
1737 #if SERIAL_ALLOW_UTF8_IN_VISIBLESTRING_ON_WRITING 1756 if(
done< length ) {
ncbi::TMaskedQueryRegions mask
Serializable object that stores any combination of parsable data.
CObjectIStreamAsnBinary â.
CObjectOStreamAsnBinary â.
T & Get(void)
Create the variable if not created yet, return the reference.
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...
size_type size() const noexcept
Returns bvector's capacity (number of bits it can store)
bvector_size_type size_type
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
enumerator end() const
Returns enumerator pointing on the next bit after the last.
void calc_stat(struct bm::bvector< Alloc >::statistics *st) const noexcept
Calculates bitvector statistics.
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define finite
Define value of finite (Is Finite).
const string & FindName(TEnumValueType value, bool allowBadValue) const
Find name of the enum by its numeric value.
CAsnBinaryDefs::ETagClass GetTagClass(void) const
const CMemberId & GetId(void) const
bool IsAttlist(void) const
void WriteMember(CObjectOStream &out, TConstObjectPtr classPtr) const
void CopyMissingMember(CObjectStreamCopier &copier) const
bool IsTagImplicit(void) const
void CopyMember(CObjectStreamCopier &copier) const
bool IsTagConstructed(void) const
TMemberIndex LastIndex(void) const
bool IsInteger(void) const
Check whether the type is defined as INTEGER in ASN.1 spec.
CAsnBinaryDefs::ETagConstructed GetTagConstructed(void) const
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
size_t TMemberIndex
Type used for indexing class members and choice variants.
const TMemberIndex kFirstMemberIndex
Start if member indexing.
const TMemberIndex kInvalidMember
Special value returned from FindMember.
const void * TConstObjectPtr
static const TObjectType * SafeCast(TTypeInfo type)
@ eFNP_Allow
pass through unchanged, post no error message
@ eFNP_Skip
skip, post no error message
@ eSerialVerifyData_Yes
do verify
@ eStringTypeUTF8
UTF8-encoded string.
@ eStringTypeVisible
VisibleString (in ASN.1 sense)
@ eSerial_AsnBinary
ASN.1 binary.
virtual void WriteBitString(const CBitString &obj) override
static ETagValue GetTagValue(TByte byte)
static ETagConstructed GetTagConstructed(TByte byte)
void WriteLongLength(size_t length)
char ReplaceVisibleChar(char c, EFixNonPrint fix_method, const CObjectStack *io, const CTempString &str, char subst)
virtual void WriteString(const string &s, EStringType type=eStringTypeVisible) override
virtual void WriteInt4(Int4 data) override
virtual void WriteNullPointer(void) override
virtual void EndClassMember(void)
void WriteClassMember(const CConstObjectInfoMI &member)
EFixNonPrint x_FixCharsMethod(void) const
virtual void WriteObjectReference(TObjectIndex index) override
virtual void WriteDouble(double data) override
virtual void WriteOther(TConstObjectPtr object, TTypeInfo typeInfo) override
virtual void WriteBool(bool data) override
static ETagClass GetTagClass(TByte byte)
void WriteEndOfContent(void)
#define END_OBJECT_2FRAMES_OF(Stream)
void WriteByte(Uint1 byte)
virtual void EndContainerElement(void)
void WriteIndefiniteLength(void)
bool GoodVisibleChar(char c)
void WriteShortTag(ETagClass tag_class, ETagConstructed tag_constructed, ETagValue tag_value)
virtual void CopyStringStore(CObjectIStream &in) override
void CopyStringValue(CObjectIStreamAsnBinary &in, bool checkVisible=false)
void CopyObject(TTypeInfo objectType, CObjectStreamCopier &copier)
void WriteNumberValue(Int4 data)
virtual void BeginBytes(const ByteBlock &block) override
#define ThrowError(flag, mess)
static bool IsTagConstructed(TByte byte)
virtual void EndContainer(void)=0
virtual void WriteUint4(Uint4 data) override
void WriteLongTag(ETagClass tag_class, ETagConstructed tag_constructed, TLongTag tag_value)
void DuplicatedMember(const CMemberInfo *memberInfo)
virtual void WriteNull(void) override
virtual TMemberIndex BeginClassMember(const CClassTypeInfo *classType)=0
bool IsCompressed(void) const
virtual void BeginChoiceVariant(const CChoiceTypeInfo *choiceType, const CMemberId &id) override
#define BEGIN_OBJECT_FRAME2(Type, Arg)
size_t GetLength(void) const
static CObjectOStream * OpenObjectOStreamAsnBinary(CNcbiOstream &out, EOwnership deleteOut)
void WriteClassTag(TTypeInfo typeInfo)
virtual void WriteOtherBegin(TTypeInfo typeInfo) override
virtual void WriteStringStore(const string &s) override
void ExpectSysTag(ETagClass tag_class, ETagConstructed tag_constructed, ETagValue tag_value)
MLIOVIR void WriteContainer(const CContainerTypeInfo *containerType, TConstObjectPtr containerPtr)
virtual void BeginNamedType(TTypeInfo namedTypeInfo)
virtual void CopyString(CObjectIStream &in, EStringType type=eStringTypeVisible) override
static TByte MakeUTF8StringTag(void)
void SetNotag(bool set=true)
void SetPathHooks(CObjectStack &stk, bool set)
virtual void EndClass(void) override
void WriteDouble2(double data, unsigned digits)
virtual void WriteUint8(Uint8 data) override
TFrame & FetchFrameFromTop(size_t index)
virtual void EndNamedType(void)
void WriteObject(const CConstObjectInfo &object)
virtual void BeginClass(const CClassTypeInfo *classInfo) override
virtual void EndChoiceVariant(void) override
#define BEGIN_OBJECT_2FRAMES_OF(Stream, Type)
CObjectOStreamAsnBinary(CNcbiOstream &out, EFixNonPrint how=eFNP_Default)
Constructor.
void Write(const CConstObjectInfo &object)
virtual void BeginContainer(const CContainerTypeInfo *containerType)=0
virtual void WriteCString(const char *str) override
virtual void WriteOtherEnd(TTypeInfo typeInfo) override
virtual void WriteChar(char data) override
virtual void CopyAnyContentObject(CObjectIStream &in) override
#define END_OBJECT_FRAME()
#define BEGIN_OBJECT_FRAME_OF2(Stream, Type, Arg)
CObjectIStream & In(void) const
virtual void BeginClassMember(const CMemberId &id) override
void SetNoEOC(bool set=true)
virtual void CopyBitString(CObjectIStream &in) override
void WriteBytes(const char *bytes, size_t size)
ESpecialCaseWrite m_SpecialCaseWrite
const TFrame & TopFrame(void) const
size_t GetLength(void) const
virtual void WriteInt8(Int8 data) override
char x_FixCharsSubst(void) const
MLIOVIR void CopyNamedType(TTypeInfo namedTypeInfo, TTypeInfo typeInfo, CObjectStreamCopier &copier)
MLIOVIR void WriteClass(const CClassTypeInfo *objectType, TConstObjectPtr objectPtr)
static TByte MakeContainerTagByte(bool random_order)
virtual void CopyEnum(const CEnumeratedTypeValues &values, CObjectIStream &in) override
virtual void BeginContainer(const CContainerTypeInfo *containerType) override
virtual void WriteFloat(float data) override
virtual void EndContainer(void) override
virtual ~CObjectOStreamAsnBinary(void)
Destructor.
virtual void WriteChars(const CharBlock &block, const char *chars, size_t length) override
void SetTopMemberId(const CMemberId &memberId)
MLIOVIR void CopyClassRandom(const CClassTypeInfo *objectType, CObjectStreamCopier &copier)
const CMemberId & GetMemberId(void) const
void WriteSysTag(ETagValue tag)
#define BEGIN_OBJECT_2FRAMES_OF2(Stream, Type, Arg)
void WriteBytesOf(const T &value, size_t count)
virtual bool BeginContainerElement(TTypeInfo elementType)=0
virtual void WriteAnyContentObject(const CAnyContentObject &obj) override
void ExpectStringTag(EStringType type)
virtual void BeginChars(const CharBlock &block) override
virtual void BeginChoice(const CChoiceTypeInfo *choiceType) override
virtual void EndNamedType(void) override
void WriteTag(ETagClass tag_class, ETagConstructed tag_constructed, TLongTag tag_value)
virtual void EndChoice(void) override
EFixNonPrint FixNonPrint(EFixNonPrint how)
virtual void BeginNamedType(TTypeInfo namedTypeInfo) override
MLIOVIR void WriteNamedType(TTypeInfo namedTypeInfo, TTypeInfo typeInfo, TConstObjectPtr object)
MLIOVIR void CopyContainer(const CContainerTypeInfo *containerType, CObjectStreamCopier &copier)
static TByte MakeTagByte(ETagClass tag_class, ETagConstructed tag_constructed, ETagValue tag_value)
void WriteShortLength(size_t length)
virtual void EndClass(void)
virtual void BeginClass(const CClassTypeInfo *classInfo)=0
virtual void EndClassMember(void) override
TTypeInfo GetRecentTypeInfo(void) const
#define END_OBJECT_FRAME_OF(Stream)
virtual void WriteEnum(const CEnumeratedTypeValues &values, TEnumValueType value) override
static TByte GetUTF8StringTag(void)
ESerialVerifyData GetVerifyData(void) const
Get output data verification parameter.
void WriteStringTag(EStringType type)
void WriteLength(size_t length)
MLIOVIR void CopyClassSequential(const CClassTypeInfo *objectType, CObjectStreamCopier &copier)
@ fIllegalCall
Illegal in a given context function call.
@ fInvalidData
Output data is incorrect.
@ fNotImplemented
Method is not implemented.
@ fUnassigned
Mandatory object member is unassigned Normally this results in throwing CUnassignedMember exception.
@ fOverflow
Internal buffer overflow.
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
@ eParam_NoThread
Do not use per-thread values.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed 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.
void PutString(const char *str, size_t length)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
NCBI_NS_STD::string::size_type SIZE_TYPE
static SIZE_TYPE DoubleToStringPosix(double value, unsigned int precision, char *buf, SIZE_TYPE buf_size)
Convert double to string with specified precision and put the result into a character buffer,...
static SIZE_TYPE EvaluateSymbolLength(const CTempString &src)
Check buffer for presence of UTF-8 byte sequence and return length of first symbol.
const string & GetName(void) const
Get name of this type.
CAsnBinaryDefs::ETagClass GetTagClass(void) const
CAsnBinaryDefs::ETagConstructed GetTagConstructed(void) const
bool RandomElementsOrder(void) const
CAsnBinaryDefs::ETagType GetTagType(void) const
bool RandomOrder(void) const
const CMemberInfo * GetMemberInfo(TMemberIndex index) const
const CVariantInfo * GetVariantInfo(TMemberIndex index) const
CAsnBinaryDefs::TLongTag GetTag(void) const
bool IsTagConstructed(void) const
TConstObjectPtr GetElementPtr(const CConstIterator &it) const
bool InitIterator(CConstIterator &it, TConstObjectPtr containerPtr) const
bool IsTagImplicit(void) const
bool NextElement(CConstIterator &it) const
TConstObjectPtr GetObjectPointer(TConstObjectPtr object) const
const CItemsInfo & GetMembers(void) const
TTypeInfo GetElementType(void) const
enum ENcbiOwnership EOwnership
Ownership relations between objects.
size_t serialize(const BV &bv, unsigned char *buf, bm::word_t *temp_block=0, unsigned serialization_flags=0)
Saves bitvector into memory.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
static void byte(MDB_val *v)
void aligned_free(void *ptr) BMNOEXCEPT
Aligned free.
void * aligned_new_malloc(size_t size)
Aligned malloc (unlike classic malloc it throws bad_alloc exception)
const unsigned set_block_alloc_size
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
#define NCBI_CONST_INT8(v)
64-bit integers
#define NCBI_CONST_UINT8(v)
std::istream & in(std::istream &in_, double &x_)
NCBI_PARAM_DEF_EX(bool, SERIAL, WRITE_UTF8STRING_TAG, false, eParam_NoThread, SERIAL_WRITE_UTF8STRING_TAG)
static const size_t kMaxDoubleLength
static bool s_IsOldStyleInt8(const CObjectOStreamAsnBinary *os)
NCBI_PARAM_DECL(bool, SERIAL, WRITE_UTF8STRING_TAG)
static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4