Skip to content

Commit

Permalink
move getMapData implementations to cfeature.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
anilbey committed Oct 17, 2023
1 parent 9c1bcf3 commit 4612577
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
17 changes: 17 additions & 0 deletions efel/cppcore/cfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ cFeature::cFeature(const string& strDepFile, const string& outdir)
logger << "Using dependency file: " << strDepFile << endl;
}

template <typename T>
const vector<T> cFeature::getMapData(const string& strName, const map<string, vector<T>>& mapData) {
auto mapItr = mapData.find(strName);
if (mapItr == mapData.end()) {
return vector<T>{}; // Return an empty vector without modifying the map
}
return mapItr->second;
}

const vector<int> cFeature::getmapIntData(string strName) {
return getMapData(strName, mapIntData);
}

const vector<double> cFeature::getmapDoubleData(string strName) {
return getMapData(strName, mapDoubleData);
}

int cFeature::setVersion(string strDepFile) {
FptrTable.clear();
/*
Expand Down
22 changes: 4 additions & 18 deletions efel/cppcore/cfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,13 @@ class cFeature {

public:
std::map<string, vector<featureStringPair > > fptrlookup;

template <typename T>
const vector<T> getMapData(const string& strName, const map<string, vector<T>>& mapData) {
auto mapItr = mapData.find(strName);
if (mapItr == mapData.end()) {
return vector<T>{}; // Return an empty vector without modifying the map
}
return mapItr->second;
}

const vector<int> getmapIntData(string strName) {
return getMapData(strName, mapIntData);
}

const vector<double> getmapDoubleData(string strName) {
return getMapData(strName, mapDoubleData);
}

eFELLogger logger;

cFeature(const string& depFile, const string& outdir);
template <typename T>
const vector<T> getMapData(const string& strName, const map<string, vector<T>>& mapData);
const vector<int> getmapIntData(string strName);
const vector<double> getmapDoubleData(string strName);
int getmapfptrVec(string strName, vector<feature_function>& vFptr);
int calc_features(const string& name);
template <typename T>
Expand Down

0 comments on commit 4612577

Please sign in to comment.