Skip to content

Commit

Permalink
make format
Browse files Browse the repository at this point in the history
  • Loading branch information
anilbey committed Nov 29, 2023
1 parent f3b3a73 commit 4e6514b
Show file tree
Hide file tree
Showing 10 changed files with 1,600 additions and 1,482 deletions.
31 changes: 15 additions & 16 deletions efel/cppcore/DependencyTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include "DependencyTree.h"

#include <algorithm> //remove
#include <cctype> //isspace
#include <algorithm> //remove
#include <cctype> //isspace
#include <fstream>

static void removeAllWhiteSpace(string &str) {
Expand All @@ -34,7 +34,7 @@ cTree::cTree(const char *strFileName) {
return;
}

for (string line; std::getline(input, line); ) {
for (string line; std::getline(input, line);) {
removeAllWhiteSpace(line);
if (!line.empty()) {
strDependencyFile.push_back(std::move(line));
Expand All @@ -52,13 +52,13 @@ cTree::cTree(const char *strFileName) {
* FptrTable :
* FptrLookup | vector of pairs:
* first | string: feature name
* second | vector of feature_function to represent list of dependent features
* second | vector of feature_function to represent list of
* dependent features
*
*/
int cTree::setFeaturePointers(map<string, feature2function *> &mapFptrLib,
feature2function *FptrTable,
map<string, vector<feature_function > > *FptrLookup)
{
int cTree::setFeaturePointers(
map<string, feature2function *> &mapFptrLib, feature2function *FptrTable,
map<string, vector<feature_function> > *FptrLookup) {
list<string>::iterator lstItr;
map<string, feature2function *>::iterator mapLibItr;
feature2function *fptrTbl;
Expand All @@ -73,7 +73,6 @@ int cTree::setFeaturePointers(map<string, feature2function *> &mapFptrLib,
// vecFeature is a list with all the feature names in the first column
// of the dependency file
for (unsigned i = 0; i < vecFeature.size(); i++) {

FinalList.clear();
strLibFeature = vecFeature[i];
// fill FinalList with all the dependencies of feature vecFeature[i]
Expand Down Expand Up @@ -112,7 +111,7 @@ int cTree::setFeaturePointers(map<string, feature2function *> &mapFptrLib,

vecfptr.push_back(mapFeatureItr->second);
FptrTable->insert(std::pair<string, feature_function>(
strFeature, mapFeatureItr->second));
strFeature, mapFeatureItr->second));
}
// Add the vecfptr from above to a map with as key the base featurei
FptrLookup->insert(
Expand All @@ -130,7 +129,7 @@ int cTree::setFeaturePointers(map<string, feature2function *> &mapFptrLib,
*/
int cTree::getAllParents(vector<string> &lstFeature) {
for (unsigned i = 0; i < strDependencyFile.size(); i++) {
const string& strLine = strDependencyFile[i];
const string &strLine = strDependencyFile[i];
size_t nPos = strLine.find_first_of('#');
string FeatureName = strLine.substr(0, nPos);
if (!FeatureName.empty()) {
Expand Down Expand Up @@ -161,19 +160,19 @@ int cTree::getChilds(string str, list<string> &childs) {
return 1;
}


int cTree::getDependency(const string& strLine) {
int cTree::getDependency(const string &strLine) {
std::list<string> tmpChild;

getChilds(strLine, tmpChild);
for (const auto& childFeature : tmpChild) {
getDependency(childFeature); // Recursively get dependencies of the child feature.
for (const auto &childFeature : tmpChild) {
getDependency(
childFeature); // Recursively get dependencies of the child feature.
}
AddUniqueItem(strLine); // Add the feature itself to the FinalList.
return 0;
}

void cTree::AddUniqueItem(const string& strFeature) {
void cTree::AddUniqueItem(const string &strFeature) {
auto it = std::find(FinalList.begin(), FinalList.end(), strFeature);
if (it == FinalList.end()) {
FinalList.push_back(strFeature);
Expand Down
36 changes: 23 additions & 13 deletions efel/cppcore/FillFptrTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,29 @@ int FillFptrTable() {
FptrTableV5["ISI_log_slope_skip"] = &LibV5::ISI_log_slope_skip;
FptrTableV5["time_to_second_spike"] = &LibV5::time_to_second_spike;
FptrTableV5["time_to_last_spike"] = &LibV5::time_to_last_spike;
FptrTableV5["inv_first_ISI"] = [](mapStr2intVec& intData, mapStr2doubleVec& doubleData, mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 0);
FptrTableV5["inv_first_ISI"] = [](mapStr2intVec& intData,
mapStr2doubleVec& doubleData,
mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 0);
};
FptrTableV5["inv_second_ISI"] = [](mapStr2intVec& intData, mapStr2doubleVec& doubleData, mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 1);
FptrTableV5["inv_second_ISI"] = [](mapStr2intVec& intData,
mapStr2doubleVec& doubleData,
mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 1);
};
FptrTableV5["inv_third_ISI"] = [](mapStr2intVec& intData, mapStr2doubleVec& doubleData, mapStr2Str& strData) {
FptrTableV5["inv_third_ISI"] = [](mapStr2intVec& intData,
mapStr2doubleVec& doubleData,
mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 2);
};
FptrTableV5["inv_fourth_ISI"] = [](mapStr2intVec& intData, mapStr2doubleVec& doubleData, mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 3);
FptrTableV5["inv_fourth_ISI"] = [](mapStr2intVec& intData,
mapStr2doubleVec& doubleData,
mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 3);
};
FptrTableV5["inv_fifth_ISI"] = [](mapStr2intVec& intData, mapStr2doubleVec& doubleData, mapStr2Str& strData) {
FptrTableV5["inv_fifth_ISI"] = [](mapStr2intVec& intData,
mapStr2doubleVec& doubleData,
mapStr2Str& strData) {
return LibV5::inv_ISI_generic(intData, doubleData, strData, 4);
};
FptrTableV5["inv_last_ISI"] = &LibV5::inv_last_ISI;
Expand Down Expand Up @@ -178,8 +188,7 @@ int FillFptrTable() {
&LibV5::decay_time_constant_after_stim;
FptrTableV5["multiple_decay_time_constant_after_stim"] =
&LibV5::multiple_decay_time_constant_after_stim;
FptrTableV5["sag_time_constant"] =
&LibV5::sag_time_constant;
FptrTableV5["sag_time_constant"] = &LibV5::sag_time_constant;

FptrTableV5["ohmic_input_resistance_vb_ssse"] =
&LibV5::ohmic_input_resistance_vb_ssse;
Expand All @@ -188,7 +197,7 @@ int FillFptrTable() {
FptrTableV5["maximum_voltage_from_voltagebase"] =
&LibV5::maximum_voltage_from_voltagebase;
FptrTableV5["Spikecount_stimint"] = &LibV5::Spikecount_stimint;

FptrTableV5["peak_indices"] = &LibV5::peak_indices;
FptrTableV5["sag_amplitude"] = &LibV5::sag_amplitude;
FptrTableV5["sag_ratio1"] = &LibV5::sag_ratio1;
Expand All @@ -197,7 +206,8 @@ int FillFptrTable() {
FptrTableV5["AP_peak_downstroke"] = &LibV5::AP_peak_downstroke;
FptrTableV5["min_between_peaks_indices"] = &LibV5::min_between_peaks_indices;
FptrTableV5["min_between_peaks_values"] = &LibV5::min_between_peaks_values;
FptrTableV5["AP_width_between_threshold"] = &LibV5::AP_width_between_threshold;
FptrTableV5["AP_width_between_threshold"] =
&LibV5::AP_width_between_threshold;

FptrTableV5["burst_begin_indices"] = &LibV5::burst_begin_indices;
FptrTableV5["burst_end_indices"] = &LibV5::burst_end_indices;
Expand All @@ -214,7 +224,7 @@ int FillFptrTable() {
FptrTableV5["postburst_min_indices"] = &LibV5::postburst_min_indices;
FptrTableV5["postburst_min_values"] = &LibV5::postburst_min_values;
FptrTableV5["time_to_interburst_min"] = &LibV5::time_to_interburst_min;

//****************** end of FptrTableV5 *****************************

return 1;
Expand Down
Loading

0 comments on commit 4e6514b

Please sign in to comment.