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

Function add_attribute

nanofi/src/api/nanofi.cpp:371–377  ·  view source on GitHub ↗

* Adds an attribute * @param ff flow file record * @param key key * @param value value to add * @param size size of value * @return 0 or -1 based on whether the attributed existed previously (-1) or not (0) */

Source from the content-addressed store, hash-verified

369 * @return 0 or -1 based on whether the attributed existed previously (-1) or not (0)
370 */
371int8_t add_attribute(flow_file_record *ff, const char *key, void *value, size_t size) {
372 NULL_CHECK(-1, ff, key, value);
373 NULL_CHECK(-1, ff->attributes);
374 auto attribute_map = static_cast<AttributeMap*>(ff->attributes);
375 const auto& ret = attribute_map->insert(std::pair<std::string, std::string>(key, std::string(static_cast<char*>(value), size)));
376 return ret.second ? 0 : -1;
377}
378
379/**
380 * Updates (or adds) an attribute

Callers 6

add_attributesFunction · 0.85
custom_ontrigger_logicFunction · 0.85
CAPITests.cppFile · 0.85
mainFunction · 0.85
custom_processor_logicFunction · 0.85

Calls 1

insertMethod · 0.45

Tested by 1

custom_ontrigger_logicFunction · 0.68