pstore2
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
pstore::repo::compilation Class Reference

A compilation is a holder for zero or more definitions. More...

#include <compilation.hpp>

Public Types

using iterator = definition *
 
using const_iterator = definition const *
 
using size_type = std::uint32_t
 

Public Member Functions

void operator delete (void *p)
 
typed_address< indirect_stringtriple () const noexcept
 Returns the target triple.
 
template<typename TransactionType , typename Iterator >
auto alloc (TransactionType &transaction, typed_address< indirect_string > triple, Iterator first_member, Iterator last_member) -> extent< compilation >
 
Element access
definition const & operator[] (std::size_t const i) const
 
Iterators
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
Capacity
bool empty () const noexcept
 Checks whether the container is empty.
 
size_type size () const noexcept
 Returns the number of elements.
 

Static Public Member Functions

static constexpr typed_address< definitionindex_address (typed_address< compilation > const c, size_type const index) noexcept
 Compute the address of the definition given by index within compilation c. More...
 
Construction
template<typename TransactionType , typename Iterator >
static extent< compilationalloc (TransactionType &transaction, typed_address< indirect_string > triple, Iterator first_member, Iterator last_member)
 Allocates a new compilation in-store and copy the ticket file path and the contents of a vector of definitions into it. More...
 
static std::shared_ptr< compilation const > load (database const &db, extent< compilation > const &location)
 Returns a pointer to an in-pstore compilation instance. More...
 

Storage

std::size_t size_bytes () const noexcept
 
static std::size_t size_bytes (size_type size) noexcept
 Returns the number of bytes of storage required for a compilation with 'size' members. More...
 

Detailed Description

A compilation is a holder for zero or more definitions.

It is the top-level object representing the result of processing of a transaction unit by the compiler.

Member Function Documentation

◆ alloc()

template<typename TransactionType , typename Iterator >
static extent<compilation> pstore::repo::compilation::alloc ( TransactionType &  transaction,
typed_address< indirect_string triple,
Iterator  first_member,
Iterator  last_member 
)
static

Allocates a new compilation in-store and copy the ticket file path and the contents of a vector of definitions into it.

Parameters
transactionThe transaction to which the compilation will be appended.
tripleThe target-triple associated with this compilation.
first_memberThe first of a sequence of definition instances. The range defined by first_member and last_member will be copied into the newly allocated compilation.
last_memberThe end of the range of definition instances.
Returns
A pair of a pointer and an extent which describes the in-store location of the allocated compilation.

◆ index_address()

static constexpr typed_address<definition> pstore::repo::compilation::index_address ( typed_address< compilation > const  c,
size_type const  index 
)
inlinestaticnoexcept

Compute the address of the definition given by index within compilation c.

Parameters
cThe address of a compilation.
indexThe index of a definition within compilation c.
Returns
The address of the definition index within compilation c.

◆ load()

auto compilation::load ( pstore::database const &  db,
pstore::extent< compilation > const &  location 
)
static

Returns a pointer to an in-pstore compilation instance.

Parameters
dbThe database from which the compilation should be loaded.
locationAn extent describing the compilation location in the store.
Returns
A pointer to the compilation in-store memory.

◆ size_bytes() [1/2]

static std::size_t pstore::repo::compilation::size_bytes ( size_type  size)
inlinestaticnoexcept

Returns the number of bytes of storage required for a compilation with 'size' members.

◆ size_bytes() [2/2]

std::size_t pstore::repo::compilation::size_bytes ( ) const
inlinenoexcept
Returns
The number of bytes needed to accommodate this compilation.

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