예제 #1
0
                    static bool can_load(hdf5::archive & ar) { // TODO: make archive const
                        using alps::hdf5::get_extent;

                        ar.set_context("weight/value");
                        bool is = weight_type::can_load(ar);
                        ar.set_context("../..");

                        return is && B::can_load(ar);
                    }
예제 #2
0
 void load(hdf5::archive & ar) {
     std::vector<std::string> list = ar.list_children("");
     for (std::vector<std::string>::const_iterator it = list.begin(); it != list.end(); ++it) {
         ar.set_context(*it);
         for (typename std::vector<boost::shared_ptr<detail::serializable_type<T> > >::const_iterator jt = m_types.begin()
             ; jt != m_types.end()
             ; ++jt
         )
             if ((*jt)->can_load(ar)) {
                 operator[](*it) = boost::shared_ptr<T>((*jt)->create(ar));
                 break;
             }
         if (!has(*it))
             throw std::logic_error("The Accumulator/Result " + *it + " cannot be unserilized" + ALPS_STACKTRACE);
         operator[](*it).load(ar);
         ar.set_context("..");
     }
 }