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

AIDA_XMLStoreFactory.cpp

Go to the documentation of this file.
00001 #include "AIDA_XMLStoreFactory.h"
00002 #include "AIDA_StoreXML.h"
00003 #include "AIDA_Dev/IDevAnalysisFactory.h"
00004 
00005 static Anaphe::AIDA_XMLStore::AIDA_XMLStoreFactory factory;
00006 
00007 namespace Anaphe {
00008   namespace AIDA_XMLStore {
00009     class Initializer {
00010     public:
00011       Initializer() {
00012         AIDA::Dev::IDevAnalysisFactory* af = dynamic_cast<AIDA::Dev::IDevAnalysisFactory*>( AIDA_createAnalysisFactory() );
00013         if ( af ) {
00014           af->registerStoreFactory( static_cast< AIDA::Dev::IStoreFactory* >( &factory ), "XML" );
00015           delete af;
00016          }
00017       }
00018       ~Initializer() {}
00019     };
00020   }
00021 }
00022 
00023 static Anaphe::AIDA_XMLStore::Initializer myInitializer;
00024 
00025 
00026 #ifdef XML_STORE_NO_EXCEPTIONS_TO_USER
00027 #include <exception>
00028 #include <iostream>
00029 #define XML_STORE_REPORT_ERROR( XXX ) std::cerr << XXX << std::endl
00030 #endif
00031 
00032 
00033 Anaphe::AIDA_XMLStore::AIDA_XMLStoreFactory::AIDA_XMLStoreFactory()
00034 {}
00035 
00036 Anaphe::AIDA_XMLStore::AIDA_XMLStoreFactory::~AIDA_XMLStoreFactory()
00037 {}
00038 
00039 
00040 AIDA::Dev::IStore*
00041 Anaphe::AIDA_XMLStore::AIDA_XMLStoreFactory::createStore( const std::string & storeName,
00042                                                           bool readOnly,
00043                                                           bool createNew,
00044                                                           const std::string & options )
00045 {
00046 #ifdef XML_STORE_NO_EXCEPTIONS_TO_USER
00047   try {
00048 #endif
00049     return new Anaphe::AIDA_XMLStore::AIDA_StoreXML( storeName, readOnly, createNew, options );
00050 #ifdef XML_STORE_NO_EXCEPTIONS_TO_USER
00051   }
00052   catch ( std::exception& e ) {
00053     XML_STORE_REPORT_ERROR( e.what() );
00054     return 0;
00055   }
00056 #endif
00057 }
00058 
00059 
00060 bool
00061 Anaphe::AIDA_XMLStore::AIDA_XMLStoreFactory::destroyStore( AIDA::Dev::IStore* store )
00062 {
00063   if ( store ) {
00064     delete store;
00065     return true;
00066   }
00067   else {
00068     return false;
00069   }
00070 }
00071 

Generated on Tue Nov 19 12:32:56 2002 for AIDA_XMLStore by doxygen1.2.16