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

LCD_DocManager Class Reference

#include <LCD_DocManager.hh>

Collaboration diagram for LCD_DocManager:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

LCD_DocumentmakeDocument (const std::string &XMLfilespec)
int deleteDocument (LCD_Document *doc)
std::vector< LCD_Document * > * getLCD_Documents (XERCES_CPP_NAMESPACE::DOMString docTypeName=XERCES_CPP_NAMESPACE::DOMString("*"))
XERCES_CPP_NAMESPACE::DOM_Element getElement (XERCES_CPP_NAMESPACE::DOMString id, XERCES_CPP_NAMESPACE::DOMString elementName=XERCES_CPP_NAMESPACE::DOMString("*"), XERCES_CPP_NAMESPACE::DOMString docTypeName=XERCES_CPP_NAMESPACE::DOMString("*"))
LCD_DocumentgetLCDDoc (XERCES_CPP_NAMESPACE::DOM_Document domDoc)

Static Private Attributes

std::list< LCD_DocumentImpl * > * active = 0
bool initDone = false

Member Function Documentation

int LCD_DocManager::deleteDocument LCD_Document doc  )  [static]
 

Definition at line 56 of file LCD_DocManager.cc.

References active.

00056                                                      {
00057   // First check that we really were passed a LCD_DocumentImpl, not some other
00058   // class satisfying LCD_Document
00059   LCD_DocumentImpl *pDocImpl = dynamic_cast <LCD_DocumentImpl*>(pDoc);
00060   if ( pDocImpl ) {
00061     // see if we can find it among our list of docs
00062     std::list<LCD_DocumentImpl*>::iterator which;
00063 
00064     which = std::find(active->begin(), active->end(), pDocImpl);
00065     if (which != active->end()) {
00066 
00067       // delete it from list
00068       active->erase(which);
00069 
00070       // Actually get rid of it
00071       delete pDocImpl;
00072     }
00073     else {
00074       return 1;  // doc not found
00075     }
00076   }
00077   else {
00078     return 2;   // error code for bad arg.  Or throw an exception??
00079   }
00080   return 0;
00081 }

XERCES_CPP_NAMESPACE::DOM_Element LCD_DocManager::getElement XERCES_CPP_NAMESPACE::DOMString  id,
XERCES_CPP_NAMESPACE::DOMString  elementName = XERCES_CPP_NAMESPACE::DOMString("*"),
XERCES_CPP_NAMESPACE::DOMString  docTypeName = XERCES_CPP_NAMESPACE::DOMString("*")
[static]
 

std::vector<LCD_Document*>* LCD_DocManager::getLCD_Documents XERCES_CPP_NAMESPACE::DOMString  docTypeName = XERCES_CPP_NAMESPACE::DOMString("*")  )  [static]
 

LCD_Document* LCD_DocManager::getLCDDoc XERCES_CPP_NAMESPACE::DOM_Document  domDoc  )  [static]
 

LCD_Document * LCD_DocManager::makeDocument const std::string &  XMLfilespec  )  [static]
 

Definition at line 136 of file LCD_DocManager.cc.

References active, LCD_DocumentImpl::errReporter, LCD_DocErrorReporter::getErrorCount(), LCD_DocErrorReporter::getFatalCount(), initDone, and LCD_DocumentImpl::parse().

Referenced by LCDXML2G4DetConst::SetXMLFile().

00136                                                                        {
00137   LCD_DocumentImpl *pNewDoc;
00138 
00139   //  if (!initDone) {
00140   if (active == 0) {
00141     // Initialize the XML4C2 system
00142     try
00143       {
00144         XMLPlatformUtils::Initialize();
00145         active = new std::list<LCD_DocumentImpl*>;
00146         initDone = true;
00147       }
00148 
00149     // Help! what to do if this fails?
00150     // This sort of failure is probably fatal
00151     catch (const XMLException& toCatch)
00152       {
00153         cout << "Error during xml4c platform initialization! :\n"
00154              << toCatch.getMessage() << "\n";
00155         return 0;
00156       }
00157   }
00158 
00159   pNewDoc = new LCD_DocumentImpl(XMLfilespec);
00160 
00161   try {
00162     pNewDoc->parse();
00163 
00164   }
00165   catch (const XMLException& toCatch2) {  // can't parse document
00166     // help.
00167     // This sort of failure is maybe recoverable
00168     cout << toCatch2.getMessage() << "\n";
00169     delete pNewDoc;
00170     return 0;
00171   }
00172 
00173   // Did we get any errors?  If so, can't use the document
00174   if ((pNewDoc->errReporter->getErrorCount()) ||
00175       (pNewDoc->errReporter->getFatalCount())    ) {
00176     cout << "Invalid XML source; cannot create document\n";
00177     delete pNewDoc;
00178     return 0;
00179   }
00180 
00181   active->push_front(pNewDoc);
00182 
00183   return pNewDoc;
00184 }


Member Data Documentation

XERCES_CPP_NAMESPACE_USE std::list< LCD_DocumentImpl * > * LCD_DocManager::active = 0 [static, private]
 

Definition at line 49 of file LCD_DocManager.cc.

Referenced by deleteDocument(), and makeDocument().

bool LCD_DocManager::initDone = false [static, private]
 

Definition at line 50 of file LCD_DocManager.cc.

Referenced by makeDocument().


The documentation for this class was generated from the following files:
Generated on Thu Oct 7 18:45:04 2004 for LCDG4 by doxygen 1.3.4