bes Updated for version 3.20.13
BESCatalogList Class Reference

List of all registered catalogs. More...

#include <BESCatalogList.h>

Collaboration diagram for BESCatalogList:
Collaboration graph

Public Types

typedef std::map< std::string, BESCatalog * >::const_iterator catalog_citer
 
typedef std::map< std::string, BESCatalog * >::iterator catalog_iter
 

Public Member Functions

virtual bool add_catalog (BESCatalog *catalog)
 adds the specified catalog to the list
 
 BESCatalogList ()
 construct a catalog list
 
virtual BESCatalogdefault_catalog () const
 The the default catalog.
 
virtual std::string default_catalog_name () const
 The name of the default catalog.
 
virtual bool deref_catalog (const std::string &catalog_name)
 
virtual void dump (std::ostream &strm) const
 dump the contents of this object to the specified ostream
 
virtual int empty () const
 
virtual catalog_citer end_catalog () const
 Iterator to the last catalog.
 
virtual BESCatalogfind_catalog (const std::string &catalog_name) const
 
virtual catalog_citer first_catalog () const
 Iterator to the first catalog.
 
virtual int num_catalogs () const
 The number of non-default catalogs.
 
virtual bool ref_catalog (const std::string &catalog_name)
 
virtual BESCatalogEntryshow_catalogs (BESCatalogEntry *entry, bool show_default=true)
 
virtual ~BESCatalogList ()
 list destructor deletes all registered catalogs
 

Static Public Member Functions

static BESCatalogListTheCatalogList ()
 Get the singleton BESCatalogList instance.
 

Friends

class BESCatalogListTest
 

Detailed Description

List of all registered catalogs.

Catalogs are a way of organizing data into a tree. Every BES daemon has at least one catalog, the default catalog (confusingly named 'catalog.') In general, this is the daemon's local file system.

Multiple BESCatalog objects can be registered with this list. However, most installations have a single catalog registered (the default catalog) which provides access to files on the host computer's local file system.

Each catalog in the list must have a unique name.

The BESCatalogList class is a singleton. The catalogs (represented by specializations of the BESCatalog class) are held in a reference-counted list. Handlers typically try to add the catalog they use, and if that fails because the catalog is already in the list, they increment its reference. See add_catalog() and ref_catalog(). When the singleton's instance is deleted, so are all of the catalogs, regardless of their reference count.

See also
BESCatalog

Definition at line 84 of file BESCatalogList.h.

Member Typedef Documentation

◆ catalog_citer

typedef std::map<std::string,BESCatalog*>::const_iterator BESCatalogList::catalog_citer

Definition at line 103 of file BESCatalogList.h.

◆ catalog_iter

typedef std::map<std::string,BESCatalog*>::iterator BESCatalogList::catalog_iter

Definition at line 102 of file BESCatalogList.h.

Constructor & Destructor Documentation

◆ BESCatalogList()

BESCatalogList::BESCatalogList ( )

construct a catalog list

See also
BESCatalog

Definition at line 114 of file BESCatalogList.cc.

◆ ~BESCatalogList()

BESCatalogList::~BESCatalogList ( )
virtual

list destructor deletes all registered catalogs

See also
BESCatalog

Definition at line 138 of file BESCatalogList.cc.

Member Function Documentation

◆ add_catalog()

bool BESCatalogList::add_catalog ( BESCatalog catalog)
virtual

adds the specified catalog to the list

Add a catalog to the list of catalogs. If a catalog with the same name already exists, don't add the BESCatalog instance (the test is limited to the BESCatalog object's name) and signal that by returning false. If the catalog was added, return true.

Parameters
catalogNew catalog to add to the list
Returns
false If a catalog with the given catalog's name already exists. Returns true otherwise.
See also
BESCatalog

Definition at line 162 of file BESCatalogList.cc.

◆ default_catalog()

virtual BESCatalog * BESCatalogList::default_catalog ( ) const
inlinevirtual

The the default catalog.

Definition at line 118 of file BESCatalogList.h.

◆ default_catalog_name()

virtual std::string BESCatalogList::default_catalog_name ( ) const
inlinevirtual

The name of the default catalog.

Definition at line 116 of file BESCatalogList.h.

◆ dump()

virtual void BESCatalogList::dump ( std::ostream &  strm) const
virtual

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.

◆ empty()

virtual int BESCatalogList::empty ( ) const
inlinevirtual

Definition at line 113 of file BESCatalogList.h.

◆ end_catalog()

virtual catalog_citer BESCatalogList::end_catalog ( ) const
inlinevirtual

Iterator to the last catalog.

Definition at line 133 of file BESCatalogList.h.

◆ first_catalog()

virtual catalog_citer BESCatalogList::first_catalog ( ) const
inlinevirtual

Iterator to the first catalog.

Definition at line 130 of file BESCatalogList.h.

◆ num_catalogs()

virtual int BESCatalogList::num_catalogs ( ) const
inlinevirtual

The number of non-default catalogs.

Todo:
Change this to include the default!

Definition at line 112 of file BESCatalogList.h.

◆ TheCatalogList()

BESCatalogList * BESCatalogList::TheCatalogList ( )
static

Get the singleton BESCatalogList instance.

This static method returns the instance of this singleton class. It uses the protected constructor below to read the name of the default catalog from the BES's configuration file, using the key "BES.Catalog.Default". If the key is not found or the key lookup fails for any reason, it uses the the value of BES_DEFAULT_CATALOG as defined in this class' header file (currently the confusing name "catalog").

The implementation will only build one instance of CatalogList and thereafter simple return that pointer.

For this code, the default catalog is implemented suing CatalogDirectory, which exposes the BES's local POSIX file system, rooted at a place set in the BES configuration file.

Returns
A pointer to the CatalogList singleton

Definition at line 81 of file BESCatalogList.cc.

Friends And Related Function Documentation

◆ BESCatalogListTest

friend class BESCatalogListTest
friend

Definition at line 99 of file BESCatalogList.h.


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