MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / process

Method process

extensions/bustache/ApplyTemplate.cpp:72–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72int64_t ApplyTemplate::WriteCallback::process(const std::shared_ptr<io::BaseStream> stream) {
73 logger_->log_info("ApplyTemplate reading template file from %s", template_file_);
74 boost::iostreams::mapped_file_source file(template_file_);
75
76 bustache::format format(file);
77 bustache::object data;
78
79 for (const auto &attr : flow_file_->getAttributes()) {
80 data[attr.first] = attr.second;
81 }
82
83 // TODO(calebj) write ostream reciever for format() to prevent excessive copying
84 std::string ostring = to_string(format(data));
85 stream->write(reinterpret_cast<uint8_t *>(const_cast<char *>(ostring.c_str())),
86 ostring.length());
87
88 return ostring.length();
89}
90
91} /* namespace processors */
92} /* namespace minifi */

Callers

nothing calls this directly

Calls 6

log_infoMethod · 0.80
c_strMethod · 0.80
lengthMethod · 0.80
to_stringFunction · 0.50
getAttributesMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected