torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Pruning.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_PRUNING_HPP
17 #define TORC_GENERIC_PRUNING_HPP
18 
20 #include <map>
21 
22 namespace torc {
23 namespace generic {
24 
25 /**
26  * @brief A map from cell shared pointer to usage count.
27  */
28 typedef std::map<CellSharedPtr, int> CellUsageMap;
29 
30 /**
31  * @brief Prune all unused cells and libraries from the given root.
32  * @param inRootPtr The root to prune.
33  */
34 void prune(RootSharedPtr& inRootPtr);
35 
36 /**
37  * @brief Recursively collect and count all cells used in the given view.
38  * @detail The CellUsageMap must already be initialized with all expected cell counts set to zero.
39  * @param inViewPtr The view to begin recursing from.
40  * @param inoutCellUsageMap A map from cell to usage count.
41  */
42 void collectCells(ViewSharedPtr& inViewPtr, CellUsageMap& inoutCellUsageMap);
43 
44 } //namespace generic
45 } //namespace torc
46 
47 #endif // TORC_GENERIC_PRUNING_HPP
void prune(RootSharedPtr &inRootPtr)
Prune all unused cells and libraries from the given root.
Definition: Pruning.cpp:58
void collectCells(ViewSharedPtr &inViewPtr, CellUsageMap &inoutCellUsageMap)
Recursively collect and count all cells used in the given view. The CellUsageMap must already be ini...
Definition: Pruning.cpp:36
boost::shared_ptr< View > ViewSharedPtr
std::map< CellSharedPtr, int > CellUsageMap
A map from cell shared pointer to usage count.
Definition: Pruning.hpp:28
boost::shared_ptr< Root > RootSharedPtr