libfoedus-core
FOEDUS Core Library
sequential_metadata.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
19 
20 #include <iostream>
21 #include <sstream>
22 #include <string>
23 
25 
26 namespace foedus {
27 namespace storage {
28 namespace sequential {
29 std::string SequentialMetadata::describe() const {
30  std::stringstream o;
31  o << SequentialMetadataSerializer(const_cast<SequentialMetadata*>(this));
32  return o.str();
33 }
34 std::ostream& operator<<(std::ostream& o, const SequentialMetadata& v) {
35  o << SequentialMetadataSerializer(const_cast<SequentialMetadata*>(&v));
36  return o;
37 }
38 
39 ErrorStack SequentialMetadataSerializer::load(tinyxml2::XMLElement* element) {
40  CHECK_ERROR(load_base(element));
41  CHECK_ERROR(get_element(element, "truncate_epoch_", &data_casted_->truncate_epoch_))
42  return kRetOk;
43 }
44 
45 ErrorStack SequentialMetadataSerializer::save(tinyxml2::XMLElement* element) const {
46  CHECK_ERROR(save_base(element));
47  CHECK_ERROR(add_element(element, "truncate_epoch_", "", data_casted_->truncate_epoch_));
48  return kRetOk;
49 }
50 
51 } // namespace sequential
52 } // namespace storage
53 } // namespace foedus
std::ostream & operator<<(std::ostream &o, const SequentialCursor &v)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
ErrorStack load_base(tinyxml2::XMLElement *element)
common routine for the implementation of load()
Definition: metadata.cpp:50
ErrorStack save(tinyxml2::XMLElement *element) const override
Writes the content of this object to the given XML element.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Epoch::EpochInteger truncate_epoch_
The min epoch value (truncate-epoch) for all valid records in this storage.
ErrorStack save_base(tinyxml2::XMLElement *element) const
common routine for the implementation of save()
Definition: metadata.cpp:66
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
static ErrorStack get_element(tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0)
Only declaration in header.
ErrorStack load(tinyxml2::XMLElement *element) override
Reads the content of this object from the given XML element.
static ErrorStack add_element(tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
Only declaration in header.