当前位置: 首页>>代码示例>>C++>>正文


C++ Query::get_operator方法代码示例

本文整理汇总了C++中Query::get_operator方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::get_operator方法的具体用法?C++ Query::get_operator怎么用?C++ Query::get_operator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query::get_operator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: send_result_row_to_nqxe

		void send_result_row_to_nqxe(
				Processor::query_id_t query_id,
				Processor::operator_id_t operator_id,
				Processor::RowT& row
		) {
			block_data_t msg[100];

			/*
		void on_result_row(int type, QueryProcessor::size_type cols, QueryProcessor::RowT& row,
				QueryProcessor::query_id_t qid, QueryProcessor::operator_id_t oid) {
			*/
			
			typedef Processor::BasicOperator BasicOperator;
			
			Query *q = ian_.get_query(query_id);
			if(!q) {
				debug_->debug("!q %d", (int)query_id);
				return;
			}
			BasicOperator *op = q->get_operator(operator_id);
			if(!op) {
				debug_->debug("!op %d", (int)operator_id);
				return;
			}
			
			int cols = op->projection_info().columns();
			if(op->type() == Processor::BOD::AGGREGATE) {
				Processor::AggregateT *aggr = (Processor::AggregateT*)op;
				//int cols = op-> projection_info().columns();
				//cols = aggr->columns_physical();
				cols = aggr->columns_logical();
			}
			
			int msglen =  1 + 1 + 1 + 1 + 4*cols;
			block_data_t chk = 0;
			msg[0] = 'R';
			msg[1] = 2 + 4 * cols; // # bytes to follow after this one
			msg[2] = query_id;
			msg[3] = operator_id;
			
			if(op->type() == Processor::BOD::AGGREGATE) {
				Processor::AggregateT *aggr = (Processor::AggregateT*)op;
				int j = 0; // physical column
				for(int i = 0; i< cols; i++, j++) { // logical column
					//printf("tach %d", Processor::AggregateT::AD::AGAIN);
					if((aggr->aggregation_types()[i] & ~AGAIN) == AggregateT::AD::AVG) {
						j++;
					}
					
					Value v;
					memcpy(&v, &row[j], sizeof(Value));
					wiselib::write<Os, block_data_t, Processor::Value>(msg + 4 + 4*i, v);
				}
			}
			else {
				for(int i = 0; i< cols; i++) {
					Value v;
					memcpy(&v, &row[i], sizeof(Value));
					wiselib::write<Os, block_data_t, Processor::Value>(msg + 4 + 4*i, v);
				}
			}
			
			for(int i = 0; i<msglen; i++) { chk ^= msg[i]; }
			msg[msglen] = chk;
			uart_->write(msglen + 1, (Os::Uart::block_data_t*)msg);

		} // send_result_row_to_nqxe()
开发者ID:FaddliLWibowo,项目名称:wiselib,代码行数:67,代码来源:example_app.cpp


注:本文中的Query::get_operator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。