src/dependency_finder.cpp
/*!
 * \brief Add an item which should have its dependencies tracked.
 * \pre The item is not already being tracked.
 * \param aItem Name of the item to track.
 * \return An iterator to the location of the new item.
 */
\brief Add an item which should have its dependencies tracked.
\pre The item is not already being tracked.
\param aItem Name of the item to track.
\return An iterator to the location of the new item.
\ brief Add an item which should have its dependencies tracked . \ pre The item is not already being tracked . \ param aItem Name of the item to track . \ return An iterator to the location of the new item .
DependencyFinder::ObjectIndexMap::iterator DependencyFinder::addTrackedItem( const string& aItem ){
    const size_t newLocation = mDependencyMatrix.size();
    pair<ObjectIndexMap::iterator, bool> newPositionPair = mObjectIndices.insert( make_pair( aItem, newLocation ) );
    H_ASSERT( newPositionPair.second, "addTrackedItem failure" );
    for( unsigned int row = 0; row < mDependencyMatrix.size(); ++row ){
        mDependencyMatrix[ row ].push_back( false );
    }
    mDependencyMatrix.push_back( vector<bool>( newLocation + 1, false ) );
    return newPositionPair.first;
}
DependencyFinder :: ObjectIndexMap :: iterator DependencyFinder :: addTrackedItem ( const string & aItem ) { const size_t newLocation = mDependencyMatrix . size ( ) ; pair < ObjectIndexMap :: iterator , bool > newPositionPair = mObjectIndices . insert ( make_pair ( aItem , newLocation ) ) ; H_ASSERT ( newPositionPair . second , " " ) ; for ( unsigned int row = 0 ; row < mDependencyMatrix . size ( ) ; ++ row ) { mDependencyMatrix [ row ] . push_back ( false ) ; } mDependencyMatrix . push_back ( vector < bool > ( newLocation + 1 , false ) ) ; return newPositionPair . first ; }
\brief Add an item which should have its dependencies tracked.
\ brief Add an item which should have its dependencies tracked .
// Add the item to the mapping of item name to index within the matrix. // Make pair creates a name value pair to insert into the matrix. // Check the precondition that the item does not already exist. // Now add the item to the dependency matrix. Loop through the matrix and // add a new position on the end of each row. // Add a new row to the matrix for the item. Default to not having any // dependencies. // Return an iterator to the position within the index map.