SST  15.1.0
StructuralSimulationToolkit
mapper.h
1 // Copyright 2009-2025 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2025, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_SERIALIZATION_IMPL_MAPPER_H
13 #define SST_CORE_SERIALIZATION_IMPL_MAPPER_H
14 
15 #ifndef SST_INCLUDING_SERIALIZER_H
16 #warning \
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"
18 #endif
19 
20 #include <cstdint>
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 namespace SST::Core::Serialization {
26 
27 class ObjectMap;
28 
29 namespace pvt {
30 
32 {
33  std::map<uintptr_t, uintptr_t> pointer_map;
34  std::vector<ObjectMap*> obj_;
35  bool next_item_read_only = false;
36  int indent = 0;
37 
38 public:
39  ser_mapper() = default;
40 
41  explicit ser_mapper(ObjectMap* object) :
42  obj_ { object }
43  {}
44 
45  void map_primitive(const std::string& name, ObjectMap* map);
46  void map_container(const std::string& name, ObjectMap* map);
47  void map_existing_object(const std::string& name, ObjectMap* map);
48  void map_hierarchy_start(const std::string& name, ObjectMap* map);
49  void map_hierarchy_end();
50  void setNextObjectReadOnly() { next_item_read_only = true; }
51  void report_object_map(ObjectMap* ptr);
52  ObjectMap* check_pointer_map(uintptr_t ptr);
53 };
54 
55 } // namespace pvt
56 } // namespace SST::Core::Serialization
57 
58 #endif // SST_CORE_SERIALIZATION_IMPL_MAPPER_H
Base class for objects created by the serializer mapping mode used to map the variables for objects...
Definition: objectMap.h:158