24#include <unordered_map>
63 const SON * son =
static_cast<const SON *
>( p_key );
64 return std::hash<std::string>{}( son->
getName() );
66 return std::hash<char>{}(
static_cast<char>( isN ) );
90 return p_lhs->
equal( p_rhs );
103 std::unordered_map<SOp,SOp,FunctorHash,FunctorEqual>
stlmap_{};
108 [](
const auto & p_pair ) {
110 delete p_pair.second;
122 void *
shptr()
const override {
return static_cast<void *
>(
map_.get() ); }
132 return std::none_of(
map_->stlmap_.begin(),
map_->stlmap_.end(),
133 [](
const auto & p ) {
134 return p.first == nullptr or p.second == nullptr;
171 SOD & operator=(
const SOD & ) =
delete;
172 SOD & operator=(
SOD && ) =
delete;
176 [[nodiscard]]
SOD *
dup()
const override {
return new SOD( *
this ); }
182 [[nodiscard]]
SOD *
clone()
const override;
191 std::string_view
type()
const override {
return "dicttype"; }
197 size_t dagheight(
size_t p_myheight )
const override;
206 auto end()
const {
return map_->stlmap_.end(); }
239 map_->stlmap_.erase( it );
The context of execution.
Definition context.h:46
virtual bool invariant() const noexcept
Checks the invariants of the class in which it is defined.
Definition dbc.h:40
Semantic Object Dictionary.
Definition sod.h:43
SOD * dup() const override
Creates a new instance as copy following the red book definition.
Definition sod.h:176
size_t getSize() const override
Returns the size of the SO.
Definition sod.h:194
SOD * clone() const override
Creates a new instance as copy with deep cloning.
Definition sod.cpp:40
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sod.cpp:51
OTCode ot() const override
Returns an OTCode.
Definition sod.h:188
void insert(SOp p_key, SOp p_value)
Insert with the red book definition of equal.
Definition sod.cpp:99
SOD(const SOcomposite &p_other)
Ctor from parent class object.
Definition sod.h:151
auto end() const
Returns an iterator to the marker at end of the map of two SOps.
Definition sod.h:206
SOp find(SO *p_key) const
Searches for p_key in the dictionary.
Definition sod.cpp:124
std::string_view type() const override
Returns a type name.
Definition sod.h:191
void undef(SO *p_key)
Removes both p_key and its value from the dictionary.
Definition sod.cpp:132
SOD()
Ctor.
Definition sod.h:142
size_t dagheight(size_t p_myheight) const override
DAG Height.
Definition sod.cpp:77
bool invariant() const noexcept override
Checks class invariants.
Definition sod.h:129
auto begin() const
Returns an iterator to the begin of the map of two SOps.
Definition sod.h:202
SOD(const SOD &p_other)
Copy ctor.
Definition sod.h:159
void * shptr() const override
Pointer to the shared object.
Definition sod.h:122
~SOD() override
Dtor.
Definition sod.h:165
std::shared_ptr< SODMap > map_
The shared dictionary.
Definition sod.h:118
auto any_pop()
Returns a pair from the dictionary.
Definition sod.h:233
Semantic Object Name.
Definition sosimp.h:525
std::string getName() const
Getter for name_.
Definition sosimp.h:574
static bool otcodeIsName(OTCode p_code)
Checks if an OTCode represents a name type (N or Nx).
Definition sosimp.h:621
Semantic Object.
Definition so.h:67
virtual bool equal(const SO *) const =0
Checks if this SO is equal to another SO.
virtual OTCode ot() const =0
Returns an OTCode.
Composite Semantic Object.
Definition so.h:261
Helpers for design by contract idioms.
#define DBC_INV_CTOR(T)
Assert for invariant checks in ctors and dtors.
Definition dbc.h:122
#define DBC_PRE(XXX)
Assert for preconditions.
Definition dbc.h:104
#define DBC_INV_RAII(TT)
Defines an instance of the class DbCRAIIassert<>, which calls the invariant()-function at the return ...
Definition dbc.h:94
Miscellaneous definitions and functions.
The class SO - semantic object.
OTCode
OTCode - the Object Type Code.
Definition so.h:38
The simple SO* class hierarchy.
Equality functor for SO* keys in SOD's unordered_map.
Definition sod.h:77
bool operator()(const SOp &p_lhs, const SOp &p_rhs) const
Checks if two SO* objects are semantically equal.
Definition sod.h:86
Hash functor for SO* keys in SOD's unordered_map.
Definition sod.h:51
size_t operator()(const SOp &p_key) const
Computes the hash value for a given SO*.
Definition sod.h:58
Semantic Object Dictionary - map member class.
Definition sod.h:101
std::unordered_map< SOp, SOp, FunctorHash, FunctorEqual > stlmap_
The map.
Definition sod.h:103
~SODMap()
Dtor.
Definition sod.h:106