/* * RegistrySerializer_impl.hpp * * Created on: Feb 27, 2016 * Author: heber */ #ifndef REGISTRYDESERIALIZER_IMPL_HPP_ #define REGISTRYDESERIALIZER_IMPL_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "RegistryDeserializer.hpp" #include #include #include #include "CodePatterns/Log.hpp" template void RegistryDeserializer::operator()() { std::string linestring; while (serialized.good()) { getline(serialized, linestring); const std::string whitespace(" \t"); const size_t strBegin = linestring.find_first_not_of(whitespace); const size_t colonpos = linestring.find(":"); if ((strBegin != std::string::npos) && (colonpos != std::string::npos)) { // get potential's token const std::string token = linestring.substr(strBegin, colonpos); std::stringstream itemstream(linestring); // instantiate type T * const item = factory.createInstance( token, itemstream); // and register registry.registerInstance(item); } else { ELOG(2, "Line '" << linestring << "' contains no " << name << "."); } } } #endif /* REGISTRYDESERIALIZER_IMPL_HPP_ */