/* rimage_ser.h * * Created by Ian Fasel on Mon Oct 1 2006. * * Copyright (c) 2006 Machine Perception Laboratory * University of California San Diego. * * Please read the disclaimer and notes about redistribution * at the end of this file. * */ #ifndef _FEATURE_DATA_SER_H_ #define _FEATURE_DATA_SER_H_ #include "mp_AUResults.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace serialization { // mp_AUResults template <> struct version< mp_AUResults > { BOOST_STATIC_CONSTANT(unsigned int, value = 1); }; template void save(Archive & ar, const mp_AUResults &results, unsigned int version) { std::string name( results.getName() ); std::vector auResults = results.getAUResults(); ar & make_nvp("name", name ); ar & make_nvp( "auResults", auResults ); for( unsigned int au = 0; au < auResults.size(); ++au ) { std::vector freq = results.frequenciesForAUIndex(au); ar & make_nvp( "freqencies", freq ); } } template void load(Archive & ar, mp_AUResults &results, unsigned int version) { std::string name; std::vector auResults; std::vector< std::vector > frequencies; ar & make_nvp( "name", name); ar & make_nvp( "auResults", auResults); frequencies.resize( auResults.size() ); for( unsigned int au = 0; au < auResults.size(); ++au ) { std::vector freq; ar & make_nvp( "freqencies", freq ); frequencies[au] = freq; } mp_AUResults temp( name, auResults, frequencies ); results = temp; } template inline void serialize( Archive & ar, mp_AUResults &results, const unsigned int file_version) { split_free(ar, results, file_version); } } // namespace serialization } // namespace boost //void saveFeatureData( const FeatureData &s, std::ofstream &os ); //void restoreFeatureData( FeatureData &s, std::ifstream &is ); //void saveBinaryFeatureData( const FeatureData &s, std::ofstream &os ); //void restoreBinaryFeatureData( FeatureData &s, std::ifstream &is ); //void saveXMLFeatureData( const FeatureData &s, std::ofstream &os ); //void restoreXMLFeatureData( FeatureData &s, std::ifstream &is ); //bool saveFeatureDataToFile( const FeatureData &s, const std::string &filename ); //bool restoreFeatureDataFromFile( FeatureData &s, const std::string &filename ); #endif /* * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */