| Home | Libraries | People | FAQ | More

## Class frame

boost::stacktrace::frame — Class that stores frame/function address and can get information about it at runtime.

## Synopsis

    // In header: <boost/stacktrace/detail/frame_decl.hpp>

    class frame {
    public:
      // types
      typedef unspecified native_frame_ptr_t;

      // construct/copy/destruct
      frame() noexcept;
      frame(const frame &) = default;
      explicit frame(native_frame_ptr_t) noexcept;
      template<typename T> explicit frame(T *) noexcept;
      constexpr frame & operator=(const frame &) = default;

      // public member functions
      std::string name() const;
      constexpr native_frame_ptr_t address() const noexcept;
      std::string source_file() const;
      std::size_t source_line() const;
      constexpr bool empty() const noexcept;
    };

## Description

### `frame` public construct/copy/destruct

1.     frame() noexcept;

   Constructs frame that references NULL address. Calls to source_file() and source_line() will return empty string. Calls to source_line() will return 0.

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Throws: | Nothing.

2.     frame(const frame &) = default;

   Copy constructs frame.

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Throws: | Nothing.

3.     explicit frame(native_frame_ptr_t addr) noexcept;

   Constructs frame that references addr and could later generate information about that address using platform specific features.

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Throws: | Nothing.

4.     template<typename T> explicit frame(T * function_addr) noexcept;

   Constructs frame that references function_addr and could later generate information about that function using platform specific features.

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Throws: | Nothing.

5.     constexpr frame & operator=(const frame &) = default;

   Copy assigns frame.

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Throws: | Nothing.

### `frame` public member functions

1.     std::string name() const;

   Complexity: unknown (lots of platform specific work).

   Async-Handler-Safety: Unsafe.

   Returns: | Name of the frame (function name in a human readable form).
   Throws: | std::bad_alloc if not enough memory to construct resulting string.

2.     constexpr native_frame_ptr_t address() const noexcept;

   Complexity: O(1).

   Async-Handler-Safety: Safe.

   Returns: | Address of the frame function.
   Throws: | Nothing.

3.     std::string source_file() const;

   Complexity: unknown (lots of platform specific work).

   Async-Handler-Safety: Unsafe.

   Returns: | Path to the source file, were the function of the frame is defined. Returns empty string if this->source_line() == 0.
   Throws: | std::bad_alloc if not enough memory to construct resulting string.

4.     std::size_t source_line() const;

   Complexity: unknown (lots of platform specific work).

   Async-Handler-Safety: Unsafe.

   Returns: | Code line in the source file, were the function of the frame is defined.
   Throws: | std::bad_alloc if not enough memory to construct string for internal needs.

5.     constexpr bool empty() const noexcept;

   Checks that frame is not references NULL address.

   Complexity: O(1)

   Async-Handler-Safety: Safe. Checks that frame references NULL address. Complexity: O(1)

   Async-Handler-Safety: Safe.

   Returns: | `true` if `this->address() != 0`
   Returns: | `true` if `this->address() == 0`