mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 02:58:20 +00:00
many helper functions
This commit is contained in:
parent
3654060246
commit
d7a3b85fcd
6 changed files with 245 additions and 31 deletions
|
@ -1,3 +1,4 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#ifndef INPUTREADERASCII_H
|
||||
#define INPUTREADERASCII_H
|
||||
|
@ -5,6 +6,19 @@
|
|||
#include "InputReader.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
// Description for input field mapping
|
||||
struct FieldMapping {
|
||||
string name;
|
||||
TypeTag type;
|
||||
int position;
|
||||
|
||||
FieldMapping(const string& arg_name, const TypeTag& arg_type, int arg_position);
|
||||
FieldMapping(const FieldMapping& arg);
|
||||
FieldMapping() { position = -1; }
|
||||
bool IsEmpty() { return position == -1; }
|
||||
};
|
||||
|
||||
|
||||
class InputReaderAscii : public InputReader {
|
||||
|
@ -19,11 +33,19 @@ protected:
|
|||
virtual bool DoInit(string path, int num_fields,
|
||||
const LogField* const * fields);
|
||||
virtual void DoFinish();
|
||||
|
||||
virtual bool DoUpdate();
|
||||
|
||||
private:
|
||||
|
||||
ifstream* file;
|
||||
string fname;
|
||||
|
||||
unsigned int num_fields;
|
||||
|
||||
// map columns in the file to columns to send back to the manager
|
||||
vector<FieldMapping> columnMap;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue