xflminterface IF_NodeInfo : public XF_RefCount
This class contains methods for getting detailed information on how disk is being used inside an XFLAIM database. Information may be retrieved at almost any level of granularity desired - individual node within a document, sub-trees with a document, entire documents, multiple documents, etc.
Method Summary |
|
void |
clearNodeInfo - Clear information gathered in the IF_NodeInfo object. |
RCODE |
addNodeInfo - Collect information about node or sub-tree and add it to the information already collected. |
FLMUINT64 |
getTotalNodeCount - Return total number of nodes for which information has been collected. |
void |
getNodeInfo - Return the node information that has been collected. |
Method Detail |
void clearNodeInfo( void)
This is a method clears all of the information that has been gathered in the object. This allows the object to be reused over and over for different information gathering needs.
Parameters In: none
Parameters Out: none
Example Code:
RCODE rc;
IF_NodeInfo * pNodeInfo = NULL;
IF_Db * pDb = NULL;
IF_DOMNode * pDoc = NULL;
XFLM_NODE_INFO nodeInfo;
FLMUINT64 ui64TotalNodes;
if (RC_BAD( rc = pDbSystem->createIFNodeInfo( &pNodeInfo)))
{
printf( "Error %08X calling createIFNodeInfo\n", (unsigned)rc);
goto Exit;
}
// Open a database we want to gather information on
if (RC_BAD( rc = pDbSystem->dbOpen( "dib.db", NULL, NULL, &pDb, NULL, FALSE)))
{
printf( "Error %08X calling dbOpen\n", (unsigned)rc);
goto Exit;
}
// Collect information on all documents in the default data collection
for (;;)
{
if (pDoc)
{
if (RC_BAD( rc = pDoc->getNextDocument( pDb, &pDoc)))
{
if (rc == NE_XFLM_DOM_NODE_NOT_FOUND)
{
rc = NE_XFLM_OK;
break;
}
printf( "Error %08X calling getNextDocument\n", (unsigned)rc);
goto Exit;
}
}
else
{
if (RC_BAD( rc = pDb->getFirstDocument( XFLM_DATA_COLLECTION, &pDoc)))
{
if (rc == NE_XFLM_DOM_NODE_NOT_FOUND)
{
rc = NE_XFLM_OK;
break;
}
printf( "Error %08X calling getFirstDocument\n", (unsigned)rc);
goto Exit;
}
}
// Add the information about this document to the node info object.
if (RC_BAD( rc = pNodeInfo->addNodeInfo( pDb, pDoc, TRUE, TRUE)))
{
printf( "Error %08X calling addNodeInfo\n", (unsigned)rc);
goto Exit;
}
}
// Print out the information gathered on data collection
ui64TotalNodes = pNodeInfo->getTotalNodeCount();
pNodeInfo->getNodeInfo( &nodeInfo);
// Print out the information from the nodeInfo structure
printf( ....);
.
.
.
// Clear the node information and gather information on the dictionary collection
pNodeInfo->clearNodeInfo();
for (;;)
{
// NOTE: Implement a for() loop like the one above, only use the XFLM_DICT_COLLECTION.
.
.
.
}
// Print out information gathered on dictionary collection
ui64TotalNodes = pNodeInfo->getTotalNodeCount();
pNodeInfo->getNodeInfo( &nodeInfo);
// Print out the information from the nodeInfo structure
printf( ....);
.
.
.
Exit:
if (pDoc)
{
pDoc->Release();
}
if (pNodeInfo)
{
pNodeInfo->Release();
}
if (pDb)
{
pDb->Release();
}
return( rc);
RCODE addNodeInfo(
IF_Db * pDb,
IF_DOMNode * pNode,
FLMBOOL bDoSubTree,
FLMBOOL bDoSelf = TRUE);
This method collects information about a node or sub-tree and adds it to the information already collected.
Parameters In:
IF_Db * pDb Database containing the node/sub-tree we are collecting information on. IF_DOMNode * pNode Node or sub-tree we are collection information on. FLMBOOL bDoSubTree If TRUE, this flag indicates that we are to collect information for the entire sub-tree pointed to by pNode. FLMBOOL bDoSelf If TRUE, this flag indicates that we are to collection information on the node pointed to by pNode. If FALSE, information on pNode will NOT be collected. This includes any attribute nodes connected to pNode. Setting this parameter to FALSE really only makes sense if then bDoSubTree is TRUE - it would allow an application to collect information on all of a node's sub-tree, except for itself.
Parameters Out: none
Example Code: see clearNodeInfo
FLMUINT64 getTotalNodeCount( void);
This method returns the total number of nodes for which information has been collected so far.
Parameters In: none
Parameters Out: none
Example Code: see clearNodeInfo
void getNodeInfo(
XFLM_NODE_INFO * pNodeInfo);
This is a method populates the passed in pNodeInfo structure with the information that has been collected so far.
Parameters In: none
Parameters Out:
XFLM_NODE_INFO * pNodeInfo Pointer to XFLM_NODE_INFO structure that is to be populated.
Example Code: see clearNodeInfo