NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CWriterBase Class Reference

Search Toolkit Book for CWriterBase

Defines and provides stubs for a general interface to a variety of file formatters. More...

#include <objtools/writers/writer.hpp>

+ Inheritance diagram for CWriterBase:
+ Collaboration diagram for CWriterBase:

Public Types

enum  TFlags { fNormal = 0 , fDebugOutput = (1<<0) , fWriterBaseLast = fDebugOutput }
 Customization flags that are relevant to all CWriterBase derived writers. More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

virtual ~CWriterBase ()
 
virtual bool WriteAnnot (const CSeq_annot &, const string &="", const string &="")
 Write a raw Seq-annot to the internal output stream. More...
 
virtual bool WriteAlign (const CSeq_align &, const string &="", const string &="")
 Write a raw Seq-align to the internal output stream. More...
 
virtual bool WriteSeqEntryHandle (CSeq_entry_Handle, const string &="", const string &="")
 Write a Seq-entry handle to the internal output stream. More...
 
virtual bool WriteBioseqHandle (CBioseq_Handle, const string &="", const string &="")
 Write a Bioseq handle to the internal output stream. More...
 
virtual bool WriteSeqAnnotHandle (CSeq_annot_Handle, const string &="", const string &="")
 Write a Seq-annot handle to the internal output stream. More...
 
virtual bool WriteHeader ()
 Write a file header. More...
 
virtual bool WriteHeader (const CSeq_annot &)
 Write a file header, using annotation information. More...
 
virtual bool WriteFooter ()
 Write a file trailer. More...
 
void SetMessageListener (CWriterListener *pMessageListener)
 
virtual void PutMessage (const CWriterMessage &message)
 
virtual SAnnotSelectorSetAnnotSelector (void)
 
SAnnotSelectorGetAnnotSelector (void)
 
virtual CRange< TSeqPos > & SetRange (void)
 
virtual const CRange< TSeqPos > & GetRange (void) const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 
- Public Member Functions inherited from CInterruptable
 CInterruptable ()
 
virtual ~CInterruptable ()
 
void SetCanceler (ICanceled *pCanceller)
 
bool IsCanceled () const
 
- Public Member Functions inherited from ICanceled
virtual ~ICanceled ()
 

Protected Member Functions

 CWriterBase (CNcbiOstream &ostr, unsigned int uFlags=0)
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

CNcbiOstreamm_Os
 
unsigned int m_uFlags
 
unique_ptr< SAnnotSelectorm_Selector
 
CRange< TSeqPosm_Range
 
CWriterListenermpMessageListener
 
- Protected Attributes inherited from CInterruptable
ICanceledmpCancelled
 

Additional Inherited Members

- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Detailed Description

Defines and provides stubs for a general interface to a variety of file formatters.

These writers take Genbank object in raw or handle form, and render them to an output stream in their respective formats.

Definition at line 78 of file writer.hpp.

Member Enumeration Documentation

◆ TFlags

Customization flags that are relevant to all CWriterBase derived writers.

Enumerator
fNormal 
fDebugOutput 
fWriterBaseLast 

Definition at line 85 of file writer.hpp.

Constructor & Destructor Documentation

◆ CWriterBase()

CWriterBase::CWriterBase ( CNcbiOstream ostr,
unsigned int  uFlags = 0 
)
inlineprotected

Definition at line 92 of file writer.hpp.

◆ ~CWriterBase()

virtual CWriterBase::~CWriterBase ( )
inlinevirtual

Definition at line 103 of file writer.hpp.

Member Function Documentation

◆ GetAnnotSelector()

SAnnotSelector& CWriterBase::GetAnnotSelector ( void  )
inline

Definition at line 254 of file writer.hpp.

References SetAnnotSelector().

◆ GetRange()

virtual const CRange<TSeqPos>& CWriterBase::GetRange ( void  ) const
inlinevirtual

◆ PutMessage()

virtual void CWriterBase::PutMessage ( const CWriterMessage message)
inlinevirtual
Parameters
messagemessage to process.

Definition at line 238 of file writer.hpp.

References CObjtoolsMessage::GetText(), mpMessageListener, NCBI_THROW, and CObjtoolsListener::PutMessage().

Referenced by CPslWriter::WriteAlign().

◆ SetAnnotSelector()

virtual SAnnotSelector& CWriterBase::SetAnnotSelector ( void  )
inlinevirtual

◆ SetMessageListener()

