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

Search Toolkit Book for CVDBAliasNode

CVDBAliasNode class. More...

+ Inheritance diagram for CVDBAliasNode:
+ Collaboration diagram for CVDBAliasNode:

Public Member Functions

 CVDBAliasNode (const string &name_list, char prot_nucl, bool expand_link, bool verify_vdbs)
 Public Constructor. More...
 
void GetExpandedPaths (set< string > &vdbs, set< string > &db_alias, set< string > &vdb_alias)
 
void GetNodePaths (set< string > &vdbs, set< string > &db_alias, set< string > &vdb_alias)
 
vector< string > & GetNodeVDBs ()
 
vector< string > & GetNodeVDBList ()
 
vector< string > & GetNodeDBList ()
 
string GetBlastDBList ()
 
- 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 Types

typedef map< string, stringTVarList
 Type of set used for KEY/VALUE pairs within each node. More...
 
typedef vector< CRef< CVDBAliasNode > > TSubNodeList
 Type used to store the set of subnodes for this node. More...
 

Private Member Functions

 CVDBAliasNode (const string &node, char prot_nucl, bool expand_links, bool vdb_alias, bool verify_vdbs)
 Private Constructor. More...
 
void x_ReadValues (const string &fn)
 Read the alias file. More...
 
void x_ReadLine (const char *bp, const char *ep, string &name_s, string &value_s)
 Read one line of the alias file. More...
 
void x_ExpandAliases (char prot_nucl)
 Expand a node of the alias node tree recursively. More...
 
void x_ResolveDBList (vector< string > &dblist, char prot_nucl, vector< string > &vdb_list)
 Check for and resolve path for blast alias file(s) More...
 
void x_ResolveVDBList (const vector< string > &vdblist, char prot_nucl)
 Resolve path for vdbs and vdb alias file(s) More...
 
void x_AppendSubNode (const string &node, char prot_nucl, bool isVDB)
 Append a subnode to this alias node. More...
 
CVDBAliasNodeoperator= (const CVDBAliasNode &)
 Disable copy operator. More...
 
 CVDBAliasNode (const CVDBAliasNode &)
 Disable copy constructor. More...
 

Private Attributes

CSeqDB_Path m_ThisName
 Filename of this alias file. More...
 
CSeqDB_DirName m_DBPath
 The common prefix for the DB paths. More...
 
bool m_ExpandLinks
 Do not expand link when resolving paths. More...
 
TVarList m_Values
 List of KEY/VALUE pairs from this alias file. More...
 
vector< stringm_VDBNames
 Set of vdb names associated with this node. More...
 
TSubNodeList m_SubNodes
 List of subnodes contained by this node. More...
 
vector< stringm_VDBList
 Alias file from VDBLIST. More...
 
vector< stringm_DBList
 Alias Files from DBLIST. More...
 
string m_OrigBlastDBList
 
bool m_VerifyVDBs
 

Additional Inherited Members

- 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...
 
- 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

CVDBAliasNode class.

This is one node of the alias node tree, an n-ary tree which represents the relationships of the alias files and vdb used. The children of this node are the other alias files mentioned in this node's VDBLIST key. Each node may have vdbs which are the non-alias objects mentioned in the VDBLIST.

Definition at line 55 of file vdbalias.cpp.

Member Typedef Documentation

◆ TSubNodeList

typedef vector< CRef<CVDBAliasNode> > CVDBAliasNode::TSubNodeList
private

Type used to store the set of subnodes for this node.

Definition at line 220 of file vdbalias.cpp.

◆ TVarList

Type of set used for KEY/VALUE pairs within each node.

Definition at line 57 of file vdbalias.cpp.

Constructor & Destructor Documentation

◆ CVDBAliasNode() [1/3]

CVDBAliasNode::CVDBAliasNode ( const string name_list,
char  prot_nucl,
bool  expand_link,
bool  verify_vdbs 
)

Public Constructor.

This is the user-visible constructor, which builds the top level node in the dbalias node tree. This design effectively treats the user-input database list as if it were an alias file containing only the VDBLIST specification.

Parameters
name_listThe space delimited list of database names.
prot_nuclThe type of sequences stored here.

Definition at line 289 of file vdbalias.cpp.

References NStr::Join(), m_DBList, m_OrigBlastDBList, m_Values, m_VDBList, m_VDBNames, NCBI_THROW, s_Join(), s_Tokenize(), x_ExpandAliases(), x_ResolveDBList(), and x_ResolveVDBList().

Referenced by x_AppendSubNode().

◆ CVDBAliasNode() [2/3]

CVDBAliasNode::CVDBAliasNode ( const string node,
char  prot_nucl,
bool  expand_links,
bool  vdb_alias,
bool  verify_vdbs 
)
private

Private Constructor.

