L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
cxx Namespace Reference

Our C++ library. More...

Namespaces

namespace  Bits
 Internal helpers for the cxx package.
 

Data Structures

class  Avl_map
 AVL tree based associative container. More...
 
class  Avl_set
 AVL set for simple compareable items. More...
 
class  Avl_tree
 A generic AVL tree. More...
 
class  Avl_tree_node
 Node of an AVL tree. More...
 
class  Base_slab
 Basic slab allocator. More...
 
class  Base_slab_static
 Merged slab allocator (allocators for objects of the same size are merged together). More...
 
class  Bitfield
 Definition for a member (part) of a bit field. More...
 
class  Bitmap
 A static bitmap. More...
 
class  Bitmap_base
 Basic bitmap abstraction. More...
 
class  H_list
 General double-linked list of unspecified cxx::H_list_item elements. More...
 
class  H_list_item_t
 Basic element type for a double-linked H_list. More...
 
struct  H_list_t
 Double-linked list of typed H_list_item_t elements. More...
 
class  List
 Doubly linked list, with internal allocation. More...
 
class  List_alloc
 Standard list-based allocator. More...
 
class  List_item
 Basic list item. More...
 
struct  Lt_functor
 Generic comparator class that defaults to the less-than operator. More...
 
class  New_allocator
 Standard allocator based on operator new () . More...
 
class  Nothrow
 Helper type to distinguish the oeprator new version that does not throw exceptions. More...
 
struct  Pair
 Pair of two values. More...
 
class  Pair_first_compare
 Comparison functor for Pair. More...
 
struct  Ref_obj_list_item
 Item for list linked via cxx::Ref_ptr with default refence counting. More...
 
class  Ref_ptr
 A reference-counting pointer with automatic cleanup. More...
 
class  S_list
 Simple single-linked list. More...
 
class  Slab
 Slab allocator for object of type Type. More...
 
class  Slab_static
 Merged slab allocator (allocators for objects of the same size are merged together). More...
 
class  static_vector
 Simple encapsulation for a dynamically allocated array. More...
 
class  String
 Allocation free string class with explicit length field. More...
 
class  Weak_ref
 Typed weak reference to an object of type T. More...
 
class  Weak_ref_base
 Generic (base) weak reference to some object. More...
 

Typedefs

typedef H_list_item_t< void > H_list_item
 Untyped list item.
 
template<typename T >
using Ref_ptr_list_item = Bits::Smart_ptr_list_item< T, cxx::Ref_ptr< T > >
 Item for list linked with cxx::Ref_ptr.
 
template<typename T >
using Ref_ptr_list = Bits::Smart_ptr_list< Ref_ptr_list_item< T > >
 Single-linked list where elements are connected via a cxx::Ref_ptr.
 
template<typename T >
using Unique_ptr_list_item = Bits::Smart_ptr_list_item< T, cxx::unique_ptr< T > >
 Item for list linked with cxx::unique_ptr.
 
template<typename T >
using Unique_ptr_list = Bits::Smart_ptr_list< Unique_ptr_list_item< T > >
 Single-linked list where elements are connected with a cxx::unique_ptr.
 

Functions

template<typename A , typename ... ARGS>
constexpr A const & min (A const &a1, A const &a2, ARGS const &...a)
 Get the minimum of a1 and a2 upt to aN.
 
template<typename A , typename ... ARGS>
constexpr A const & min (cxx::identity_t< A > const &a1, cxx::identity_t< A > const &a2, ARGS const &...a)
 Get the minimum of a1 and a2 upt to aN.
 
template<typename A , typename ... ARGS>
constexpr A const & max (A const &a1, A const &a2, ARGS const &...a)
 Get the maximum of a1 and a2 upt to aN.
 
template<typename A , typename ... ARGS>
constexpr A const & max (cxx::identity_t< A > const &a1, cxx::identity_t< A > const &a2, ARGS const &...a)
 Get the maximum of a1 and a2 upt to aN.
 
template<typename T1 >
T1 clamp (T1 v, T1 lo, T1 hi)
 Limit v to the range given by lo and hi.
 
template<typename T >
access_once (T const *a)
 Read the value at an address at most once.
 
template<typename T , typename VAL >
void write_now (T *a, VAL &&val)
 Write a value at an address exactly once.
 

Detailed Description

Our C++ library.

Small Low-Level C++ Library.

Strings.

Various kinds of C++ utilities.

Function Documentation

◆ access_once()

template<typename T >
T cxx::access_once ( T const *  a)
inline

Read the value at an address at most once.

The read might be omitted if the result is not used by any code unless typename contains volatile. If the read operation has side effects and must not be omitted, use different means like L4drivers::Mmio_register_block or similar.

The compiler is disallowed to reuse a previous read at the same address, for example:

val1 = *a;
val2 = access_once(a); // compiler may not replace this by val2 = val1;
T access_once(T const *a)
Read the value at an address at most once.
Definition utils:39

The compiler is also disallowed to repeat the read, for example:

val1 = access_once(a);
val2 = val1; // compiler may not replace this by val2 = *a;

The above implies that the compiler is also disallowed to move the read out of or into loops.

Note
The read might still be moved relative to other code.
The value might be read from a hardware cache, not from RAM.

Definition at line 39 of file utils.

Referenced by L4virtio::Svr::Request_processor::next(), and L4virtio::Svr::Request_processor::start().

+ Here is the caller graph for this function:

◆ write_now()

template<typename T , typename VAL >
void cxx::write_now ( T *  a,
VAL &&  val 
)
inline

Write a value at an address exactly once.

The compiler is disallowed to skip the write, for example:

*a = val;
write_now(a, val); // compiler may not skip this line
void write_now(T *a, VAL &&val)
Write a value at an address exactly once.
Definition utils:70

The compiler is also disallowed to repeat the write.

The above implies that the compiler is also disallowed to move the write out of or into loops.

Note
The write might still be moved relative to other code.
The value might be written just to a hardware cache for the moment, not immediately to RAM.

Definition at line 70 of file utils.