gem5  v21.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Typedefs | Functions | Variables
serialize.hh File Reference
#include <algorithm>
#include <iostream>
#include <iterator>
#include <stack>
#include <set>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "base/inifile.hh"
#include "base/logging.hh"
#include "sim/serialize_handlers.hh"

Go to the source code of this file.

Classes

class  CheckpointIn
 
class  Serializable
 Basic support for object serialization. More...
 
class  Serializable::ScopedCheckpointSection
 

Macros

#define SERIALIZE_SCALAR(scalar)   paramOut(cp, #scalar, scalar)
 
#define UNSERIALIZE_SCALAR(scalar)   paramIn(cp, #scalar, scalar)
 
#define UNSERIALIZE_OPT_SCALAR(scalar)   optParamIn(cp, #scalar, scalar)
 
#define SERIALIZE_ENUM(scalar)   paramOut(cp, #scalar, (int)scalar)
 
#define UNSERIALIZE_ENUM(scalar)
 
#define SERIALIZE_ARRAY(member, size)   arrayParamOut(cp, #member, member, size)
 
#define UNSERIALIZE_ARRAY(member, size)   arrayParamIn(cp, #member, member, size)
 
#define SERIALIZE_CONTAINER(member)   arrayParamOut(cp, #member, member)
 
#define UNSERIALIZE_CONTAINER(member)   arrayParamIn(cp, #member, member)
 
#define SERIALIZE_EVENT(event)   event.serializeSection(cp, #event);
 
#define UNSERIALIZE_EVENT(event)
 
#define SERIALIZE_OBJ(obj)   obj.serializeSection(cp, #obj)
 
#define UNSERIALIZE_OBJ(obj)   obj.unserializeSection(cp, #obj)
 
#define SERIALIZE_OBJPTR(objptr)   paramOut(cp, #objptr, (objptr)->name())
 
#define UNSERIALIZE_OBJPTR(objptr)
 
#define SERIALIZE_MAPPING(member, names, size)   mappingParamOut(cp, #member, names, member, size)
 
#define UNSERIALIZE_MAPPING(member, names, size)   mappingParamIn(cp, #member, names, member, size)
 

Typedefs

typedef std::ostream CheckpointOut
 

Functions

template<class T >
void paramOut (CheckpointOut &os, const std::string &name, const T &param)
 This function is used for writing parameters to a checkpoint. More...
 
template<class T >
bool paramInImpl (CheckpointIn &cp, const std::string &name, T &param)
 
template<class T >
bool optParamIn (CheckpointIn &cp, const std::string &name, T &param, bool do_warn=true)
 This function is used for restoring optional parameters from the checkpoint. More...
 
template<class T >
void paramIn (CheckpointIn &cp, const std::string &name, T &param)
 This function is used for restoring parameters from a checkpoint. More...
 
template<class InputIterator >
void arrayParamOut (CheckpointOut &os, const std::string &name, InputIterator start, InputIterator end)
 
template<class T >
void arrayParamOut (CheckpointOut &os, const std::string &name, const T *param, unsigned size)
 
template<class T , class InsertIterator >
void arrayParamIn (CheckpointIn &cp, const std::string &name, InsertIterator inserter, ssize_t fixed_size=-1)
 Extract values stored in the checkpoint, and assign them to the provided array container. More...
 
template<class T >
decltype(std::declval< T >().insert(std::declval< typename T::value_type >()), void()) arrayParamIn (CheckpointIn &cp, const std::string &name, T &param)
 
template<class T >
decltype(std::declval< T >().push_back(std::declval< typename T::value_type >()), void()) arrayParamIn (CheckpointIn &cp, const std::string &name, T &param)
 
template<class T >
void arrayParamIn (CheckpointIn &cp, const std::string &name, T *param, unsigned size)
 
void debug_serialize (const std::string &cpt_dir)
 
void objParamIn (CheckpointIn &cp, const std::string &name, SimObject *&param)
 
template<class T >
void mappingParamOut (CheckpointOut &os, const char *sectionName, const char *const names[], const T *param, unsigned size)
 Serialize a mapping represented as two arrays: one containing names and the other containing values. More...
 
template<class T >
void mappingParamIn (CheckpointIn &cp, const char *sectionName, const char *const names[], T *param, unsigned size)
 Restore mappingParamOut. More...
 

Variables

template<class T >
decltype(std::begin(std::declval< const T & >()), std::end(std::declval< const T & >()), void()) arrayParamOut (CheckpointOut &os, const std::string &name, const T &param)
 

Macro Definition Documentation

◆ SERIALIZE_MAPPING

#define SERIALIZE_MAPPING (   member,
  names,
  size 
)    mappingParamOut(cp, #member, names, member, size)

Definition at line 707 of file serialize.hh.

◆ SERIALIZE_SCALAR

#define SERIALIZE_SCALAR (   scalar)    paramOut(cp, #scalar, scalar)

Definition at line 584 of file serialize.hh.

◆ UNSERIALIZE_MAPPING

#define UNSERIALIZE_MAPPING (   member,
  names,
  size 
)    mappingParamIn(cp, #member, names, member, size)

Definition at line 713 of file serialize.hh.

◆ UNSERIALIZE_SCALAR

#define UNSERIALIZE_SCALAR (   scalar)    paramIn(cp, #scalar, scalar)

Definition at line 591 of file serialize.hh.

Typedef Documentation

◆ CheckpointOut

typedef std::ostream CheckpointOut

Definition at line 64 of file serialize.hh.

Function Documentation

◆ arrayParamIn()

template<class T >
decltype(std::declval<T>().push_back(std::declval<typename T::value_type>()), void()) arrayParamIn ( CheckpointIn cp,
const std::string &  name,
T &  param 
)

Definition at line 489 of file serialize.hh.

References name().

◆ debug_serialize()

void debug_serialize ( const std::string &  cpt_dir)

Definition at line 357 of file serialize.cc.

References Serializable::serializeAll().

◆ mappingParamIn()

template<class T >
void mappingParamIn ( CheckpointIn cp,
const char *  sectionName,
const char *const  names[],
T *  param,
unsigned  size 
)

Restore mappingParamOut.

Keys missing from the checkpoint are ignored.

Definition at line 546 of file serialize.hh.

References Serializable::currentSection(), ArmISA::i, optParamIn(), and X86ISA::val.

◆ mappingParamOut()

template<class T >
void mappingParamOut ( CheckpointOut os,
const char *  sectionName,
const char *const  names[],
const T *  param,
unsigned  size 
)

Serialize a mapping represented as two arrays: one containing names and the other containing values.

Parameters
namesarray of keys
paramarray of values
sizesize of the names and param arrays

Definition at line 532 of file serialize.hh.

References ArmISA::i, X86ISA::os, and paramOut().

◆ paramInImpl()

template<class T >
bool paramInImpl ( CheckpointIn cp,
const std::string &  name,
T &  param 
)

Definition at line 342 of file serialize.hh.

References Serializable::currentSection(), and name().

Referenced by optParamIn(), and paramIn().


Generated on Tue Mar 23 2021 19:41:32 for gem5 by doxygen 1.8.17