Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

xmli::BuilderFac Class Reference

A factory for classes which build C++ objects from XML. More...

#include <BuilderFac.h>

List of all members.

Public Member Functions

void Register (const char *name, xmli::Builder *b)
BuilderGet (const char *name)
BuilderGet (const std::string &name)

Static Public Member Functions

BuilderFacInstance ()

Private Member Functions

 BuilderFac ()

Private Attributes

std::map< std::string, xmli::Builder * > fBuilders
 List of builders.


Static Private Attributes

BuilderFacfInstance = 0
 Sole instance of factory.


Detailed Description

A factory for classes which build C++ objects from XML.

Definition at line 15 of file BuilderFac.h.


Constructor & Destructor Documentation

xmli::BuilderFac::BuilderFac  )  [private]
 

Definition at line 64 of file BuilderFac.cxx.

00064 { }


Member Function Documentation

xmli::Builder * xmli::BuilderFac::Get const std::string &  name  ) 
 

Definition at line 53 of file BuilderFac.cxx.

References fBuilders.

00054 {
00055 //======================================================================
00056 // Pull builder for tag out of table
00057 //   name - XML tag we need a builder for
00058 //======================================================================
00059   return fBuilders[name];
00060 }

xmli::Builder * xmli::BuilderFac::Get const char *  name  ) 
 

Definition at line 42 of file BuilderFac.cxx.

Referenced by xmli::SAX2Handler::EndElement().

00043 {
00044 //======================================================================
00045 // Pull builder for tag out of table
00046 //   name - XML tag we need a builder for
00047 //======================================================================
00048   return this->Get(std::string(name));
00049 }

xmli::BuilderFac & xmli::BuilderFac::Instance  )  [static]
 

Definition at line 15 of file BuilderFac.cxx.

References fInstance.

Referenced by xmli::Builder::Builder(), and xmli::SAX2Handler::EndElement().

00016 {
00017 //======================================================================
00018 // Return the sole instance of the factory
00019 //======================================================================
00020   if (fInstance == 0) fInstance = new xmli::BuilderFac;
00021   return *fInstance;
00022 }

void xmli::BuilderFac::Register const char *  name,
xmli::Builder b
 

Definition at line 26 of file BuilderFac.cxx.

References fBuilders.

Referenced by xmli::Builder::Builder().

00027 {
00028 //======================================================================
00029 // Insert a builder b into the table.
00030 //   name - XML tag the builder handles
00031 //   b    - builder which handles tag
00032 //======================================================================
00033   std::string n(name);
00034   if (fBuilders[n] == 0) { fBuilders[n] = b; return; }
00035   // else
00036   std::cerr << "Builder for type '" << name << "' doublely defined.\n";
00037   abort();
00038 }


Member Data Documentation

std::map<std::string,xmli::Builder*> xmli::BuilderFac::fBuilders [private]
 

List of builders.

Definition at line 27 of file BuilderFac.h.

Referenced by Get(), and Register().

xmli::BuilderFac * xmli::BuilderFac::fInstance = 0 [static, private]
 

Sole instance of factory.

Definition at line 11 of file BuilderFac.cxx.

Referenced by Instance().


The documentation for this class was generated from the following files:
Generated on Fri Jul 25 02:05:55 2008 for NOvA Offline by doxygen 1.3.5