bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESPluginFactory< C > Class Template Reference

#include <BESPluginFactory.h>

Inheritance diagram for BESPluginFactory< C >:
Inheritance graph
Collaboration diagram for BESPluginFactory< C >:
Collaboration graph

Public Member Functions

void add_mapping (const std::string &name, const std::string &library_name)
 
 BESPluginFactory (const BESPluginFactory &)=delete
 
 BESPluginFactory (const std::string &name, const std::string &library_name)
 
void dump (std::ostream &strm) const override
 dump the contents of this object to the specified ostream
 
C * get (const std::string &name)
 
const BESPluginFactoryoperator= (const BESPluginFactory &)=delete
 

Detailed Description

template<typename C>
class BESPluginFactory< C >

A Factory for objects whose implementations reside in shared objects designed to be loaded at run time. This uses the BESPlugin class to perform the actual instantiation of those objects; the role of this class is to maintain a mapping between the names of the SO libraries and the names of the C++ object implementations they hold.

See also
BESPlugin

Definition at line 56 of file BESPluginFactory.h.

Constructor & Destructor Documentation

◆ BESPluginFactory()

template<typename C>
BESPluginFactory< C >::BESPluginFactory ( const std::string & name,
const std::string & library_name )
inline

Make a BESPluginFactory and set up a single entry. configure other entries using the add_mapping() method.

Parameters
nameUse name to get an instance of the child defined in library_name.
library_nameThe name of the library which contains the child class implementation.
See also
add_mapping.

Definition at line 68 of file BESPluginFactory.h.

Member Function Documentation

◆ add_mapping()

template<typename C>
void BESPluginFactory< C >::add_mapping ( const std::string & name,
const std::string & library_name )
inline

Add a mapping of name to library_name to the BESPluginFactory.

Parameters
nameThe child object's name.
library_nameThe name of the library which holds its implementation.

Definition at line 83 of file BESPluginFactory.h.

◆ dump()

template<typename C>
void BESPluginFactory< C >::dump ( std::ostream & strm) const
inlineoverridevirtual

dump the contents of this object to the specified ostream

This method is implemented by all derived classes to dump their contents, in other words, any state they might have, private variables, etc...

The inline function below can be used to dump the contents of an OPeNDAPObj object. For example, the object Animal is derived from BESObj. A user could do the following:

Animal *a = new dog( "Sparky" ) ; cout << a << endl ;

And the dump method for dog could display the name passed into the constructor, the (this) pointer of the object, etc...

Parameters
strmC++ i/o stream to dump the object to

Implements BESObj.

Definition at line 107 of file BESPluginFactory.h.

◆ get()

template<typename C>
C * BESPluginFactory< C >::get ( const std::string & name)
inline

Use the BESPluginFactory to get an instance of the class C matched to name. Once the name name has been bound to a SO library library_name, this method can be used to get an instance of the object whose implementation is in the SO file using only the name name.

Parameters
nameThe name registered with the implementation of a child of the class C using either the PlugFactory ctor or the add_mapping method.
Exceptions
NoSuchObjectthrown if name has not been registered.

Definition at line 99 of file BESPluginFactory.h.


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