Changeset 496
- Timestamp:
- 07/20/10 15:05:38 (19 months ago)
- File:
-
- 1 edited
-
trunk/avango-utils/python/_utils.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/avango-utils/python/_utils.cpp
r450 r496 23 23 24 24 #include <boost/python.hpp> 25 25 26 #include <avango/Link.h> 27 #include <avango/ContainerPool.h> 26 28 27 29 #include <osg/Matrix> … … 33 35 #include "../include/avango/utils/Bool3And.h" 34 36 #include "../include/avango/utils/Trackball.h" 37 38 #include <iostream> 39 #include <map> 35 40 36 41 using namespace boost::python; … … 46 51 }; 47 52 } 53 } 54 55 template < typename T, typename U > 56 std::map< U, T > converseMap( const std::map< T, U >& o ) 57 { 58 std::map< U, T > result; 59 for ( typename std::map< T, U >::const_iterator begin( o.begin() ); begin != o.end(); ++begin ) 60 result.insert( make_pair( begin->second, begin->first ) ); 61 return result; 48 62 } 49 63 … … 74 88 } 75 89 90 void print_actual_registered_field_containers() 91 { 92 const std::map< av::FieldContainer::IDType, av::FieldContainer* > & containers = av::ContainerPool::getContainerPool(); 93 std::map< av::FieldContainer::IDType, av::FieldContainer* >::const_iterator iter; 94 std::map< std::string,int> m; 95 for(iter=containers.begin();iter!=containers.end();++iter) 96 { 97 std::string type = ::av::ContainerPool::getNameByInstance(iter->second); 98 std::map< std::string,int >::const_iterator find_iter = m.find(type); 99 if(find_iter==m.end()) 100 { 101 m[type] = 1; 102 } 103 else 104 { 105 m[type]++; 106 } 107 } 108 std::cout << "###########################################" << std::endl; 109 std::cout <<"<FieldContainer Name> | Number of containers"<< std::endl; 110 std::map< int, std::string > conversedMap = converseMap( m ); 111 std::map< int, std::string >::reverse_iterator i; 112 for(i=conversedMap.rbegin();i!=conversedMap.rend();++i) 113 { 114 std::cout <<"<"<< i->second << "> | " << i->first << std::endl; 115 } 116 std::cout << "Total number of containers: " << av::ContainerPool::getNumberOfContainers() << std::endl; 117 } 118 76 119 BOOST_PYTHON_MODULE(_utils) 77 120 { … … 86 129 87 130 def("calc_hpr", CalcHpr); 131 132 def("print_registered_field_containers",print_actual_registered_field_containers); 88 133 }
Note: See TracChangeset
for help on using the changeset viewer.
