Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::stdlib::rom_table< Builder > Class Template Reference

#include <rom_table.hpp>

Public Member Functions

 rom_table ()
 
 rom_table (const std::vector< field_pt > &table_entries)
 Construct a new ROM table (read only array)
 
 rom_table (Builder *builder, const std::vector< field_pt > &table_entries)
 Construct a new ROM table (read only array)
 
 rom_table (const rom_table &other)
 
 rom_table (rom_table &&other)
 
void initialize_table () const
 Initialize the table once we perform a read.
 
rom_tableoperator= (const rom_table &other)
 
rom_tableoperator= (rom_table &&other)
 
field_pt operator[] (const size_t index) const
 
field_pt operator[] (const field_pt &index) const
 
size_t size () const
 
Builderget_context () const
 

Private Types

using field_pt = field_t< Builder >
 

Private Attributes

std::vector< field_ptraw_entries
 
std::vector< field_ptentries
 
std::vector< OriginTag_tags
 
size_t length = 0
 
size_t rom_id = 0
 
bool initialized = false
 
Buildercontext = nullptr
 

Detailed Description

template<IsUltraOrMegaBuilder Builder>
class bb::stdlib::rom_table< Builder >

Definition at line 16 of file rom_table.hpp.

Member Typedef Documentation

◆ field_pt

Definition at line 18 of file rom_table.hpp.

Constructor & Destructor Documentation

◆ rom_table() [1/5]

template<IsUltraOrMegaBuilder Builder>
bb::stdlib::rom_table< Builder >::rom_table ( )
inline

Definition at line 21 of file rom_table.hpp.

◆ rom_table() [2/5]

template<IsUltraOrMegaBuilder Builder>
bb::stdlib::rom_table< Builder >::rom_table ( const std::vector< field_pt > &  table_entries)

Construct a new ROM table (read only array)

This constructor is used internally in barretenberg to construct tables without the need to specify the builder. It is especially useful when methods create new rom tables operating on in-circuit values which a priori we don't know whether they are constant or witnesses.

Definition at line 48 of file rom_table.cpp.

◆ rom_table() [3/5]

template<IsUltraOrMegaBuilder Builder>
bb::stdlib::rom_table< Builder >::rom_table ( Builder builder,
const std::vector< field_pt > &  table_entries 
)

Construct a new ROM table (read only array)

This constructor is used in DSL, where we need to initialize a table with a builder to prevent the case in which a read operation happens before the context has been set.

Definition at line 24 of file rom_table.cpp.

◆ rom_table() [4/5]

template<IsUltraOrMegaBuilder Builder>
bb::stdlib::rom_table< Builder >::rom_table ( const rom_table< Builder > &  other)
default

◆ rom_table() [5/5]

template<IsUltraOrMegaBuilder Builder>
bb::stdlib::rom_table< Builder >::rom_table ( rom_table< Builder > &&  other)
default

Member Function Documentation

◆ get_context()

template<IsUltraOrMegaBuilder Builder>
Builder * bb::stdlib::rom_table< Builder >::get_context ( ) const
inline

Definition at line 40 of file rom_table.hpp.

◆ initialize_table()

template<IsUltraOrMegaBuilder Builder>
void bb::stdlib::rom_table< Builder >::initialize_table ( ) const

Initialize the table once we perform a read.

Template Parameters
Builder
Note
If both the table entries and the index are constant, we don't need a builder as we can directly extract the desired value from raw_entries. In particular, we simply don't use the ROM table mechanism under the hood.
using this API, ROM tables are always fully initialized.

Definition at line 80 of file rom_table.cpp.

◆ operator=() [1/2]

template<IsUltraOrMegaBuilder Builder>
rom_table< Builder > & bb::stdlib::rom_table< Builder >::operator= ( const rom_table< Builder > &  other)
default

◆ operator=() [2/2]

template<IsUltraOrMegaBuilder Builder>
rom_table< Builder > & bb::stdlib::rom_table< Builder >::operator= ( rom_table< Builder > &&  other)
default

◆ operator[]() [1/2]

template<IsUltraOrMegaBuilder Builder>
field_t< Builder > bb::stdlib::rom_table< Builder >::operator[] ( const field_pt index) const

Definition at line 128 of file rom_table.cpp.

◆ operator[]() [2/2]

template<IsUltraOrMegaBuilder Builder>
field_t< Builder > bb::stdlib::rom_table< Builder >::operator[] ( const size_t  index) const

Definition at line 118 of file rom_table.cpp.

◆ size()

template<IsUltraOrMegaBuilder Builder>
size_t bb::stdlib::rom_table< Builder >::size ( ) const
inline

Definition at line 38 of file rom_table.hpp.

Member Data Documentation

◆ _tags

template<IsUltraOrMegaBuilder Builder>
std::vector<OriginTag> bb::stdlib::rom_table< Builder >::_tags
mutableprivate

Definition at line 47 of file rom_table.hpp.

◆ context

template<IsUltraOrMegaBuilder Builder>
Builder* bb::stdlib::rom_table< Builder >::context = nullptr
mutableprivate

Definition at line 51 of file rom_table.hpp.

◆ entries

template<IsUltraOrMegaBuilder Builder>
std::vector<field_pt> bb::stdlib::rom_table< Builder >::entries
mutableprivate

Definition at line 44 of file rom_table.hpp.

◆ initialized

template<IsUltraOrMegaBuilder Builder>
bool bb::stdlib::rom_table< Builder >::initialized = false
mutableprivate

Definition at line 50 of file rom_table.hpp.

◆ length

template<IsUltraOrMegaBuilder Builder>
size_t bb::stdlib::rom_table< Builder >::length = 0
private

Definition at line 48 of file rom_table.hpp.

◆ raw_entries

template<IsUltraOrMegaBuilder Builder>
std::vector<field_pt> bb::stdlib::rom_table< Builder >::raw_entries
private

Definition at line 43 of file rom_table.hpp.

◆ rom_id

template<IsUltraOrMegaBuilder Builder>
size_t bb::stdlib::rom_table< Builder >::rom_id = 0
mutableprivate

Definition at line 49 of file rom_table.hpp.


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