File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -74,4 +74,25 @@ std::vector<T> filterEntity(const extractor &input, FN ff) {
74
74
return res;
75
75
}
76
76
77
+ template <typename T, typename FN>
78
+ std::vector<T> filterFeature (const extractor &input, FN ff) {
79
+ std::vector<T> res;
80
+
81
+ switch (input.num <uint8_t >(2 )) {
82
+ case switchFilter::AcceptAll:
83
+ res = ff (nix::util::AcceptAll<T>());
84
+ break ;
85
+ case switchFilter::Id:
86
+ res = ff (nix::util::IdFilter<T>(input.str (3 )));
87
+ break ;
88
+ case switchFilter::Ids:
89
+ // this will crash matlab, if its not a vector of strings...
90
+ res = ff (nix::util::IdsFilter<T>(input.vec <std::string>(3 )));
91
+ break ;
92
+ default : throw std::invalid_argument (" unknown or unsupported filter" );
93
+ }
94
+
95
+ return res;
96
+ }
97
+
77
98
#endif
You can’t perform that action at this time.
0 commit comments