This constructor is used to build the alias nodes other than the topmost node. It is private, because such nodes are only constructed via internal mechanisms of this class. One potential issue for alias node hierarchies is that it is easy to (accidentally) construct mutually recursive alias configurations. To prevent an infinite recursion in this case, this constructor takes a set of strings, which indicate all the nodes that have already been constructed. It is passed by value (copied) because the same node can be used, legally and safely, in more than one branch of the same alias node tree. If the node to build is already in this set, the constructor will throw an exception. As a special case, if a name in a DBLIST line is the same as the node it is in, it is assumed to be a volume name (even though an alias file exists with that name), so this will not trigger the cycle detection exception.

Parameters
dbpathThe working directory for relative paths in this node
dbnameThe name of this node
prot_nuclIndicates whether protein or nucletide sequences will be used
expand_linkexpand link if true @para, vdb_alias true if node is vdb alias

Definition at line 560 of file vdbalias.cpp.

References _TRACE, CSeqDB_Path::GetPathS(), NStr::Join(), m_ThisName, m_Values, NCBI_THROW, s_Tokenize(), x_ExpandAliases(), x_ReadValues(), x_ResolveDBList(), and x_ResolveVDBList().

◆ CVDBAliasNode() [3/3]

CVDBAliasNode::CVDBAliasNode ( const CVDBAliasNode )
private

Disable copy constructor.

Member Function Documentation

◆ GetBlastDBList()

string CVDBAliasNode::GetBlastDBList ( )
inline

Definition at line 90 of file vdbalias.cpp.

References m_OrigBlastDBList.

Referenced by CVDBAliasUtil::ProcessMixedDBsList().

◆ GetExpandedPaths()

void CVDBAliasNode::GetExpandedPaths ( set< string > &  vdbs,
set< string > &  db_alias,
set< string > &  vdb_alias 
)

◆ GetNodeDBList()

vector<string>& CVDBAliasNode::GetNodeDBList ( )
inline

Definition at line 87 of file vdbalias.cpp.

References m_DBList.

◆ GetNodePaths()

void CVDBAliasNode::GetNodePaths ( set< string > &  vdbs,
set< string > &  db_alias,
set< string > &  vdb_alias 
)

◆ GetNodeVDBList()

vector<string>& CVDBAliasNode::GetNodeVDBList ( )
inline

Definition at line 86 of file vdbalias.cpp.

References m_VDBList.

◆ GetNodeVDBs()

vector<string>& CVDBAliasNode::GetNodeVDBs ( )
inline

Definition at line 85 of file vdbalias.cpp.

References m_VDBNames.

◆ operator=()

CVDBAliasNode& CVDBAliasNode::operator= ( const CVDBAliasNode )
private

Disable copy operator.

◆ x_AppendSubNode()

void CVDBAliasNode::x_AppendSubNode ( const string node,
char  prot_nucl,
bool  isVDB 
)
private

Append a subnode to this alias node.

This method appends a new subnode to this node of the alias node tree. It is called by the x_ExpandAliases method.

Parameters
node_pathThe base path of the new node's volume.
prot_nuclIndicates whether this is a protein or nucleotide database.

Definition at line 427 of file vdbalias.cpp.

References CVDBAliasNode(), m_ExpandLinks, m_SubNodes, and m_VerifyVDBs.

Referenced by x_ExpandAliases().

◆ x_ExpandAliases()

void CVDBAliasNode::x_ExpandAliases ( char  prot_nucl)
private

Expand a node of the alias node tree recursively.

