libfoedus-core
FOEDUS Core Library
foedus::storage::hash::HashMetadataSerializer Struct Referencefinal

Detailed Description

Definition at line 83 of file hash_metadata.hpp.

#include <hash_metadata.hpp>

Inheritance diagram for foedus::storage::hash::HashMetadataSerializer:
Collaboration diagram for foedus::storage::hash::HashMetadataSerializer:

Public Member Functions

 HashMetadataSerializer ()
 
 HashMetadataSerializer (HashMetadata *data)
 
ErrorStack load (tinyxml2::XMLElement *element) override
 Reads the content of this object from the given XML element. More...
 
ErrorStack save (tinyxml2::XMLElement *element) const override
 Writes the content of this object to the given XML element. More...
 
const char * get_tag_name () const override
 Returns an XML tag name for this object as a root element. More...
 
void assign (const foedus::externalize::Externalizable *other) override
 Polymorphic assign operator. More...
 
- Public Member Functions inherited from foedus::storage::MetadataSerializer
 MetadataSerializer ()
 
 MetadataSerializer (Metadata *data)
 
virtual ~MetadataSerializer ()
 
ErrorStack load_base (tinyxml2::XMLElement *element)
 common routine for the implementation of load() More...
 
ErrorStack save_base (tinyxml2::XMLElement *element) const
 common routine for the implementation of save() More...
 
- Public Member Functions inherited from foedus::externalize::Externalizable
ErrorStack load_from_string (const std::string &xml)
 Load the content of this object from the given XML string. More...
 
void save_to_stream (std::ostream *ptr) const
 Invokes save() and directs the resulting XML text to the given stream. More...
 
ErrorStack load_from_file (const fs::Path &path)
 Load the content of this object from the specified XML file. More...
 
ErrorStack save_to_file (const fs::Path &path) const
 Atomically and durably writes out this object to the specified XML file. More...
 

Public Attributes

HashMetadatadata_casted_
 
- Public Attributes inherited from foedus::storage::MetadataSerializer
Metadatadata_
 

Friends

std::ostream & operator<< (std::ostream &o, const HashMetadataSerializer &v)
 

Additional Inherited Members

- Static Public Member Functions inherited from foedus::storage::MetadataSerializer
static ErrorStack load_all_storages_from_xml (storage::StorageId largest_storage_id, tinyxml2::XMLElement *element, StorageControlBlock *blocks)
 
static ErrorStack save_all_storages_to_xml (storage::StorageId largest_storage_id, tinyxml2::XMLElement *element, StorageControlBlock *blocks)
 
- Static Public Member Functions inherited from foedus::externalize::Externalizable
static ErrorStack insert_comment (tinyxml2::XMLElement *element, const std::string &comment)
 
static ErrorStack append_comment (tinyxml2::XMLElement *parent, const std::string &comment)
 
static ErrorStack create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
 Only declaration in header. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value)
 
template<typename T >
static ErrorStack add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value)
 vector version More...
 
template<typename ENUM >
static ErrorStack add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value)
 enum version More...
 
static ErrorStack add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child)
 child Externalizable version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0)
 Only declaration in header. More...
 
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="")
 string type is bit special. More...
 
template<uint MAXLEN, typename CHAR >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >())
 
template<typename ENUM >
static ErrorStack get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0))
 enum version More...
 
template<typename T >
static ErrorStack get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false)
 vector version. More...
 
static ErrorStack get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false)
 child Externalizable version More...
 

Constructor & Destructor Documentation

foedus::storage::hash::HashMetadataSerializer::HashMetadataSerializer ( )
inline

Definition at line 84 of file hash_metadata.hpp.

foedus::storage::hash::HashMetadataSerializer::HashMetadataSerializer ( HashMetadata data)
inlineexplicit

Member Function Documentation

void foedus::storage::hash::HashMetadataSerializer::assign ( const foedus::externalize::Externalizable other)
inlineoverridevirtual

Polymorphic assign operator.

This should invoke operator= of the derived class.

Parameters
[in]otherassigned value. It must be dynamic-castable to the assignee class.

Implements foedus::externalize::Externalizable.

Definition at line 87 of file hash_metadata.hpp.

const char* foedus::storage::hash::HashMetadataSerializer::get_tag_name ( ) const
inlineoverridevirtual

Returns an XML tag name for this object as a root element.

We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.

Implements foedus::externalize::Externalizable.

Definition at line 87 of file hash_metadata.hpp.

ErrorStack foedus::storage::hash::HashMetadataSerializer::load ( tinyxml2::XMLElement *  element)
overridevirtual

Reads the content of this object from the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect errors due to missing-elements, out-of-range values, etc.

Implements foedus::externalize::Externalizable.

Definition at line 39 of file hash_metadata.cpp.

References foedus::storage::hash::HashMetadata::bin_bits_, CHECK_ERROR, data_casted_, foedus::externalize::Externalizable::get_element(), foedus::kRetOk, and foedus::storage::MetadataSerializer::load_base().

Referenced by foedus::storage::load_from_xml_hash().

39  {
40  CHECK_ERROR(load_base(element));
41  CHECK_ERROR(get_element(element, "bin_bits_", &data_casted_->bin_bits_))
42  return kRetOk;
43 }
ErrorStack load_base(tinyxml2::XMLElement *element)
common routine for the implementation of load()
Definition: metadata.cpp:50
uint8_t bin_bits_
Number of bins in exponent of two.
#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.

Here is the call graph for this function:

Here is the caller graph for this function:

ErrorStack foedus::storage::hash::HashMetadataSerializer::save ( tinyxml2::XMLElement *  element) const
overridevirtual

Writes the content of this object to the given XML element.

Parameters
[in]elementthe XML element that represents this object

Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.

Implements foedus::externalize::Externalizable.

Definition at line 45 of file hash_metadata.cpp.

References foedus::externalize::Externalizable::add_element(), foedus::storage::hash::HashMetadata::bin_bits_, CHECK_ERROR, data_casted_, foedus::kRetOk, and foedus::storage::MetadataSerializer::save_base().

45  {
46  CHECK_ERROR(save_base(element));
47  CHECK_ERROR(add_element(element, "bin_bits_", "", data_casted_->bin_bits_));
48  return kRetOk;
49 }
uint8_t bin_bits_
Number of bins in exponent of two.
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 add_element(tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value)
Only declaration in header.

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const HashMetadataSerializer v 
)
friend

Definition at line 87 of file hash_metadata.hpp.

Member Data Documentation

HashMetadata* foedus::storage::hash::HashMetadataSerializer::data_casted_

Definition at line 87 of file hash_metadata.hpp.

Referenced by load(), and save().


The documentation for this struct was generated from the following files: