Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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 65 of file BuilderFac.cxx.

00065 { }


Member Function Documentation

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

Definition at line 54 of file BuilderFac.cxx.

References fBuilders.

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

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

Definition at line 43 of file BuilderFac.cxx.

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

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

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

Definition at line 16 of file BuilderFac.cxx.

References fInstance.

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

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

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

Definition at line 27 of file BuilderFac.cxx.

References fBuilders.

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

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


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 12 of file BuilderFac.cxx.

Referenced by Instance().


The documentation for this class was generated from the following files:
Generated on Sat Nov 21 04:45:39 2009 for NOvA Offline by  doxygen 1.3.9.1