PropertyMap.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   PropertyMap.cpp
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @date   Fall 2008
00005    
00006    @brief
00007       Bare-bones map used throughout Milton for holding custom initialization 
00008    parameters/options/information
00009    <!-------------------------------------------------------------------->**/
00010 
00011 #include "PropertyMap.h"
00012 #include <typeinfo>
00013 
00014 using namespace std;
00015 
00016 void PropertyMap::clear() {
00017    // TODO: ensure no memory leak here
00018    m_propertyMap.clear();
00019 }
00020 
00021 std::ostream &operator<<(std::ostream &os, const PropertyMap &m) {
00022    os << "{ " << endl;
00023    
00024    FOREACH(PropertyMap::STLPropertyMapConstIter, m.m_propertyMap, iter) {
00025       os << "  " << iter->first;
00026       
00027       if (iter->second.type() == typeid(std::string))
00028          os << " = " << boost::any_cast<std::string>(iter->second);
00029       else if (iter->second.type() == typeid(unsigned))
00030          os << " = " << boost::any_cast<unsigned>(iter->second);
00031       else if (iter->second.type() == typeid(int))
00032          os << " = " << boost::any_cast<int>(iter->second);
00033       else if (iter->second.type() == typeid(double))
00034          os << " = " << boost::any_cast<double>(iter->second);
00035       else if (iter->second.type() == typeid(float))
00036          os << " = " << boost::any_cast<float>(iter->second);
00037       else if (iter->second.type() == typeid(char))
00038          os << " = " << boost::any_cast<char>(iter->second);
00039       else 
00040          os << " = ?";
00041       
00042       os << endl;
00043    }
00044    
00045    os << "}";
00046    return os;
00047 }
00048 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6