MCPcopy Create free account
hub / github.com/audeering/opensmile / findElement

Method findElement

src/core/dataProcessor.cpp:444–480  ·  view source on GitHub ↗

search for an element by its partial name (if multiple matches are found, only the first is returned) if fullName==1 , then do only look for exact name matches the return value will be the element(!) index , i.e. the index of the element in the data vector

Source from the content-addressed store, hash-verified

442// the return value will be the element(!) index , i.e. the index of the element in the data vector
443//
444long cDataProcessor::findElement(const char *namePartial,
445 int fullName, long *N, const char **fieldName, int *more, int *fieldIdx)
446{
447 const FrameMetaInfo * fmeta = reader_->getFrameMetaInfo();
448 if (fmeta == NULL)
449 return -1;
450 int ri=0;
451 long idx;
452 if (fullName) {
453 idx = fmeta->findField( namePartial , &ri, more );
454 } else {
455 idx = fmeta->findFieldByPartialName( namePartial , &ri, more );
456 }
457 long elIdx=-1;
458 const char *inputName;
459 long nInput;
460 if (idx < 0) {
461 inputName = NULL;
462 nInput = 0;
463 if (fullName) {
464 SMILE_IWRN(4,"Requested input element '%s' not found, check your config! Available fields:", namePartial);
465 } else {
466 SMILE_IWRN(4,"Requested input element matching pattern '*%s*' not found, check your config! Available fields:", namePartial);
467 }
468 if (SMILE_LOG_GLOBAL != NULL && SMILE_LOG_GLOBAL->getLogLevel_wrn() >= 4)
469 fmeta->printFieldNames();
470 } else {
471 elIdx = fmeta->fieldToElementIdx( idx ) + ri;
472 nInput = fmeta->field[idx].N;
473 inputName = fmeta->field[idx].name;
474 }
475
476 if (fieldIdx != NULL) *fieldIdx = idx;
477 if (N != NULL) *N = nInput;
478 if (fieldName != NULL) *fieldName = inputName;
479 return elIdx;
480}
481
482
483// get data from input field (previously found by findInputField())

Callers

nothing calls this directly

Calls 6

getLogLevel_wrnMethod · 0.80
printFieldNamesMethod · 0.80
fieldToElementIdxMethod · 0.80
getFrameMetaInfoMethod · 0.45
findFieldMethod · 0.45

Tested by

no test coverage detected