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

Search Toolkit Book for CSeqDB_FilterTree

Tree of nodes describing filtering of database sequences. More...

#include "seqdbfilter.hpp"
(Private to src/objtools/blast/seqdb_reader.)

+ Inheritance diagram for CSeqDB_FilterTree:
+ Collaboration diagram for CSeqDB_FilterTree:

Public Types

typedef vector< CRef< CSeqDB_AliasMask > > TFilters
 Type used to store lists of filters found here. 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

 CSeqDB_FilterTree ()
 Construct. More...
 
void SetName (string name)
 Set the node name. More...
 
void AddFilters (const TFilters &filters)
 Add filters to this node. More...
 
const TFiltersGetFilters () const
 Get filters from this node. More...
 
void AddNode (CRef< CSeqDB_FilterTree > node)
 Add a child node to this node. More...
 
void AddNodes (const vector< CRef< CSeqDB_FilterTree > > &nodes)
 Add several child nodes to this node. More...
 
const vector< CRef< CSeqDB_FilterTree > > & GetNodes () const
 Get child nodes attached to this node. More...
 
void AddVolume (const CSeqDB_BasePath &vol)
 Attach a volume to this node. More...
 
void AddVolumes (const vector< CSeqDB_BasePath > &vols)
 Attach several volumes to this node. More...
 
const vector< CSeqDB_BasePath > & GetVolumes () const
 Get volumes attached to this node. More...
 
void Print () const
 Print a formatted description of this tree. More...
 
CRef< CSeqDB_FilterTreeSpecialize (string volname) const
 Specialized this tree for the indicated volume. More...
 
bool HasFilter () const
 Check whether this tree represents any volume filtering. More...
 
- 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
 

Private Member Functions

void x_Print (int indent) const
 "Pretty-print" this tree in symbolic form. More...
 
 CSeqDB_FilterTree (CSeqDB_FilterTree &other)
 Prevent copy-construction of this object. More...
 
CSeqDB_FilterTreeoperator= (CSeqDB_FilterTree &other)
 Prevent assignment of this class. More...
 

Private Attributes

string m_Name
 The node name. More...
 
TFilters m_Filters
 List of sequence inclusion filters. More...
 
vector< CRef< CSeqDB_FilterTree > > m_SubNodes
 Other nodes included by this node. More...
 
vector< CSeqDB_BasePathm_Volumes
 Database volumes attached at this level. More...
 

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...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

Tree of nodes describing filtering of database sequences.

Definition at line 207 of file seqdbfilter.hpp.

Member Typedef Documentation

◆ TFilters

Type used to store lists of filters found here.

Definition at line 210 of file seqdbfilter.hpp.

Constructor & Destructor Documentation

◆ CSeqDB_FilterTree() [1/2]

CSeqDB_FilterTree::CSeqDB_FilterTree ( )
inline

Construct.

Definition at line 213 of file seqdbfilter.hpp.

◆ CSeqDB_FilterTree() [2/2]

CSeqDB_FilterTree::CSeqDB_FilterTree ( CSeqDB_FilterTree other)
private

Prevent copy-construction of this object.

Member Function Documentation

◆ AddFilters()

void CSeqDB_FilterTree::AddFilters ( const TFilters filters)
inline

Add filters to this node.

Parameters
filtersFilters to add here.

Definition at line 226 of file seqdbfilter.hpp.

References m_Filters.

Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().

◆ AddNode()

void CSeqDB_FilterTree::AddNode ( CRef< CSeqDB_FilterTree node)
inline

Add a child node to this node.

Parameters
nodeChild node to add here.

Definition at line 240 of file seqdbfilter.hpp.

References m_SubNodes.

Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().

◆ AddNodes()

void CSeqDB_FilterTree::AddNodes ( const vector< CRef< CSeqDB_FilterTree > > &  nodes)
inline

Add several child nodes to this node.

Parameters
nodeChild nodes to add here.

Definition at line 247 of file seqdbfilter.hpp.

References m_SubNodes.

Referenced by Specialize().

◆ AddVolume()

void CSeqDB_FilterTree::AddVolume ( const CSeqDB_BasePath vol)
inline

Attach a volume to this node.

Parameters
volPath to new volume.

Definition at line 261 of file seqdbfilter.hpp.

References m_Volumes.

Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().

◆ AddVolumes()

void CSeqDB_FilterTree::AddVolumes ( const vector< CSeqDB_BasePath > &  vols)
inline

Attach several volumes to this node.

Parameters
volsPaths to new volumes.

Definition at line 268 of file seqdbfilter.hpp.

References m_Volumes.

Referenced by Specialize().

◆ GetFilters()

const TFilters& CSeqDB_FilterTree::GetFilters ( void  ) const
inline

Get filters from this node.

Returns
Filters attached here.

Definition at line 233 of file seqdbfilter.hpp.

References m_Filters.

