54 #define NCBI_USE_ERRCODE_X Serial_OStream
200 if (memcmp(&
data, &zero,
sizeof(
double)) == 0) {
227 #if !defined(NCBI_COMPILER_MSVC)
228 int width = sprintf(
buffer,
"%.*e",
int(digits-1),
data);
229 if ( width <= 0 || width >=
int(
sizeof(
buffer) - 1) )
232 char* dotPos = strchr(
buffer,
'.');
234 dotPos = strchr(
buffer,
',');
237 char* ePos = strchr(dotPos,
'e');
246 if ( sscanf(ePos + 1,
"%d", &exp) != 1 )
250 int fractDigits =
int(ePos - dotPos - 1);
251 while ( fractDigits > 0 && ePos[-1] ==
'0' ) {
266 int width = sprintf(
buffer,
"%.*g",
int(digits),
data);
267 if ( width <= 0 || width >=
int(
sizeof(
buffer) - 1) )
272 const char* ePos = strchr(
buffer,
'e');
274 if ( sscanf(ePos + 1,
"%d", &exp) != 1 )
279 char* dotPos = strchr(
buffer,
'.');
281 dotPos = strchr(
buffer,
',');
284 exp -= (
int)(ePos - dotPos - 1);
285 memmove(dotPos, dotPos+1, strlen(dotPos+1));
288 while ( ePos[-1] ==
'0' ) {
292 const char *start =
buffer;
293 while ( *start ==
'0' ) {
324 "CObjectOStreamAsn::WriteAnyContentObject: "
325 "unable to write AnyContent object in ASN");
336 "CObjectOStreamAsn::CopyAnyContentObject: "
337 "unable to copy AnyContent object in ASN");
342 static const char ToHex[] =
"0123456789ABCDEF";
345 #if BITSTRING_AS_VECTOR
349 for ( CBitString::const_iterator
i = obj.begin();
i != obj.
end(); ) {
367 CBitString::statistics
st;
392 for (;
i < ilast; ++
i) {
409 in.ReadBitString(obj);
418 while ( length > 0 ) {
423 #if SERIAL_ALLOW_UTF8_IN_VISIBLESTRING_ON_WRITING
485 in.ReadStringStore(s);
497 if (checkCase && !
str.empty()) {
520 "must be either sizeof(Int4) or sizeof(Int8)");
578 #ifdef VIRTUAL_MID_LEVEL_IO
598 "NULL element while writing container "+
648 auto tn = [
this]()->
const string& {
653 const string& name = (
m_TypeAlias &&
id.HasNotag()) ? tn() :
id.GetName();
655 if ( !name.empty() ) {
656 if (
id.HaveNoPrefix() &&
isupper((
unsigned char)name[0])) {
664 else if (
id.HaveExplicitTag() ) {
686 #ifdef VIRTUAL_MID_LEVEL_IO
814 pos.SetIndex(index + 1);
823 for ( ; pos.Valid(); ++pos ) {
873 static const char HEX[] =
"0123456789ABCDEF";
876 const char* bytes,
size_t length)
883 while ( length-- > 0 ) {
903 const char*
chars,
size_t length)
907 while ( length > 0 ) {
911 #if SERIAL_ALLOW_UTF8_IN_VISIBLESTRING_ON_WRITING
Serializable object that stores any combination of parsable data.
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 const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eTakeOwnership
An object can take ownership of another.
@ eNoOwnership
No ownership is assumed.
#define finite
Define value of finite (Is Finite).
const CMemberId & GetId(void) const
bool IsAttlist(void) const
void WriteMember(CObjectOStream &out, TConstObjectPtr classPtr) const
void CopyMissingMember(CObjectStreamCopier &copier) const
void CopyMember(CObjectStreamCopier &copier) const
TMemberIndex LastIndex(void) const
const string & FindNameEx(TEnumValueType value, bool allowBadValue) const
bool IsInteger(void) const
Check whether the type is defined as INTEGER in ASN.1 spec.
EFixNonPrint
How to process non-printing character in the ASN VisibleString.
const CStringUTF8 & GetValue(void) const
Get normalized value.
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
const string & GetName(void) const
Get local name.
@ eFNP_Allow
pass through unchanged, post no error message
@ eSerialVerifyData_Yes
do verify
@ eStringTypeUTF8
UTF8-encoded string.
@ eSerial_AsnText
ASN.1 text.
virtual void BeginBytes(const ByteBlock &block) override
virtual void CopyString(CObjectIStream &in, EStringType type=eStringTypeVisible) override
virtual void WriteInt8(Int8 data) override
char ReplaceVisibleChar(char c, EFixNonPrint fix_method, const CObjectStack *io, const CTempString &str, char subst)
virtual void EndClassMember(void)
virtual void WriteCString(const char *str) override
void WriteClassMember(const CConstObjectInfoMI &member)
EFixNonPrint x_FixCharsMethod(void) const
void SetAutoSeparator(bool value)
Set separator auto-output paramater.
virtual void EndChars(const CharBlock &block) override
CObjectOStreamAsn(CNcbiOstream &out, EFixNonPrint how=eFNP_Default)
Constructor.
#define END_OBJECT_2FRAMES_OF(Stream)
virtual void EndContainerElement(void)
virtual void WriteInt4(Int4 data) override
bool GoodVisibleChar(char c)
virtual void EndClass(void) override
virtual void WriteChars(const CharBlock &block, const char *chars, size_t length) override
virtual void CopyStringStore(CObjectIStream &in) override
void CopyObject(TTypeInfo objectType, CObjectStreamCopier &copier)
virtual void WriteUint4(Uint4 data) override
static CObjectOStream * OpenObjectOStreamAsn(CNcbiOstream &out, EOwnership deleteOut)
virtual void WriteOther(TConstObjectPtr object, TTypeInfo typeInfo) override
#define ThrowError(flag, mess)
virtual void EndContainer(void)=0
virtual void BeginClassMember(const CMemberId &id) override
virtual void WriteBytes(const ByteBlock &block, const char *bytes, size_t length) override
virtual void WriteOtherBegin(TTypeInfo typeInfo) override
virtual void WriteObjectReference(TObjectIndex index) override
virtual void EndContainer(void) override
void DuplicatedMember(const CMemberInfo *memberInfo)
virtual TMemberIndex BeginClassMember(const CClassTypeInfo *classType)=0
bool IsCompressed(void) const
#define BEGIN_OBJECT_FRAME2(Type, Arg)
virtual void WriteFloat(float data) override
virtual void EndBytes(const ByteBlock &block) override
MLIOVIR void WriteContainer(const CContainerTypeInfo *containerType, TConstObjectPtr containerPtr)
void SetNotag(bool set=true)
void SetPathHooks(CObjectStack &stk, bool set)
virtual void WriteBool(bool data) override
virtual void CopyBitString(CObjectIStream &in) override
void WriteObject(const CConstObjectInfo &object)
virtual void WriteString(const string &str, EStringType type=eStringTypeVisible) override
#define BEGIN_OBJECT_2FRAMES_OF(Stream, Type)
void Write(const CConstObjectInfo &object)
virtual void BeginContainer(const CContainerTypeInfo *containerType)=0
virtual void WriteSeparator(void) override
virtual void BeginChoiceVariant(const CChoiceTypeInfo *choiceType, const CMemberId &id) override
virtual ~CObjectOStreamAsn(void)
Destructor.
virtual void WriteBitString(const CBitString &obj) override
#define END_OBJECT_FRAME()
#define BEGIN_OBJECT_FRAME_OF2(Stream, Type, Arg)
virtual void WriteNullPointer(void) override
virtual void WriteUint8(Uint8 data) override
CObjectIStream & In(void) const
virtual void BeginContainer(const CContainerTypeInfo *containerType) override
virtual void WriteChar(char data) override
virtual void WriteDouble(double data) override
const TFrame & TopFrame(void) const
char x_FixCharsSubst(void) const
MLIOVIR void WriteClass(const CClassTypeInfo *objectType, TConstObjectPtr objectPtr)
void WriteId(const string &str, bool checkCase=false)
void SetTopMemberId(const CMemberId &memberId)
void WriteMemberId(const CMemberId &id)
virtual void CopyEnum(const CEnumeratedTypeValues &values, CObjectIStream &in) override
MLIOVIR void CopyClassRandom(const CClassTypeInfo *objectType, CObjectStreamCopier &copier)
#define BEGIN_OBJECT_2FRAMES_OF2(Stream, Type, Arg)
virtual void EndChoice(void) override
virtual bool BeginContainerElement(TTypeInfo elementType)=0
virtual void BeginChars(const CharBlock &block) override
virtual void CopyAnyContentObject(CObjectIStream &in) override
void SetSeparator(const string sep)
Set separator.
virtual void WriteStringStore(const string &str) override
virtual void BeginClass(const CClassTypeInfo *classInfo) override
string GetSeparator(void) const
Get separator.
EFixNonPrint FixNonPrint(EFixNonPrint how)
bool m_WriteNamedIntegersByValue
MLIOVIR void CopyContainer(const CContainerTypeInfo *containerType, CObjectStreamCopier &copier)
virtual void BeginChoice(const CChoiceTypeInfo *choiceType) override
virtual void EndClass(void)
virtual void BeginClass(const CClassTypeInfo *classInfo)=0
void WriteDouble2(double data, unsigned digits)
virtual void BeginContainerElement(TTypeInfo elementType) override
#define END_OBJECT_FRAME_OF(Stream)
virtual string GetPosition(void) const override
Get current stream position as string.
ESerialVerifyData GetVerifyData(void) const
Get output data verification parameter.
virtual void WriteEnum(const CEnumeratedTypeValues &values, TEnumValueType value) override
virtual void WriteAnyContentObject(const CAnyContentObject &obj) override
virtual void WriteNull(void) override
virtual void WriteFileHeader(TTypeInfo type) override
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.
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 IncIndentLevel(size_t step=2)
void SetBackLimit(size_t limit)
size_t GetLine(void) const
void PutString(const char *str, size_t length)
void PutEol(bool indent=true)
void WrapAt(size_t lineLength, bool keepWord)
void DecIndentLevel(size_t step=2)
bool ZeroIndentLevel(void) const
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static SIZE_TYPE EvaluateSymbolLength(const CTempString &src)
Check buffer for presence of UTF-8 byte sequence and return length of first symbol.
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 SIZE_TYPE DoubleToString_Ecvt(double value, unsigned int precision, char *buf, SIZE_TYPE buf_size, int *dec, int *sign)
Convert double to string with specified precision.
const string & GetName(void) const
Get name of this type.
const CMemberInfo * GetMemberInfo(TMemberIndex index) const
const CVariantInfo * GetVariantInfo(TMemberIndex index) const
TConstObjectPtr GetElementPtr(const CConstIterator &it) const
bool InitIterator(CConstIterator &it, TConstObjectPtr containerPtr) 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 hex(unsigned char c)
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 GenericPointer< typename T::ValueType > T2 value
static const BitmapCharRec *const chars[]
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins st(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)