LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::DiagnosticEngine类 参考

#include <computation_context.hpp>

LMCAS::DiagnosticEngine 的协作图:

Public 类型

using Consumer = std::function<void(const Diagnostic&)>

Public 成员函数

 DiagnosticEngine (std::size_t limit, Consumer consumer={})
const std::vector< Diagnostic > & diagnostics () const noexcept
Result< void > emit (Diagnostic diagnostic)
void set_consumer (Consumer consumer)

Private 属性

Consumer consumer_
std::vector< Diagnostic > diagnostics_
std::size_t limit_

详细描述

在文件 computation_context.hpp 第 44 行定义.

成员类型定义说明

◆ Consumer

using LMCAS::DiagnosticEngine::Consumer = std::function<void(const Diagnostic&)>

在文件 computation_context.hpp 第 46 行定义.

构造及析构函数说明

◆ DiagnosticEngine()

LMCAS::DiagnosticEngine::DiagnosticEngine ( std::size_t limit,
Consumer consumer = {} )
inlineexplicit

在文件 computation_context.hpp 第 48 行定义.

48 {})
49 : limit_(limit), consumer_(std::move(consumer)) {}

成员函数说明

◆ diagnostics()

const std::vector< Diagnostic > & LMCAS::DiagnosticEngine::diagnostics ( ) const
inlinenoexcept

在文件 computation_context.hpp 第 76 行定义.

76 {
77 return diagnostics_;
78 }
std::vector< Diagnostic > diagnostics_

引用了 diagnostics_.

被这些函数引用 LMCAS::ComputationContext::diagnostics().

这是这个函数的调用关系图:

◆ emit()

Result< void > LMCAS::DiagnosticEngine::emit ( Diagnostic diagnostic)
inline

在文件 computation_context.hpp 第 51 行定义.

51 {
52 if (diagnostics_.size() >= limit_) {
54 "diagnostic budget exhausted",
55 diagnostic.operation);
56 }
57 bool inserted = false;
58 try {
59 diagnostics_.push_back(std::move(diagnostic));
60 inserted = true;
61 if (consumer_) consumer_(diagnostics_.back());
62 } catch (const std::bad_alloc&) {
63 if (inserted) diagnostics_.pop_back();
65 "diagnostic allocation failed");
66 } catch (...) {
67 if (inserted) diagnostics_.pop_back();
69 "diagnostic consumer failed");
70 }
71 return Result<void>::success();
72 }
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(T value)

引用了 consumer_, diagnostics_, LMCAS::Result< T >::failure(), LMCAS::InternalInvariant, limit_, LMCAS::Diagnostic::operation, LMCAS::ResourceLimit , 以及 LMCAS::Result< T >::success().

被这些函数引用 LMCAS::ComputationContext::add_diagnostic().

函数调用图:
这是这个函数的调用关系图:

◆ set_consumer()

void LMCAS::DiagnosticEngine::set_consumer ( Consumer consumer)
inline

在文件 computation_context.hpp 第 74 行定义.

74{ consumer_ = std::move(consumer); }

引用了 consumer_.

类成员变量说明

◆ consumer_

Consumer LMCAS::DiagnosticEngine::consumer_
private

在文件 computation_context.hpp 第 82 行定义.

被这些函数引用 emit() , 以及 set_consumer().

◆ diagnostics_

std::vector<Diagnostic> LMCAS::DiagnosticEngine::diagnostics_
private

在文件 computation_context.hpp 第 83 行定义.

被这些函数引用 diagnostics() , 以及 emit().

◆ limit_

std::size_t LMCAS::DiagnosticEngine::limit_
private

在文件 computation_context.hpp 第 81 行定义.

被这些函数引用 emit().


该类的文档由以下文件生成: