MCPcopy Create free account
hub / github.com/baidu/babylon / build

Method build

src/babylon/anyflow/builder.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42::std::unique_ptr<Graph> GraphBuilder::build() const noexcept {
43 ::std::unique_ptr<Graph> graph {new Graph};
44 graph->set_executor(*_executor);
45 graph->set_page_allocator(*_page_allocator);
46 graph->initialize_data(_data_index_for_name);
47 graph->initialize_vertexes(_vertexes.size());
48 auto& vertexes = graph->vertexes();
49
50 for (size_t i = 0; i < _vertexes.size(); ++i) {
51 auto& builder = _vertexes[i];
52 auto& vertex = vertexes[i];
53 if (0 != builder->build(*graph, vertex)) {
54 BABYLON_LOG(WARNING) << "build " << *builder << " failed";
55 return ::std::unique_ptr<Graph>();
56 }
57 }
58
59 for (const auto& one_data : graph->data()) {
60 if (ABSL_PREDICT_FALSE(0 != one_data.error_code())) {
61 BABYLON_LOG(WARNING) << one_data << " build failed";
62 return ::std::unique_ptr<Graph>();
63 }
64 if (ABSL_PREDICT_FALSE(!one_data.check_safe_mutable())) {
65 BABYLON_LOG(WARNING) << one_data << " mutable but non exclusive";
66 return ::std::unique_ptr<Graph>();
67 }
68 }
69 return graph;
70}
71
72size_t GraphBuilder::get_or_allocate_data_index(StringView name) noexcept {
73 size_t data_index = _data_index_for_name.size();

Callers

nothing calls this directly

Calls 15

initialize_dataMethod · 0.80
initialize_vertexesMethod · 0.80
check_safe_mutableMethod · 0.80
set_processorMethod · 0.80
add_successorMethod · 0.80
sourceMethod · 0.80
targetMethod · 0.80
conditionMethod · 0.80
producerMethod · 0.80
set_executorMethod · 0.45
set_page_allocatorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected