Leonardus
Loading...
Searching...
No Matches
Classes | Public Types | Static Public Member Functions | Static Private Attributes | List of all members
Registry Class Reference

Central registry for all core code entries. More...

#include <registry.h>

+ Collaboration diagram for Registry:

Classes

struct  CoreCodeMetadata
 Internal representation of a core code entry. More...
 

Public Types

enum class  CCIntention : std::uint8_t {
  SystemDict , LeoDict , Loop , Odo ,
  Compatibility
}
 Intention of a core code entry. More...
 

Static Public Member Functions

static bool lookUp (core_t *p_core)
 Checks if core code is in the static table.
 
static std::string_view lookUpName (core_t *p_core)
 Finds the name of a core code.
 
static size_t lookUpStackusage (core_t *p_core)
 Finds the stackusage of a core code.
 
static core_t * lookUpCoreCode (std::string_view p_name)
 Finds the core code for a name.
 
static std::vector< std::pair< std::string_view, core_t * > > getPopulate (CCIntention p_int)
 Assembles a vector with all core code entries of a specific intention.
 

Static Private Attributes

static const std::unordered_map< core_t *, CoreCodeMetadata > coreCodeTable_
 Table of all core code entries.
 

Detailed Description

Central registry for all core code entries.

Provides lookup and dictionary population functionality.

Invariant
None.

Member Enumeration Documentation

◆ CCIntention

enum class Registry::CCIntention : std::uint8_t
strong

Intention of a core code entry.

Enumerator
SystemDict 

Registered in systemdict.

LeoDict 

Registered in leodict.

Loop 

Unregistered auxiliary loop operators (e.g., __for_up_continue).

Odo 

Unregistered optimization operators (for bind).

Compatibility 

Unregistered operators for PostScript/Forth compatibility.

Member Function Documentation

◆ getPopulate()

std::vector< std::pair< std::string_view, core_t * > > Registry::getPopulate ( CCIntention  p_int)
static

Assembles a vector with all core code entries of a specific intention.

Parameters
[in]p_intThe intention of the entries to include.
Returns
std::vector<std::pair<std::string_view, core_t *>> ... The vector.

◆ lookUp()

static bool Registry::lookUp ( core_t *  p_core)
inlinestatic

Checks if core code is in the static table.

Parameters
[in]p_coreThe core code to look up.
Returns
bool ... true if p_core is in the table of core codes.

◆ lookUpCoreCode()

core_t * Registry::lookUpCoreCode ( std::string_view  p_name)
static

Finds the core code for a name.

Look up with O(n).

Parameters
[in]p_nameThe name to look up.
Returns
core_t * ... The core code. Returns nullptr, if name can not be found.

◆ lookUpName()

std::string_view Registry::lookUpName ( core_t *  p_core)
static

Finds the name of a core code.

Look up with hash.

Precondition
p_core is an entry in coreCodeTable_
Parameters
[in]p_coreThe core code to look up.
Returns
std::string_view ... The name.

◆ lookUpStackusage()

size_t Registry::lookUpStackusage ( core_t *  p_core)
static

Finds the stackusage of a core code.

Look up with hash.

Precondition
p_core is an entry in coreCodeTable_
Parameters
[in]p_coreThe core code to look up.
Returns
std::string_view ... The stackusage.

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