1#ifndef GIMBAL_CALL_STACK_HPP
2#define GIMBAL_CALL_STACK_HPP
4#include "gimbal_call_stack.h"
5#include "../types/gimbal_typedefs.hpp"
6#include "../types/gimbal_result.hpp"
14 SourceLocation(
const char* pFile,
const char* pFunc, GblSize line, GblSize col):
15 GblSourceLocation{pFile, pFunc, line, col} {}
17 SourceLocation(
void) {
20 SourceLocation(
const GblSourceLocation& rhs) {
21 memcpy(
this, &rhs,
sizeof(GblSourceLocation));
24 const char* getFilePath(
void)
const {
return pFile; }
25 const char* getFileName(
void)
const {
return pFile; }
26 const char* getFunctionName(
void)
const {
return pFunc; }
27 GblSize getLineNumber(
void)
const {
return line; }
28 GblSize getColumn(
void)
const {
return column; }
30 bool isValid(
void)
const;
31 std::string toPrettyString(
void)
const;
38GBL_CHECK_C_CPP_TYPE_COMPAT(SourceLocation, GblSourceLocation);
51 CallRecord(
const GblCallRecord& other) {
52 memcpy(
this, &other,
sizeof(GblCallRecord));
55 Handle* getHandle(
void)
const;
56 Result getResult(
void)
const {
return this->result; }
58 return static_cast<
const SourceLocation&>(srcLocation);
62 const char* getMessage(
void)
const {
return message; }
63 std::string getSourceString(
void)
const;
65 std::string toString(
void)
const;
69GBL_CHECK_C_CPP_TYPE_COMPAT(CallRecord, GblCallRecord);
76 GBL_API_STACK_FRAME_CONSTRUCT(
this, pObject, initialResult, entryLoc);
81
82
83
84
85
87 auto getSourceEntry(
void)
const ->
const SourceLocation& {
return *
static_cast<
const SourceLocation*>(&sourceEntry);}
88 auto getCallRecord(
void)
const ->
const CallRecord& {
return *
static_cast<
const CallRecord*>(&record); }
90 GblObject* getObject(
void)
const;
91 GblContext* getContext(
void)
const;
92 void* getHandleUd(
void)
const;
93 void* getContextUd(
void)
const;
95 bool isValid(
void)
const;
98GBL_CHECK_C_CPP_TYPE_COMPAT(StackFrame, GblStackFrame);
101inline CallRecord::CallRecord(Result result,
const char* pMessage, GblObject* pObject,
SourceLocation srcLoc)
noexcept {
102 GBL_CALL_RECORD_CONSTRUCT(
this, pObject, result.getCode(), srcLoc,
"%s", pMessage? pMessage : result.toString());