Referenced by Specialize(), and CSeqDBOIDList::x_ComputeFilters().

◆ GetNodes()

const vector< CRef<CSeqDB_FilterTree> >& CSeqDB_FilterTree::GetNodes ( void  ) const
inline

Get child nodes attached to this node.

Returns
Child nodes attached here.

Definition at line 254 of file seqdbfilter.hpp.

References m_SubNodes.

Referenced by Specialize(), CSeqDBOIDList::x_ComputeFilters(), and CSeqDBImpl::x_GetOidList().

◆ GetVolumes()

const vector<CSeqDB_BasePath>& CSeqDB_FilterTree::GetVolumes ( ) const
inline

Get volumes attached to this node.

Returns
Paths to attached volumes.

Definition at line 275 of file seqdbfilter.hpp.

References m_Volumes.

Referenced by Specialize(), and CSeqDBOIDList::x_ComputeFilters().

◆ HasFilter()

bool CSeqDB_FilterTree::HasFilter ( ) const

Check whether this tree represents any volume filtering.

Returns
True iff any volumes included here are filtered.

Definition at line 81 of file seqdbfilter.cpp.

References ITERATE, m_Filters, and m_SubNodes.

Referenced by CSeqDBOIDList::CSeqDBOIDList(), CSeqDBImpl::x_GetOidList(), and CSeqDBOIDList::x_Setup().

◆ operator=()

CSeqDB_FilterTree& CSeqDB_FilterTree::operator= ( CSeqDB_FilterTree other)
private

Prevent assignment of this class.

◆ Print()

void CSeqDB_FilterTree::Print ( void  ) const
inline

Print a formatted description of this tree.

This is very useful for maintainability, e.g. debugging and for analysis of system behavior. It prints an indented tree of filter tree nodes with volumes and mask information.

Definition at line 285 of file seqdbfilter.hpp.

References indent(), and x_Print().

◆ SetName()

void CSeqDB_FilterTree::SetName ( string  name)
inline

Set the node name.

Parameters
nameName of alias node generating this filter node.

Definition at line 219 of file seqdbfilter.hpp.

References m_Name.

Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().

◆ Specialize()

CRef< CSeqDB_FilterTree > CSeqDB_FilterTree::Specialize ( string  volname) const

Specialized this tree for the indicated volume.

This method returns a copy of this filter tree, specialized on the specified volume. Filter Tree specialization removes all volumes except the one matching the provided name, and cleans up any unnecessary or ineffective elements. This tree is not changed in place, but the new tree will share any subelements of this tree that did not need to change.

Because the OID list is constructed recursively from this tree structure, inefficiencies or redundancies here can result in unnecessary and possibly very expensive extra work. Thus, the goal here is to produce the simplest tree that can correctly represent all filtering for the given volume.

Parameters
volnameThe name of the volume to specialize on.
Returns
A specialized and simplified tree.

Definition at line 38 of file seqdbfilter.cpp.

References AddFilters(), AddNode(), AddNodes(), AddVolume(), AddVolumes(), GetFilters(), GetNodes(), GetVolumes(), ITERATE, m_Filters, m_Name, m_SubNodes, m_Volumes, CRef< C, Locker >::NotEmpty(), CRef< C, Locker >::Reset(), and SetName().

Referenced by CSeqDBOIDList::x_ComputeFilters().

◆ x_Print()

void CSeqDB_FilterTree::x_Print ( int  indent) const
inlineprivate

"Pretty-print" this tree in symbolic form.

Parameters
indentThe amount of spaces to indent each line.

Definition at line 317 of file seqdbfilter.hpp.

References first(), indent(), ITERATE, m_Filters, m_Name, m_SubNodes, and m_Volumes.

Referenced by Print().

Member Data Documentation

◆ m_Filters

TFilters CSeqDB_FilterTree::m_Filters
private

List of sequence inclusion filters.

Definition at line 361 of file seqdbfilter.hpp.

Referenced by AddFilters(), GetFilters(), HasFilter(), Specialize(), and x_Print().

◆ m_Name

string CSeqDB_FilterTree::m_Name
private

The node name.

Definition at line 358 of file seqdbfilter.hpp.

Referenced by SetName(), Specialize(), and x_Print().

◆ m_SubNodes

vector< CRef<CSeqDB_FilterTree> > CSeqDB_FilterTree::m_SubNodes
private

Other nodes included by this node.

Definition at line 364 of file seqdbfilter.hpp.

Referenced by AddNode(), AddNodes(), GetNodes(), HasFilter(), Specialize(), and x_Print().

◆ m_Volumes

vector<CSeqDB_BasePath> CSeqDB_FilterTree::m_Volumes
private

Database volumes attached at this level.

Definition at line 367 of file seqdbfilter.hpp.

Referenced by AddVolume(), AddVolumes(), GetVolumes(), Specialize(), and x_Print().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:58:28 2024 by modify_doxy.py rev. 669887