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

@ -14,6 +14,7 @@ namespace file_analysis {
class File;
class Analyzer;
class Manager;
/**
* Component description for plugins providing file analyzers.
@ -25,6 +26,7 @@ class Component : public plugin::Component,
public plugin::TaggedComponent<file_analysis::Tag> {
public:
typedef Analyzer* (*factory_callback)(RecordVal* args, File* file);
using factory_function = Analyzer* (*)(IntrusivePtr<RecordVal> args, File* file);
/**
* Constructor.
@ -45,6 +47,9 @@ public:
* analyzer instances can accordingly access it via analyzer::Tag().
* If not used, leave at zero.
*/
Component(const std::string& name, factory_function factory, Tag::subtype_t subtype = 0);
[[deprecated("Remove in v4.1. Use factory_function w/ IntrusivePtr args")]]
Component(const std::string& name, factory_callback factory, Tag::subtype_t subtype = 0);
/**
@ -62,6 +67,10 @@ public:
/**
* Returns the analyzer's factory function.
*/
factory_function FactoryFunction() const
{ return factory_func; }
[[deprecated("Remove in v4.1. Use FactoryFunction().")]]
factory_callback Factory() const { return factory; }
protected:
@ -71,7 +80,10 @@ protected:
void DoDescribe(ODesc* d) const override;
private:
factory_callback factory; // The analyzer's factory callback.
friend class file_analysis::Manager;
factory_callback factory; // The analyzer's factory callback (deprecated).
factory_function factory_func; // The analyzer's factory callback.
};
}