Moving component's CanonicalName() method into base class.

This commit is contained in:
Robin Sommer 2014-07-12 18:31:00 -07:00
parent 9616cd8e61
commit 6d9e261384
6 changed files with 10 additions and 20 deletions

View file

@ -12,7 +12,6 @@ Component::Component(const std::string& name, factory_callback arg_factory, Tag:
: plugin::Component(plugin::component::ANALYZER, name), : plugin::Component(plugin::component::ANALYZER, name),
plugin::TaggedComponent<analyzer::Tag>(arg_subtype) plugin::TaggedComponent<analyzer::Tag>(arg_subtype)
{ {
canon_name = canonify_name(name);
factory = arg_factory; factory = arg_factory;
enabled = arg_enabled; enabled = arg_enabled;
partial = arg_partial; partial = arg_partial;

View file

@ -63,14 +63,6 @@ public:
*/ */
~Component(); ~Component();
/**
* Returns a canonocalized version of the analyzer's name. The
* returned name is derived from what's passed to the constructor but
* upper-cased and transformed to allow being part of a script-level
* ID.
*/
const std::string& CanonicalName() const { return canon_name; }
/** /**
* Returns the analyzer's factory function. * Returns the analyzer's factory function.
*/ */
@ -104,7 +96,6 @@ protected:
virtual void DoDescribe(ODesc* d) const; virtual void DoDescribe(ODesc* d) const;
private: private:
std::string canon_name; // The analyzer's canonical name.
factory_callback factory; // The analyzer's factory callback. factory_callback factory; // The analyzer's factory callback.
bool partial; // True if the analyzer supports partial connections. bool partial; // True if the analyzer supports partial connections.
bool enabled; // True if the analyzer is enabled. bool enabled; // True if the analyzer is enabled.

View file

@ -12,7 +12,6 @@ Component::Component(const std::string& name, factory_callback arg_factory, Tag:
: plugin::Component(plugin::component::FILE_ANALYZER, name), : plugin::Component(plugin::component::FILE_ANALYZER, name),
plugin::TaggedComponent<file_analysis::Tag>(subtype) plugin::TaggedComponent<file_analysis::Tag>(subtype)
{ {
canon_name = canonify_name(name);
factory = arg_factory; factory = arg_factory;
file_mgr->RegisterComponent(this, "ANALYZER_"); file_mgr->RegisterComponent(this, "ANALYZER_");

View file

@ -54,14 +54,6 @@ public:
*/ */
~Component(); ~Component();
/**
* Returns a canonocalized version of the analyzer's name. The
* returned name is derived from what's passed to the constructor but
* upper-cased and transformed to allow being part of a script-level
* ID.
*/
const std::string& CanonicalName() const { return canon_name; }
/** /**
* Returns the analyzer's factory function. * Returns the analyzer's factory function.
*/ */
@ -74,7 +66,6 @@ protected:
virtual void DoDescribe(ODesc* d) const; virtual void DoDescribe(ODesc* d) const;
private: private:
std::string canon_name; // The analyzer's canonical name.
factory_callback factory; // The analyzer's factory callback. factory_callback factory; // The analyzer's factory callback.
}; };

View file

@ -11,6 +11,7 @@ Component::Component(component::Type arg_type, const std::string& arg_name)
{ {
type = arg_type; type = arg_type;
name = arg_name; name = arg_name;
canon_name = canonify_name(name);
} }
Component::~Component() Component::~Component()

View file

@ -55,6 +55,14 @@ public:
*/ */
const std::string& Name() const; const std::string& Name() const;
/**
* Returns a canonocalized version of the components's name. The
* returned name is derived from what's passed to the constructor but
* upper-cased and transformed to allow being part of a script-level
* ID.
*/
const std::string& CanonicalName() const { return canon_name; }
/** /**
* Returns a textual representation of the component. This goes into * Returns a textual representation of the component. This goes into
* the output of "bro -NN". * the output of "bro -NN".
@ -83,6 +91,7 @@ private:
component::Type type; component::Type type;
std::string name; std::string name;
std::string canon_name;
}; };
} }