12#ifndef SST_CORE_SERIALIZATION_IMPL_MAPPER_H
13#define SST_CORE_SERIALIZATION_IMPL_MAPPER_H
15#ifndef SST_INCLUDING_SERIALIZER_H
17 "The header file sst/core/serialization/impl/mapper.h should not be directly included as it is not part of the stable public API. The file is included in sst/core/serialization/serializer.h"
20#include "sst/core/serialization/objectMap.h"
25#include <unordered_map>
27namespace SST::Core::Serialization::pvt {
31 std::unordered_map<uintptr_t, uintptr_t> pointer_map_;
32 std::deque<ObjectMap*> obj_;
39 ObjectMap* get_top()
const {
return obj_.back(); }
41 void map_object(
const std::string& name,
ObjectMap* map) { obj_.back()->
addVariable(name, map); }
43 void map_existing_object(
const std::string& name,
ObjectMap* map)
46 obj_.back()->addVariable(name, map);
49 void map_hierarchy_start(
const std::string& name,
ObjectMap* map)
51 obj_.back()->addVariable(name, map);
55 void map_hierarchy_end() { obj_.pop_back(); }
59 pointer_map_.insert_or_assign(
reinterpret_cast<uintptr_t
>(ptr->
getAddr()),
reinterpret_cast<uintptr_t
>(ptr));
62 ObjectMap* check_pointer_map(uintptr_t ptr)
64 auto it = pointer_map_.find(ptr);
65 return it != pointer_map_.end() ?
reinterpret_cast<ObjectMap*
>(it->second) :
nullptr;
Base class for objects created by the serializer mapping mode used to map the variables for objects.
Definition objectMap.h:188
virtual void addVariable(const std::string &UNUSED(name), ObjectMap *UNUSED(obj))
Adds a variable to this ObjectMap.
Definition objectMap.h:403
void incRefCount()
Increment the reference counter for this ObjectMap.
Definition objectMap.h:332
virtual void * getAddr() const =0
Get the address of the variable represented by the ObjectMap.