This method expands a node of the alias node tree, recursively building the tree from the specified node downward. (This method and the private version of the constructor are mutually recursive.) The cyclic tree check is done, and paths of these components are resolved. The alias file is parsed, and for each member of the DBLIST set, a subnode is constructed or a volume name is stored (if the element is the same as this node's name).

Parameters
prot_nuclIndicates whether this is a protein or nucleotide database.

Definition at line 416 of file vdbalias.cpp.

References i, m_DBList, m_VDBList, and x_AppendSubNode().

Referenced by CVDBAliasNode().

◆ x_ReadLine()

void CVDBAliasNode::x_ReadLine ( const char *  bp,
const char *  ep,
string name_s,
string value_s 
)
private

Read one line of the alias file.

This method parses the specified character string, storing the results in the KEY/VALUE map in this node. The input string is specified as a begin/end pair of pointers. If the string starts with "#", the function has no effect. Otherwise, if there are tabs in the input string, they are silently converted to spaces, and the part of the string before the first space after the first nonspace is considered to be the key. The rest of the line (with initial and trailing spaces removed) is taken as the value.

Parameters
bpA pointer to the first character of the line
epA pointer to (one past) the last character of the line
name_sThe variable name from the file
value_sThe value from the file

Definition at line 495 of file vdbalias.cpp.

References m_Values, s_SeqDB_ReadLine(), map_checker< Container >::swap(), and rapidjson::value.

Referenced by x_ReadValues().

◆ x_ReadValues()

void CVDBAliasNode::x_ReadValues ( const string fn)
private

Read the alias file.

This function read the alias file from the atlas, parsing the lines and storing the KEY/VALUE pairs in this node. It ignores KEY values that are not supported in SeqDB, although currently SeqDB should support all of the defined KEYs.

Parameters
fnThe name of the alias file

Definition at line 510 of file vdbalias.cpp.

References file, CMemoryFile::GetSize(), CMemoryFile::Map(), NCBI_THROW, NULL, SEQDB_ISEOL, and x_ReadLine().

Referenced by CVDBAliasNode().

◆ x_ResolveDBList()

void CVDBAliasNode::x_ResolveDBList ( vector< string > &  dblist,
char  prot_nucl,
vector< string > &  vdb_list 
)
private

Check for and resolve path for blast alias file(s)

This fucntion checks and finds the path for blast alias file

Parameters
dblistInput db list (can be a mixed of blast dbs, blast alias files, vdbs or vdb alias @ prot_nucl Indicates whether this is a protein or nucleotide database. @ non_blast_alias_list If not NULL, funtion will retrun non blast alias files in the input db list

Definition at line 313 of file vdbalias.cpp.

References _TRACE, CSeqDB_Path::GetPathS(), i, kEmptyStr, m_DBList, m_DBPath, SeqDB_ResolveDbPath(), and SeqDB_ResolveDbPathNoExtension().

Referenced by CVDBAliasNode().

◆ x_ResolveVDBList()

void CVDBAliasNode::x_ResolveVDBList ( const vector< string > &  vdblist,
char  prot_nucl 
)
private

Resolve path for vdbs and vdb alias file(s)

This fucntion resolves path for vdbs and vdb alias files An exception is thrown if not everthing in the input list can be resolved.

Parameters
vdblistInput vdb list (vdbs or vdb alias files only) @ prot_nucl Indicates whether this is a protein or nucleotide database.

Definition at line 356 of file vdbalias.cpp.

References _TRACE, CVDBBlastUtil::CheckVDBs(), CDirEntry::DereferenceLink(), CFile::Exists(), file, CSeqDB_DirName::GetDirNameSub(), CDirEntry::GetPath(), CSeqDB_Path::GetPathS(), CDirEntry::GetPathSeparator(), i, kEmptyStr, local, m_DBPath, m_ExpandLinks, m_VDBList, m_VDBNames, m_VerifyVDBs, NULL, SeqDB_CombinePath(), and SeqDB_ResolveDbPath().

Referenced by CVDBAliasNode().

Member Data Documentation

◆ m_DBList

vector<string> CVDBAliasNode::m_DBList
private

Alias Files from DBLIST.

Definition at line 243 of file vdbalias.cpp.

Referenced by CVDBAliasNode(), GetExpandedPaths(), GetNodeDBList(), x_ExpandAliases(), and x_ResolveDBList().

◆ m_DBPath

CSeqDB_DirName CVDBAliasNode::m_DBPath
private

The common prefix for the DB paths.

Definition at line 226 of file vdbalias.cpp.

Referenced by x_ResolveDBList(), and x_ResolveVDBList().

◆ m_ExpandLinks

bool CVDBAliasNode::m_ExpandLinks
private

Do not expand link when resolving paths.

Definition at line 229 of file vdbalias.cpp.

Referenced by x_AppendSubNode(), and x_ResolveVDBList().

◆ m_OrigBlastDBList

string CVDBAliasNode::m_OrigBlastDBList
private

Definition at line 244 of file vdbalias.cpp.

Referenced by CVDBAliasNode(), and GetBlastDBList().

◆ m_SubNodes

TSubNodeList CVDBAliasNode::m_SubNodes
private

List of subnodes contained by this node.

Definition at line 238 of file vdbalias.cpp.

Referenced by GetExpandedPaths(), GetNodePaths(), and x_AppendSubNode().

◆ m_ThisName

CSeqDB_Path CVDBAliasNode::m_ThisName
private

Filename of this alias file.

Definition at line 223 of file vdbalias.cpp.

Referenced by CVDBAliasNode().

◆ m_Values

TVarList CVDBAliasNode::m_Values
private

List of KEY/VALUE pairs from this alias file.

Definition at line 232 of file vdbalias.cpp.

Referenced by CVDBAliasNode(), and x_ReadLine().

◆ m_VDBList

vector<string> CVDBAliasNode::m_VDBList
private

Alias file from VDBLIST.

Definition at line 241 of file vdbalias.cpp.

Referenced by CVDBAliasNode(), GetExpandedPaths(), GetNodeVDBList(), x_ExpandAliases(), and x_ResolveVDBList().

◆ m_VDBNames

vector<string> CVDBAliasNode::m_VDBNames
private

Set of vdb names associated with this node.

Definition at line 235 of file vdbalias.cpp.

Referenced by CVDBAliasNode(), GetExpandedPaths(), GetNodePaths(), GetNodeVDBs(), and x_ResolveVDBList().

◆ m_VerifyVDBs

bool CVDBAliasNode::m_VerifyVDBs
private

Definition at line 245 of file vdbalias.cpp.

Referenced by x_AppendSubNode(), and x_ResolveVDBList().


The documentation for this class was generated from the following file:
Modified on Mon May 20 04:59:06 2024 by modify_doxy.py rev. 669887