Otawa  0.10
otawa::ProcessorPlugin Class Reference

This class must implemented by plugins containing processor, features and identifiers. More...

#include <otawa/proc/ProcessorPlugin.h>

Inheritance diagram for otawa::ProcessorPlugin:
otawa::display::Plugin otawa::display::GraphVizDriver

Public Member Functions

 ProcessorPlugin (cstring name, const elm::Version &version, const elm::Version &plugger_version)
 Build a new processor plugin. More...
 
 ~ProcessorPlugin (void)
 
virtual elm::genstruct::Table
< AbstractRegistration * > & 
processors (void) const
 This method must return the table of all processor available in the plugin. More...
 

Static Public Member Functions

static void addPath (const elm::system::Path &path)
 Add a path to the list of looked paths. More...
 
static void removePath (const elm::system::Path &path)
 Remove the given path from the looked path. More...
 
static ProcessorPluginget (string name)
 Find a plugin by its name. More...
 
static ProcessorgetProcessor (cstring name)
 Get a processor by its name, possibly loading required plugin. More...
 
static AbstractFeaturegetFeature (cstring name)
 Find a feature by its name, possibly loading a plugin. More...
 
static AbstractIdentifiergetIdentifier (cstring name)
 Find an identifier by its name possibly loading a plugin to get it. More...
 
static void setErrorHandler (ErrorHandler *error_handler)
 Set an error handler for the processor resolution plugger. More...
 
static ErrorHandlergetErrorHandler (void)
 Get the error handler of the processor resolution plugger. More...
 

Static Private Member Functions

static void init (void)
 Initialize the plugger. More...
 

Detailed Description

This class must implemented by plugins containing processor, features and identifiers.

Constructor & Destructor Documentation

otawa::ProcessorPlugin::ProcessorPlugin ( cstring  name,
const elm::Version version,
const elm::Version plugger_version 
)

Build a new processor plugin.

Parameters
nameName of the plugin (may be full-qualified C++ name with "::" or canonical name with "/").
versionVersion of the plugin.
plugger_versionVersion for the plugger interface (OTAWA_PROC_VERSION).
otawa::ProcessorPlugin::~ProcessorPlugin ( void  )

Member Function Documentation

void otawa::ProcessorPlugin::addPath ( const elm::system::Path &  path)
static

Add a path to the list of looked paths.

Parameters
pathPath to add.

References init().

Referenced by otawa::script::Script::work().

ProcessorPlugin * otawa::ProcessorPlugin::get ( string  name)
static

Find a plugin by its name.

The looked directories are, in order, "$PWD/.otawa/proc", "$HOME/.otawa/proc" or "$OTAWA_INSTALL_DIRECTORY/lib/otawa/proc". The full path name of the processor class must be passed in the name, something composed of "comp1::comp2::...::compn". First, a module whose path is by replacing in processor name "::" by "/" is looked. If not found, the last component of the path is removed and the obtained path is looked again for module. This process continue until the module is found or the path becomes empty resulting in a linkage failure.

Parameters
nameFull-qualified name of the processor.
Returns
Built processor or null if the processor cannot be found.

References _, init(), elm::String::lastIndexOf(), elm::level_error, elm::level_info, and elm::String::substring().

ErrorHandler * otawa::ProcessorPlugin::getErrorHandler ( void  )
static

Get the error handler of the processor resolution plugger.

Returns
Current error handler.

Referenced by otawa::script::Script::processWorkSpace().

AbstractFeature * otawa::ProcessorPlugin::getFeature ( cstring  name)
static

Find a feature by its name, possibly loading a plugin.

Parameters
nameName of the looked feature.
Returns
Found feature or null.

References getIdentifier(), and otawa::IS_FEATURE.

Referenced by otawa::DynFeature::init().

AbstractIdentifier * otawa::ProcessorPlugin::getIdentifier ( cstring  name)
static

Find an identifier by its name possibly loading a plugin to get it.

Parameters
nameName of the identifier.
Returns
Found identifier or null.

References otawa::AbstractIdentifier::find().

Referenced by otawa::XSLTScript::fillProps(), getFeature(), otawa::DynIdentifier< T >::id(), otawa::script::Script::makeConfig(), and otawa::Application::run().

Processor * otawa::ProcessorPlugin::getProcessor ( cstring  name)
static

Get a processor by its name, possibly loading required plugin.

Parameters
nameName of the looked processor.
Returns
An instance of the processor or NULL if it cannot be found.

References otawa::Registry::find(), otawa::AbstractRegistration::make(), and name.

Referenced by otawa::DynProcessor::DynProcessor().

void otawa::ProcessorPlugin::init ( void  )
staticprivate

Initialize the plugger.

References CSTR, otawa::MANAGER, and otawa::Manager::prefixPath().

Referenced by addPath(), get(), and removePath().

elm::genstruct::Table< AbstractRegistration * > & otawa::ProcessorPlugin::processors ( void  ) const
virtual

This method must return the table of all processor available in the plugin.

Returns
Table of available processors.

References elm::dtd::empty.

void otawa::ProcessorPlugin::removePath ( const elm::system::Path &  path)
static

Remove the given path from the looked path.

Parameters
pathPath to remove.

References init().

void otawa::ProcessorPlugin::setErrorHandler ( ErrorHandler error_handler)
static

Set an error handler for the processor resolution plugger.

Parameters
error_handlerNew error handler.

Referenced by otawa::script::Script::processWorkSpace().


The documentation for this class was generated from the following files: