Extension Library
The interaction between an application and RAMA extensions is moderated by the
interplay between the ExtDBase, ExtLoader, and ExtLibIface classes.
Applications use only the first of those (ExtDBase), and extensions use
only the last (ExtLibIface). These classes are templated to allow this library
to be used with any type of interface, not just RAMA-compatible ones.
Application
ExtDBase
A database list of possible extensions. The objects in the database
consist of the ExtLoaders. The database is implemented as an STL set
since the set allows only one loader per extension, and automatically
orders the loaders by (extension name, library name). See the source
code for information about the interface to the database.
ExtLoader
Loads an extension if necessary, and is used to make new instances of the
extension. The loader takes an instance of ExtLibIface that is defined
in the library.
Extension
ExtLibIface
The class defines the interface between and extension and an application.
It is automatically added and removed from the ExtDBase, when the library
is loaded and unloaded.
Some rules for extension creation
Static Library Extensions
-
The extension should be encapsulated in a namespace in order to be
compiled in without conflict with other libraries.
-
Most compilers will only load the objects in a library that have
references in a previously loaded object. A trick may be necessary
to get the extension library object to be linked in. See the libmacs.hh
file in the extlib library for an example.
Dynamic Library Extensions
-
A derived class of ExtLibIface must be defined in the shared library.
This class will automatically be added to the ExtDBase when it is
constructed. For this to work properly, the class should be instantiated
as a member of the namespace
Macros have been created to ease this process. There are two versions :
multiple or single extension library.
EXTLIB_DECL(x)
x is the name of the library. This is used when only a single extension is
included in the library.
EXTLIB_DEF(x, y)
x is the name of the library, y is the name of the single extension.
This version is used when there are multiple extensions in a library.
EXTLIB_DEF_MULTI(x, y)
x is the name of the library, y is the number of extensions in the library
Sequence of Events
-
Application boots
- ExtDBase is created
-
All static extensions' ExtLibIface class' are created
- Every ExtLibIface adds itself to to the ExtDBase
-
Runtime lib directory is scanned and libraries are loaded
- Each library that is loaded will add an ExtLibIface to the ExtDBase
For comments, concerns, problems, or interest in joining,
write RAMA Coordinator