void CWriterBase::SetMessageListener ( CWriterListener pMessageListener)
inline
Parameters
pMessageListenerptr to message listener to attach. nullptr to detach the current handler without attaching a new one.

Definition at line 229 of file writer.hpp.

References mpMessageListener.

Referenced by CAnnotWriterApp::xInitWriter().

◆ SetRange()

virtual CRange<TSeqPos>& CWriterBase::SetRange ( void  )
inlinevirtual

Definition at line 258 of file writer.hpp.

References m_Range.

Referenced by CAnnotWriterApp::Run().

◆ WriteAlign()

virtual bool CWriterBase::WriteAlign ( const CSeq_align ,
const string = "",
const string = "" 
)
inlinevirtual

Write a raw Seq-align to the internal output stream.

This implementation will just generate an error and then exit. It should be re-implemented in format specific subclasses.

Parameters
alignthe Seq-align object to be written.
nameparameter describing the object. Handling will be format specific.
descrparameter describing the object. Handling will be format specific.

Reimplemented in CPslWriter, CAlnWriter, CGff2Writer, and CGff3Writer.

Definition at line 135 of file writer.hpp.

Referenced by CAnnotWriterApp::xProcessInputObject().

◆ WriteAnnot()

virtual bool CWriterBase::WriteAnnot ( const CSeq_annot ,
const string = "",
const string = "" 
)
inlinevirtual

Write a raw Seq-annot to the internal output stream.

This implementation will just generate an error and then exit. It should be re-implemented in format specific subclasses.

Parameters
annotthe Seq-annot object to be written.
nameparameter describing the object. Handling will be format specific
descrparameter describing the object. Handling will be format specific

Reimplemented in CPslWriter, CAlnWriter, CGff2Writer, CWiggleWriter, CVcfWriter, CBedWriter, and CBedGraphWriter.

Definition at line 116 of file writer.hpp.

Referenced by CPslWriter::WriteAnnot(), and CAnnotWriterApp::xProcessInputObject().

◆ WriteBioseqHandle()

virtual bool CWriterBase::WriteBioseqHandle ( CBioseq_Handle  ,
const string = "",
const string = "" 
)
inlinevirtual

Write a Bioseq handle to the internal output stream.

This implementation will just generate an error and then exit. It should be re-implemented in format specific subclasses.

Parameters
bshthe Bioseq handle to be written.
nameparameter describing the object. Handling will be format specific.
descrparameter describing the object. Handling will be format specific.

Reimplemented in CGff2Writer.

Definition at line 173 of file writer.hpp.

Referenced by CAnnotWriterApp::xProcessBioseqHandle().

◆ WriteFooter()

virtual bool CWriterBase::WriteFooter ( )
inlinevirtual

Write a file trailer.

Trailer syntax and rules depend on the file format. This do-nothing implementation should therefore be re-implemented in format specific subclasses.

Reimplemented in CWiggleWriter, and CGff2Writer.

Definition at line 221 of file writer.hpp.

Referenced by sRunTest(), sUpdateCase(), CAnnotWriterApp::xProcessBioseqHandle(), and CAnnotWriterApp::xProcessInputObject().

◆ WriteHeader() [1/2]

virtual bool CWriterBase::WriteHeader ( void  )
inlinevirtual

Write a file header.

Header syntax and rules depend on the file format. This do-nothing implementation should therefore be re-implemented in format specific subclasses.

Reimplemented in CGvfWriter, CGtfWriter, CGff2Writer, and CGff3Writer.

Definition at line 206 of file writer.hpp.

Referenced by sRunTest(), sUpdateCase(), WriteHeader(), CAnnotWriterApp::xProcessBioseqHandle(), and CAnnotWriterApp::xProcessInputObject().

◆ WriteHeader() [2/2]

virtual bool CWriterBase::WriteHeader ( const CSeq_annot )
inlinevirtual

Write a file header, using annotation information.

Header syntax and rules depend on the file format. This do-nothing implementation should therefore be re-implemented in format specific subclasses.

Reimplemented in CGtfWriter, CGff3Writer, CGvfWriter, and CGff2Writer.

Definition at line 213 of file writer.hpp.

References WriteHeader().

◆ WriteSeqAnnotHandle()

virtual bool CWriterBase::WriteSeqAnnotHandle ( CSeq_annot_Handle  ,
const string = "",
const string = "" 
)
inlinevirtual

Write a Seq-annot handle to the internal output stream.

