Deprecate file analyzer construction methods taking raw RecordVal*

Replaced with versions that instead take IntrusivePtr
This commit is contained in:
Jon Siwek 2020-05-22 16:13:15 -07:00
parent ecb7c7c27e
commit 57a6069cd1
26 changed files with 164 additions and 79 deletions

View file

@ -11,15 +11,16 @@
using namespace file_analysis;
DataEvent::DataEvent(RecordVal* args, File* file,
DataEvent::DataEvent(IntrusivePtr<RecordVal> args, File* file,
EventHandlerPtr ce, EventHandlerPtr se)
: file_analysis::Analyzer(file_mgr->GetComponentTag("DATA_EVENT"),
args, file),
std::move(args), file),
chunk_event(ce), stream_event(se)
{
}
file_analysis::Analyzer* DataEvent::Instantiate(RecordVal* args, File* file)
file_analysis::Analyzer* DataEvent::Instantiate(IntrusivePtr<RecordVal> args,
File* file)
{
const auto& chunk_val = args->GetField("chunk_event");
const auto& stream_val = args->GetField("stream_event");
@ -35,7 +36,7 @@ file_analysis::Analyzer* DataEvent::Instantiate(RecordVal* args, File* file)
if ( stream_val )
stream = event_registry->Lookup(stream_val->AsFunc()->Name());
return new DataEvent(args, file, chunk, stream);
return new DataEvent(std::move(args), file, chunk, stream);
}
bool DataEvent::DeliverChunk(const u_char* data, uint64_t len, uint64_t offset)

View file

@ -43,7 +43,8 @@ public:
* @return the new DataEvent analyzer instance or a null pointer if
* no "chunk_event" or "stream_event" field was specfied in \a args.
*/
static file_analysis::Analyzer* Instantiate(RecordVal* args, File* file);
static file_analysis::Analyzer* Instantiate(IntrusivePtr<RecordVal> args,
File* file);
protected:
@ -56,7 +57,7 @@ protected:
* @param se pointer to event handler which will be called to receive
* sequential file data.
*/
DataEvent(RecordVal* args, File* file,
DataEvent(IntrusivePtr<RecordVal> args, File* file,
EventHandlerPtr ce, EventHandlerPtr se);
private: