NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | Friends | List of all members
CObjectOStream Class Referenceabstract

Search Toolkit Book for CObjectOStream

CObjectOStream –. More...

#include <serial/objostr.hpp>

+ Inheritance diagram for CObjectOStream:
+ Collaboration diagram for CObjectOStream:


class  AsnIo
class  ByteBlock
class  CharBlock

Public Types

enum  EFailFlags {
  fNoError = 0 , eNoError = fNoError , fWriteError = 1 << 1 , eWriteError = fWriteError ,
  fOverflow = 1 << 3 , eOverflow = fOverflow , fInvalidData = 1 << 4 , eInvalidData = fInvalidData ,
  fIllegalCall = 1 << 5 , eIllegalCall = fIllegalCall , fFail = 1 << 6 , eFail = fFail ,
  fNotOpen = 1 << 7 , eNotOpen = fNotOpen , fNotImplemented = 1 << 8 , eNotImplemented = fNotImplemented ,
  fUnassigned = 1 << 9 , eUnassigned = fUnassigned
 Fail flags. More...
enum  EDelayBufferParsing { eDelayBufferPolicyNotSet , eDelayBufferPolicyAlwaysParse , eDelayBufferPolicyNeverParse }
 DelayBuffer parsing policy. More...
enum  EFlags {
  fFlagNone = 0 , eFlagNone = fFlagNone , fFlagAllowNonAsciiChars = 1 << 0 , eFlagAllowNonAsciiChars = fFlagAllowNonAsciiChars ,
  fFlagNoAutoFlush = 1 << 1
enum  ESpecialCaseWrite { eWriteAsNormal = 0 , eWriteAsDefault = 1 , eWriteAsNil = 2 , eWriteAsBigInt = 3 }
typedef int TFailFlags
typedef int TFlags
- Public Types inherited from CObjectStack
typedef CObjectStackFrame TFrame
typedef TFrame::EFrameType EFrameType

Public Member Functions

virtual ~CObjectOStream (void)
 Destructor. More...
ESerialDataFormat GetDataFormat (void) const
 Get data format. More...
void SetVerifyData (ESerialVerifyData verify)
 Set up output data verification for this particular stream. More...
ESerialVerifyData GetVerifyData (void) const
 Get output data verification parameter. More...
EFixNonPrint FixNonPrint (EFixNonPrint how)
void FixNonPrintSubst (char subst)
void EnforceWritingDefaultValues (bool enforce=true)
bool IsWritingDefaultValuesEnforced () const
void SetUseIndentation (bool set)
 Set up indentation usage in text streams. More...
bool GetUseIndentation (void) const
 Get indentation usage in text streams. More...
void SetUseEol (bool set)
 Set up end-of-line symbol usage in text streams. More...
bool GetUseEol (void) const
 Get end-of-line symbol usage in text streams. More...
void SetWriteNamedIntegersByValue (bool set)
 Set up writing named integers (in ANS.1 sense) by value only. More...
bool GetWriteNamedIntegersByValue (void) const
 Get writing named integers by value parameter. More...
string GetSeparator (void) const
 Get separator. More...
void SetSeparator (const string sep)
 Set separator. More...
bool GetAutoSeparator (void)
 Get separator auto-output paramater. More...
void SetAutoSeparator (bool value)
 Set separator auto-output paramater. More...
virtual void SetFormattingFlags (TSerial_Format_Flags flags)
 Set output formatting flags. More...
bool fail (void) const
 Check if any of fail flags is set. More...
TFailFlags GetFailFlags (void) const
 Get fail flags. More...
TFailFlags SetFailFlagsNoError (TFailFlags flags)
 Set fail flags, but do not ERR_POST any messages. More...
TFailFlags SetFailFlags (TFailFlags flags, const char *message)
 Set fail flags. More...
TFailFlags ClearFailFlags (TFailFlags flags)
 Reset fail flags. More...
bool InGoodState (void)
 Check fail flags and also the state of output stream. More...
void SetCanceledCallback (const ICanceled *callback)
 Set cancellation check callback. More...
CNcbiStreampos GetStreamOffset (void) const
CNcbiStreampos GetStreamPos (void) const
 Get the current stream position. More...
virtual string GetStackTrace (void) const override
 Get current stack trace as string. More...
virtual string GetPosition (void) const override
 Get current stream position as string. More...
void SetPathWriteObjectHook (const string &path, CWriteObjectHook *hook)
void SetPathWriteMemberHook (const string &path, CWriteClassMemberHook *hook)
void SetPathWriteVariantHook (const string &path, CWriteChoiceVariantHook *hook)
void SetDelayBufferParsingPolicy (EDelayBufferParsing policy)
EDelayBufferParsing GetDelayBufferParsingPolicy (void) const
bool ShouldParseDelayBuffer (void) const
void FlushBuffer (void)
void Flush (void)
void DefaultFlush (void)
void Write (const CConstObjectInfo &object)
void Write (TConstObjectPtr object, TTypeInfo type)
void Write (TConstObjectPtr object, const CTypeRef &type)
virtual void WriteFileHeader (TTypeInfo type)
void WriteObject (const CConstObjectInfo &object)
void WriteObject (TConstObjectPtr object, TTypeInfo typeInfo)
void CopyObject (TTypeInfo objectType, CObjectStreamCopier &copier)
void WriteSeparateObject (const CConstObjectInfo &object)
void WriteExternalObject (TConstObjectPtr object, TTypeInfo typeInfo)
void WriteClassMember (const CConstObjectInfoMI &member)
void WriteChoiceVariant (const CConstObjectInfoCV &member)
CObjectOStreamoperator<< (CObjectOStream &(*mod)(CObjectOStream &os))
void WriteStd (const bool &data)
void WriteStd (const char &data)
void WriteStd (const signed char &data)
void WriteStd (const unsigned char &data)
void WriteStd (const short &data)
void WriteStd (const unsigned short &data)
void WriteStd (const int &data)
void WriteStd (const unsigned int &data)
void WriteStd (const long &data)
void WriteStd (const unsigned long &data)
void WriteStd (const Int8 &data)
void WriteStd (const Uint8 &data)
void WriteStd (const float &data)
void WriteStd (const double &data)
void WriteStd (const string &data)
void WriteStd (const char *const data)
void WriteStd (char *const data)
void WriteStd (const CBitString &data)
virtual void WriteBool (bool data)=0
virtual void WriteChar (char data)=0
virtual void WriteInt4 (Int4 data)=0
virtual void WriteUint4 (Uint4 data)=0
virtual void WriteInt8 (Int8 data)=0
virtual void WriteUint8 (Uint8 data)=0
virtual void WriteFloat (float data)
virtual void WriteDouble (double data)=0
virtual void WriteString (const string &str, EStringType type=eStringTypeVisible)=0
virtual void CopyString (CObjectIStream &in, EStringType type=eStringTypeVisible)=0
virtual void WriteStringStore (const string &data)=0
virtual void CopyStringStore (CObjectIStream &in)=0
virtual void WriteCString (const char *str)=0
virtual void WriteNull (void)=0
virtual void WriteEnum (const CEnumeratedTypeValues &values, TEnumValueType value)=0
virtual void CopyEnum (const CEnumeratedTypeValues &values, CObjectIStream &in)=0
virtual void WriteAnyContentObject (const CAnyContentObject &obj)=0
virtual void CopyAnyContentObject (CObjectIStream &in)=0
virtual void WriteBitString (const CBitString &obj)=0
virtual void CopyBitString (CObjectIStream &in)=0
virtual bool Write (CByteSource &source)
void Write (const char *data, size_t size)
void WriteStd (const TGi &data)
virtual void WriteGi (const TGi &obj)
virtual void CopyGi (CObjectIStream &in)
void Close (void)
virtual void EndOfWrite (void)
void ResetLocalHooks (void)
void HandleEOF (CEofException &)
void ThrowError1 (const CDiagCompileInfo &diag_info, TFailFlags fail, const char *message, CException *exc=0)
void ThrowError1 (const CDiagCompileInfo &diag_info, TFailFlags fail, const string &message, CException *exc=0)
void Unended (const string &msg)
virtual void UnendedFrame (void) override
TFlags GetFlags (void) const
TFlags SetFlags (TFlags flags)
TFlags ClearFlags (TFlags flags)
MLIOVIR void WriteNamedType (TTypeInfo namedTypeInfo, TTypeInfo typeInfo, TConstObjectPtr object)
MLIOVIR void WriteContainer (const CContainerTypeInfo *containerType, TConstObjectPtr containerPtr)
void WriteContainerElement (const CConstObjectInfo &element)
void WriteClassRandom (const CClassTypeInfo *classType, TConstObjectPtr classPtr)
void WriteClassSequential (const CClassTypeInfo *classType, TConstObjectPtr classPtr)
MLIOVIR void WriteClass (const CClassTypeInfo *objectType, TConstObjectPtr objectPtr)
MLIOVIR void WriteClassMember (const CMemberId &memberId, TTypeInfo memberType, TConstObjectPtr memberPtr)
MLIOVIR bool WriteClassMember (const CMemberId &memberId, const CDelayBuffer &buffer)
MLIOVIR void WriteAlias (const CAliasTypeInfo *aliasType, TConstObjectPtr aliasPtr)
MLIOVIR void CopyNamedType (TTypeInfo namedTypeInfo, TTypeInfo typeInfo, CObjectStreamCopier &copier)
MLIOVIR void CopyContainer (const CContainerTypeInfo *containerType, CObjectStreamCopier &copier)
MLIOVIR void CopyClassRandom (const CClassTypeInfo *objectType, CObjectStreamCopier &copier)
MLIOVIR void CopyClassSequential (const CClassTypeInfo *objectType, CObjectStreamCopier &copier)
MLIOVIR void CopyChoice (const CChoiceTypeInfo *choiceType, CObjectStreamCopier &copier)
MLIOVIR void CopyAlias (const CAliasTypeInfo *AliasType, CObjectStreamCopier &copier)
virtual void BeginNamedType (TTypeInfo namedTypeInfo)
virtual void EndNamedType (void)
virtual void BeginContainer (const CContainerTypeInfo *containerType)=0
virtual void EndContainer (void)
virtual void BeginContainerElement (TTypeInfo elementType)
virtual void EndContainerElement (void)
virtual void BeginClass (const CClassTypeInfo *classInfo)=0
virtual void EndClass (void)
virtual void BeginClassMember (const CMemberId &id)=0
virtual void EndClassMember (void)
virtual void BeginChoice (const CChoiceTypeInfo *choiceType)
virtual void EndChoice (void)
virtual void BeginChoiceVariant (const CChoiceTypeInfo *choiceType, const CMemberId &id)=0
virtual void EndChoiceVariant (void)
virtual void BeginBytes (const ByteBlock &block)
virtual void WriteBytes (const ByteBlock &block, const char *bytes, size_t length)=0
virtual void EndBytes (const ByteBlock &block)
virtual void BeginChars (const CharBlock &block)
virtual void WriteChars (const CharBlock &block, const char *chars, size_t length)=0
virtual void EndChars (const CharBlock &block)
void WritePointer (TConstObjectPtr object, TTypeInfo typeInfo)
void SetSpecialCaseWrite (ESpecialCaseWrite how)
MLIOVIR void WriteClassMemberSpecialCase (const CMemberId &memberId, TTypeInfo memberType, TConstObjectPtr memberPtr, ESpecialCaseWrite how)
- Public Member Functions inherited from CObjectStack
 CObjectStack (void)
virtual ~CObjectStack (void)
size_t GetStackDepth (void) const
TFramePushFrame (EFrameType type, TTypeInfo typeInfo, TConstObjectPtr objectPtr=0)
TFramePushFrame (EFrameType type, const CMemberId &memberId)
TFramePushFrame (EFrameType type)
void PopFrame (void)
void PopErrorFrame (void)
void SetTopMemberId (const CMemberId &memberId)
bool IsNsQualified (void)
bool IsCompressed (void) const
bool StackIsEmpty (void) const
void ClearStack (void)
string GetStackTraceASN (void) const
const TFrameTopFrame (void) const
TFrameTopFrame (void)
TFrameFetchFrameFromTop (size_t index)
const TFrameFetchFrameFromTop (size_t index) const
const TFrameFetchFrameFromBottom (size_t index) const
TTypeInfo GetRecentTypeInfo (void) const
bool IsKnownElement (const CTempString &name) const
const stringGetStackPath (void) const
void WatchPathHooks (bool set=true)
void RegisterPathHook (CPathHook *h)
void ResetPathHooks (void)

Static Public Member Functions

static CObjectOStreamOpen (ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
 Create serial object writer and attach it to an output stream. More...
static CObjectOStreamOpen (ESerialDataFormat format, CNcbiOstream &outStream, EOwnership deleteOutStream=eNoOwnership, TSerial_Format_Flags formatFlags=0)
 Create serial object writer and attach it to an output stream. More...
static CObjectOStreamOpen (ESerialDataFormat format, const string &fileName, TSerialOpenFlags openFlags=0, TSerial_Format_Flags formatFlags=0)
 Create serial object writer and attach it to a file stream. More...
static CObjectOStreamOpen (const string &fileName, ESerialDataFormat format, TSerial_Format_Flags formatFlags=0)
 Create serial object writer and attach it to a file stream. More...
static void SetVerifyDataThread (ESerialVerifyData verify)
 Set up default output data verification for streams created by the current thread. More...
static void SetVerifyDataGlobal (ESerialVerifyData verify)
 Set up default output data verification for streams created by the current process. More...
- Static Public Member Functions inherited from CObjectStack
static TTypeInfo GetRealTypeInfo (TTypeInfo typeInfo)
static ETypeFamily GetRealTypeFamily (TTypeInfo typeInfo)
static TTypeInfo GetContainerElementTypeInfo (TTypeInfo typeInfo)
static ETypeFamily GetContainerElementTypeFamily (TTypeInfo typeInfo)

Public Attributes

CLocalHookSet< CWriteObjectHookm_ObjectHookKey
CLocalHookSet< CWriteClassMemberHookm_ClassMemberHookKey
CLocalHookSet< CWriteChoiceVariantHookm_ChoiceVariantHookKey

Protected Types

typedef size_t TObjectIndex

Protected Member Functions

 CObjectOStream (ESerialDataFormat format, CNcbiOstream &out, EOwnership deleteOut=eNoOwnership)
virtual void WriteNullPointer (void)=0
virtual void WriteObjectReference (TObjectIndex index)=0
virtual void WriteThis (TConstObjectPtr object, TTypeInfo typeInfo)
virtual void WriteOtherBegin (TTypeInfo typeInfo)=0
virtual void WriteOtherEnd (TTypeInfo typeInfo)
virtual void WriteOther (TConstObjectPtr object, TTypeInfo typeInfo)
void RegisterObject (TTypeInfo typeInfo)
void RegisterObject (TConstObjectPtr object, TTypeInfo typeInfo)
virtual void x_SetPathHooks (bool set) override
EFixNonPrint x_GetFixCharsMethodDefault (void) const
EFixNonPrint x_FixCharsMethod (void) const
char x_FixCharsSubst (void) const
virtual void WriteSeparator (void)
- Protected Member Functions inherited from CObjectStack
virtual void ResetState (void)

Protected Attributes

COStreamBuffer m_Output
TFailFlags m_Fail
TFlags m_Flags
AutoPtr< CWriteObjectListm_Objects
string m_Separator
ESerialDataFormat m_DataFormat
EDelayBufferParsing m_ParseDelayBuffers
ESpecialCaseWrite m_SpecialCaseWrite
bool m_AutoSeparator
bool m_WriteNamedIntegersByValue
bool m_FastWriteDouble
bool m_EnforceWritingDefaults
TTypeInfo m_TypeAlias

Static Private Member Functions

static CObjectOStreamOpenObjectOStreamAsn (CNcbiOstream &out, EOwnership deleteOut)
static CObjectOStreamOpenObjectOStreamAsnBinary (CNcbiOstream &out, EOwnership deleteOut)
static CObjectOStreamOpenObjectOStreamXml (CNcbiOstream &out, EOwnership deleteOut)
static CObjectOStreamOpenObjectOStreamJson (CNcbiOstream &out, EOwnership deleteOut)
static ESerialVerifyData x_GetVerifyDataDefault (void)

Private Attributes

char m_NonPrintSubst
EFixNonPrint m_FixMethod
ESerialVerifyData m_VerifyData
CStreamObjectPathHook< CWriteObjectHook * > m_PathWriteObjectHooks
CStreamPathHook< CMemberInfo *, CWriteClassMemberHook * > m_PathWriteMemberHooks
CStreamPathHook< CVariantInfo *, CWriteChoiceVariantHook * > m_PathWriteVariantHooks


class ByteBlock
class CharBlock
class AsnIo
class CObjectStreamCopier
CObjectOStreamSeparator (CObjectOStream &os)

Detailed Description

CObjectOStream –.

Base class of serial object stream encoders

Definition at line 82 of file objostr.hpp.

The documentation for this class was generated from the following files:
Modified on Wed Apr 17 13:08:10 2024 by rev. 669887