This implementation will just generate an error and then exit. It should be re-implemented in format specific subclasses.

Parameters
sahthe Seq-annot handle to be written.
nameparameter describing the object. Handling will be format specific.
descrparameter describing the object. Handling will be format specific.

Reimplemented in CGff2Writer.

Definition at line 192 of file writer.hpp.

◆ WriteSeqEntryHandle()

virtual bool CWriterBase::WriteSeqEntryHandle ( CSeq_entry_Handle  ,
const string = "",
const string = "" 
)
inlinevirtual

Write a Seq-entry handle to the internal output stream.

This implementation will just generate an error and then exit. It should be re-implemented in format specific subclasses.

Parameters
sehthe Seq-entry handle to be written.
nameparameter describing the object. Handling will be format specific.
descrparameter describing the object. Handling will be format specific.

Reimplemented in CGff2Writer, and CBedWriter.

Definition at line 154 of file writer.hpp.

Referenced by sRunTest(), sUpdateCase(), and CAnnotWriterApp::xProcessInputObject().

Member Data Documentation

◆ m_Os

CNcbiOstream& CWriterBase::m_Os
protected

Definition at line 267 of file writer.hpp.

Referenced by CPslWriter::WriteAlign(), CUCSCRegionWriter::WriteAnnot(), CBedGraphWriter::WriteAnnot(), CBedWriter::WriteAnnot(), CAlnWriter::WriteContiguous(), CGff2Writer::WriteFooter(), CWiggleWriter::WriteFooter(), CGff3Writer::WriteHeader(), CGff2Writer::WriteHeader(), CGtfWriter::WriteHeader(), CGvfWriter::WriteHeader(), CBedWriter::WriteSeqEntryHandle(), CGff2Writer::x_WriteAssemblyInfo(), CVcfWriter::x_WriteFeature(), CVcfWriter::x_WriteFeatureAlt(), CVcfWriter::x_WriteFeatureChrom(), CVcfWriter::x_WriteFeatureFilter(), CVcfWriter::x_WriteFeatureGenotypeData(), CVcfWriter::x_WriteFeatureId(), CVcfWriter::x_WriteFeatureInfo(), CVcfWriter::x_WriteFeaturePos(), CVcfWriter::x_WriteFeatureQual(), CVcfWriter::x_WriteFeatureRef(), CVcfWriter::x_WriteHeader(), CVcfWriter::x_WriteMeta(), CVcfWriter::x_WriteMetaCreateNew(), CGff3Writer::xWriteAlignment(), CBedGraphWriter::xWriteAnnotSeqTable(), CWiggleWriter::xWriteDefaultTrackLine(), CBedWriter::xWriteFeaturesThreeFeatData(), CBedWriter::xWriteFeaturesTracked(), CGff3Writer::xWriteRecord(), CGvfWriter::xWriteRecord(), CGtfWriter::xWriteRecord(), CGff3Writer::xWriteSequenceHeader(), CBedGraphWriter::xWriteSingleFeature(), CBedGraphWriter::xWriteSingleGraphByte(), CWiggleWriter::xWriteSingleGraphFixedStep(), CBedGraphWriter::xWriteSingleGraphInt(), CBedGraphWriter::xWriteSingleGraphReal(), CWiggleWriter::xWriteSingleGraphRecordsByte(), CWiggleWriter::xWriteSingleGraphRecordsInt(), CWiggleWriter::xWriteSingleGraphRecordsReal(), CWiggleWriter::xWriteTableBedStyle(), CWiggleWriter::xWriteTableFixedStep(), CWiggleWriter::xWriteTableVariableStep(), and CWiggleWriter::xWriteTrackLine().

◆ m_Range

CRange<TSeqPos> CWriterBase::m_Range
protected

◆ m_Selector

unique_ptr<SAnnotSelector> CWriterBase::m_Selector
protected

Definition at line 269 of file writer.hpp.

Referenced by SetAnnotSelector(), and CVcfWriter::SetAnnotSelector().

◆ m_uFlags

unsigned int CWriterBase::m_uFlags
protected

◆ mpMessageListener

CWriterListener* CWriterBase::mpMessageListener
protected

Definition at line 271 of file writer.hpp.

Referenced by PutMessage(), SetMessageListener(), and CPslWriter::WriteAlign().


The documentation for this class was generated from the following file:
Modified on Sun Apr 14 05:28:44 2024 by modify_doxy.py rev. 669887