pstore2
Public Member Functions | List of all members
pstore::repo::section_creation_dispatcher Class Referenceabstract

A section creation dispatcher is used to instantiate and construct each of a fragment's sections in pstore memory. More...

#include <section.hpp>

Inheritance diagram for pstore::repo::section_creation_dispatcher:
Inheritance graph
[legend]

Public Member Functions

 section_creation_dispatcher (section_kind const kind) noexcept
 
 section_creation_dispatcher (section_creation_dispatcher const &)=delete
 
 section_creation_dispatcher (section_creation_dispatcher &&)=delete
 
section_creation_dispatcheroperator= (section_creation_dispatcher const &)=delete
 
section_creation_dispatcheroperator= (section_creation_dispatcher &&)=delete
 
section_kind const & kind () const noexcept
 
template<typename IntType , typename = std::enable_if<std::is_unsigned<IntType>::value>>
std::size_t aligned (IntType a) const
 
std::uint8_t * aligned (std::uint8_t *const a) const
 
virtual std::size_t size_bytes () const =0
 Returns the number of bytes of storage that are required for an instance of the section data. More...
 
virtual std::uint8_t * write (std::uint8_t *out) const =0
 Copies the section instance data to the memory starting at out. More...
 

Detailed Description

A section creation dispatcher is used to instantiate and construct each of a fragment's sections in pstore memory.

Objects in the pstore need to be portable across compilers and host ABIs so they must be "standard layout" which basically means that they can't have virtual member functions. These classes are used to add dynamic dispatch to those types.

Note
In addition to the "section creation" dispatcher, there is a second dispatcher hierarchy used to provide dynamic behavior for existing section instances.

Member Function Documentation

◆ aligned() [1/2]

template<typename IntType , typename = std::enable_if<std::is_unsigned<IntType>::value>>
std::size_t pstore::repo::section_creation_dispatcher::aligned ( IntType  a) const
inline
Parameters
aThe value to be aligned.
Returns
The value closest to but greater than or equal to a which is correctly aligned for an instance of the type used for an instance of this section kind.

◆ aligned() [2/2]

std::uint8_t* pstore::repo::section_creation_dispatcher::aligned ( std::uint8_t *const  a) const
inline
Parameters
aThe value to be aligned.
Returns
The value closest to but greater than or equal to a which is correctly aligned for an instance of the type used for an instance of this section kind.

◆ size_bytes()

virtual std::size_t pstore::repo::section_creation_dispatcher::size_bytes ( ) const
pure virtual

◆ write()

virtual std::uint8_t* pstore::repo::section_creation_dispatcher::write ( std::uint8_t *  out) const
pure virtual

Copies the section instance data to the memory starting at out.

On entry, out is aligned according to the result of the aligned() member function.

Parameters
outThe address to which the instance data will be written.
Returns
The address past the end of instance data where the next section's data can be writen.

Implemented in pstore::repo::generic_section_creation_dispatcher, pstore::repo::linked_definitions_creation_dispatcher, pstore::repo::bss_section_creation_dispatcher, and pstore::repo::debug_line_section_creation_dispatcher.


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