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) noexcept
 
void initialize_table () const
 Initialize the table once we perform a read.
 
rom_tableoperator= (const rom_table &other)
 
rom_tableoperator= (rom_table &&other) noexcept
 
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<typename Builder>
class bb::stdlib::rom_table< Builder >

Definition at line 15 of file rom_table.hpp.

Member Typedef Documentation

◆ field_pt

template<typename Builder >
using bb::stdlib::rom_table< Builder >::field_pt = field_t<Builder>
private

Definition at line 17 of file rom_table.hpp.

Constructor & Destructor Documentation

◆ rom_table() [1/5]

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

Definition at line 20 of file rom_table.hpp.

◆ rom_table() [2/5]

template<typename 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<typename 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<typename Builder >
bb::stdlib::rom_table< Builder >::rom_table ( const rom_table< Builder > &  other)
default

◆ rom_table() [5/5]

template<typename Builder >
bb::stdlib::rom_table< Builder >::rom_table ( rom_table< Builder > &&  other)
noexcept

Definition at line 115 of file rom_table.cpp.

Member Function Documentation

◆ get_context()

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

Definition at line 39 of file rom_table.hpp.

◆ initialize_table()

template<typename 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<typename Builder >
rom_table< Builder > & bb::stdlib::rom_table< Builder >::operator= ( const rom_table< Builder > &  other)
default

◆ operator=() [2/2]

template<typename Builder >
rom_table< Builder > & bb::stdlib::rom_table< Builder >::operator= ( rom_table< Builder > &&  other)
noexcept

Definition at line 132 of file rom_table.cpp.

◆ operator[]() [1/2]

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

Definition at line 161 of file rom_table.cpp.

◆ operator[]() [2/2]

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

Definition at line 151 of file rom_table.cpp.

◆ size()

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

Definition at line 37 of file rom_table.hpp.

Member Data Documentation

◆ _tags

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

Definition at line 46 of file rom_table.hpp.

◆ context

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

Definition at line 50 of file rom_table.hpp.

◆ entries

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

Definition at line 43 of file rom_table.hpp.

◆ initialized

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

Definition at line 49 of file rom_table.hpp.

◆ length

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

Definition at line 47 of file rom_table.hpp.

◆ raw_entries

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

Definition at line 42 of file rom_table.hpp.

◆ rom_id

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

Definition at line 48 of file rom_table.hpp.


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