-/* ------------------------------------------------\r
-Copyright 2014 AT&T Intellectual Property\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
- ------------------------------------------- */\r
-\r
-#ifndef SELECTION_OPERATOR_H\r
-#define SELECTION_OPERATOR_H\r
-\r
-#include "host_tuple.h"\r
-#include "base_operator.h"\r
-#include <list>\r
-using namespace std;\r
-\r
-template <class select_project_functor> class select_project_operator :\r
- public base_operator\r
-{\r
-private :\r
- select_project_functor func;\r
-public:\r
-\r
- select_project_operator(int schema_handle, const char* name) : base_operator(name), func(schema_handle) { }\r
-\r
- virtual int accept_tuple(host_tuple& tup, list<host_tuple>& result) {\r
- host_tuple res;\r
-\r
- if (func.predicate(tup)) {\r
- res = func.create_output_tuple();\r
- res.channel = output_channel;\r
- result.push_back(res);\r
- } else {\r
- if (func.temp_status_received()) {\r
- if (!func.create_temp_status_tuple(res)) {\r
- res.channel = output_channel;\r
- result.push_back(res);\r
- }\r
- }\r
- }\r
- tup.free_tuple();\r
- return 0;\r
- }\r
-\r
- virtual int flush(list<host_tuple>& result) {\r
- return 0;\r
- }\r
-\r
- virtual int set_param_block(int sz, void * value) {\r
- func.set_param_block(sz, value);\r
- return 0;\r
- }\r
-\r
- virtual int get_temp_status(host_tuple& result) {\r
- result.channel = output_channel;\r
- return func.create_temp_status_tuple(result);\r
- }\r
-\r
- virtual int get_blocked_status () {\r
- return -1; // selection operators are not blocked on any input\r
- }\r
-};\r
-\r
-#endif // SELECTION_OPERATOR_H\r
+/* ------------------------------------------------
+Copyright 2014 AT&T Intellectual Property
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ------------------------------------------- */
+
+#ifndef SELECTION_OPERATOR_H
+#define SELECTION_OPERATOR_H
+
+#include "host_tuple.h"
+#include "base_operator.h"
+#include <list>
+using namespace std;
+
+template <class select_project_functor> class select_project_operator :
+ public base_operator
+{
+private :
+ select_project_functor func;
+public:
+
+ select_project_operator(int schema_handle, const char* name) : base_operator(name), func(schema_handle) { }
+
+ virtual int accept_tuple(host_tuple& tup, list<host_tuple>& result) {
+ host_tuple res;
+
+ if (func.predicate(tup)) {
+ res = func.create_output_tuple();
+ res.channel = output_channel;
+ result.push_back(res);
+ } else {
+ if (func.temp_status_received()) {
+ if (!func.create_temp_status_tuple(res)) {
+ res.channel = output_channel;
+ result.push_back(res);
+ }
+ }
+ }
+ tup.free_tuple();
+ return 0;
+ }
+
+ virtual int flush(list<host_tuple>& result) {
+ return 0;
+ }
+
+ virtual int set_param_block(int sz, void * value) {
+ func.set_param_block(sz, value);
+ return 0;
+ }
+
+ virtual int get_temp_status(host_tuple& result) {
+ result.channel = output_channel;
+ return func.create_temp_status_tuple(result);
+ }
+
+ virtual int get_blocked_status () {
+ return -1; // selection operators are not blocked on any input
+ }
+};
+
+#endif // SELECTION_OPERATOR_H