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

Function get_attribute

nanofi/src/api/nanofi.cpp:400–411  ·  view source on GitHub ↗

* Obtains the attribute. * @param ff flow file record * @param key key * @param caller_attribute caller supplied object in which we will copy the data ptr * @return 0 if successful, -1 if the key does not exist */

Source from the content-addressed store, hash-verified

398 * @return 0 if successful, -1 if the key does not exist
399 */
400int8_t get_attribute(const flow_file_record * ff, attribute * caller_attribute) {
401 NULL_CHECK(-1, ff, caller_attribute);
402 NULL_CHECK(-1, ff->attributes, caller_attribute->key);
403 auto attribute_map = static_cast<AttributeMap*>(ff->attributes);
404 auto find = attribute_map->find(caller_attribute->key);
405 if (find != attribute_map->end()) {
406 caller_attribute->value = static_cast<void*>(const_cast<char*>(find->second.data()));
407 caller_attribute->value_size = find->second.size();
408 return 0;
409 }
410 return -1;
411}
412
413int get_attribute_quantity(const flow_file_record *ff) {
414 NULL_CHECK(0, ff);

Callers 4

custom_ontrigger_logicFunction · 0.85
CAPITests.cppFile · 0.85
mainFunction · 0.85

Calls 3

findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by 1

custom_ontrigger_logicFunction · 0.68