Scanner C++ API
column_enumerator.h
1 /* Copyright 2018 Carnegie Mellon University
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "scanner/api/enumerator.h"
17 
18 #include "storehouse/storage_backend.h"
19 #include "scanner/engine/video_index_entry.h"
20 #include "scanner/engine/table_meta_cache.h"
21 
22 #include <glog/logging.h>
23 #include <vector>
24 
25 namespace scanner {
26 namespace internal {
27 
28 class ColumnEnumerator : public Enumerator {
29  public:
30  ColumnEnumerator(const EnumeratorConfig& config);
31 
32  i64 total_elements() override;
33 
34  ElementArgs element_args_at(i64 element_idx) override;
35 
36  void set_table_meta(TableMetaCache* cache);
37 
38  private:
39  Result valid_;
40  std::string table_name_;
41  std::string column_name_;
42  TableMetaCache* table_metadata_; // Caching table metadata
43  i32 table_id_;
44  i32 column_id_;
45 
46  i64 total_rows_;
47 };
48 
49 }
50 } // namespace scanner
Interface for enumerating available data from a data source.
Definition: enumerator.h:42
Definition: enumerator.h:34
Definition: column_enumerator.h:28
Parameters provided at instantiation of an enumerator.
Definition: enumerator.h:29
Definition: database.cpp:36
Definition: table_meta_cache.h:26
ElementArgs element_args_at(i64 element_idx) override
Returns the data that can be used by a Source to load the element at this index.
Definition: column_enumerator.cpp:46