NCBI C++ ToolKit
|
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
.)
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< Uint8 > | TCounter |
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 TFilters & | GetFilters () 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_FilterTree > | Specialize (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... | |
CObject & | operator= (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_FilterTree & | operator= (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_BasePath > | m_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... | |
Tree of nodes describing filtering of database sequences.
Definition at line 207 of file seqdbfilter.hpp.
typedef vector< CRef<CSeqDB_AliasMask> > CSeqDB_FilterTree::TFilters |
Type used to store lists of filters found here.
Definition at line 210 of file seqdbfilter.hpp.
|
inline |
Construct.
Definition at line 213 of file seqdbfilter.hpp.
|
private |
Prevent copy-construction of this object.
Add filters to this node.
filters | Filters to add here. |
Definition at line 226 of file seqdbfilter.hpp.
References m_Filters.
Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().
|
inline |
Add a child node to this node.
node | Child node to add here. |
Definition at line 240 of file seqdbfilter.hpp.
References m_SubNodes.
Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().
|
inline |
Add several child nodes to this node.
node | Child nodes to add here. |
Definition at line 247 of file seqdbfilter.hpp.
References m_SubNodes.
Referenced by Specialize().
|
inline |
Attach a volume to this node.
vol | Path to new volume. |
Definition at line 261 of file seqdbfilter.hpp.
References m_Volumes.
Referenced by CSeqDBAliasNode::BuildFilterTree(), and Specialize().
|
inline |
Attach several volumes to this node.
vols | Paths to new volumes. |
Definition at line 268 of file seqdbfilter.hpp.
References m_Volumes.
Referenced by Specialize().
Get filters from this node.
Definition at line 233 of file seqdbfilter.hpp.
References m_Filters.
Referenced by Specialize(), and CSeqDBOIDList::x_ComputeFilters().
|
inline |
Get child nodes attached to this node.
Definition at line 254 of file seqdbfilter.hpp.
References m_SubNodes.
Referenced by Specialize(), CSeqDBOIDList::x_ComputeFilters(), and CSeqDBImpl::x_GetOidList().
|
inline |
Get volumes attached to this node.
Definition at line 275 of file seqdbfilter.hpp.
References m_Volumes.
Referenced by Specialize(), and CSeqDBOIDList::x_ComputeFilters().
bool CSeqDB_FilterTree::HasFilter | ( | ) | const |
Check whether this tree represents any volume filtering.
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().
|
private |
Prevent assignment of this class.
|
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.
|
inline |
Set the node name.
name | Name of alias node generating this filter node. |
Definition at line 219 of file seqdbfilter.hpp.
References m_Name.
Referenced by CSeqDBAliasNode::BuildFilterTree(), and 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.
volname | The name of the volume to specialize on. |
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().
|
inlineprivate |
"Pretty-print" this tree in symbolic form.
indent | The 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().
|
private |
List of sequence inclusion filters.
Definition at line 361 of file seqdbfilter.hpp.
Referenced by AddFilters(), GetFilters(), HasFilter(), Specialize(), and x_Print().
|
private |
The node name.
Definition at line 358 of file seqdbfilter.hpp.
Referenced by SetName(), Specialize(), and x_Print().
|
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().
|
private |
Database volumes attached at this level.
Definition at line 367 of file seqdbfilter.hpp.
Referenced by AddVolume(), AddVolumes(), GetVolumes(), Specialize(), and x_Print().