18 #include "scanner/api/kernel.h" 19 #include "scanner/api/enumerator.h" 20 #include "scanner/util/common.h" 21 #include "scanner/util/profiler.h" 22 #include "scanner/util/storehouse.h" 30 std::vector<std::string> output_columns;
31 std::vector<proto::ColumnType> output_column_types;
34 storehouse::StorageConfig* storage_config;
54 virtual void validate(proto::Result* result) { result->set_success(
true); }
68 virtual void read(
const std::vector<ElementArgs>& args,
69 BatchedElements& output_columns) = 0;
89 using SourceConstructor =
90 std::function<Source*(const SourceConfig& config)>;
101 SourceBuilder(
const std::string& name, SourceConstructor constructor)
103 constructor_(constructor) {}
106 ColumnType type = ColumnType::Bytes) {
107 if (output_columns_.size() > 0) {
108 LOG(FATAL) <<
"Sources can only have one output column.";
110 output_columns_.push_back(std::make_tuple(name, type));
115 return output(name, ColumnType::Video);
119 protobuf_name_ = name;
125 SourceConstructor constructor_;
126 std::vector<std::tuple<std::string, ColumnType>> output_columns_;
127 std::string protobuf_name_;
131 #define REGISTER_SOURCE(name__, source__) \ 132 REGISTER_SOURCE_HELPER(__COUNTER__, name__, source__) 134 #define REGISTER_SOURCE_HELPER(uid__, name__, source__) \ 135 REGISTER_SOURCE_UID(uid__, name__, source__) 137 #define REGISTER_SOURCE_UID(uid__, name__, source__) \ 138 static ::scanner::internal::SourceRegistration source_registration_##uid__ \ 139 __attribute__((unused)) = ::scanner::internal::SourceBuilder( \ 140 #name__, [](const ::scanner::SourceConfig& config) { \ 141 return new source__(config); \
Parameters provided at instantiation of Source node.
Definition: source.h:29
Interface for reading data in a computation graph.
Definition: source.h:43
i32 node_id
Byte-string of proto args if given.
Definition: source.h:33
Definition: profiler.h:40
virtual void set_profiler(Profiler *profiler)
For internal use.
Definition: source.h:74
virtual void validate(proto::Result *result)
Checks if Source arguments are valid.
Definition: source.h:54
Definition: database.cpp:36