Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

RepositoryDispatcher.h

Go to the documentation of this file.
00001 #ifndef Impala_Persistency_RepositoryDispatcher_h
00002 #define Impala_Persistency_RepositoryDispatcher_h
00003 
00004 #include "Basis/ILog.h"
00005 
00006 namespace Impala
00007 {
00008 namespace Persistency
00009 {
00010 
00011 
00015 template<class LocatorType, class DataType,
00016          class RepositoryInFileType, class RepositoryInMonetType>
00017 class RepositoryDispatcher
00018 {
00019 public:
00020 
00021     RepositoryDispatcher()
00022     {
00023     }
00024 
00025     DataType*
00026     Get(const LocatorType& loc)
00027     {
00028         String protocol = loc.GetProtocol();
00029         if ((protocol == "file") || (protocol == "dataServer"))
00030         {
00031             return mRepFile.Get(loc);
00032         }
00033         if (protocol == "mapi")
00034         {
00035             return mRepMonet.Get(loc);
00036         }
00037         ILOG_ERROR("Get: unknown protocol: [" << loc.GetProtocol() << "] in "
00038                    << loc);
00039         return 0;
00040     }
00041 
00042     void
00043     Add(const LocatorType& loc, DataType* data)
00044     {
00045         String protocol = loc.GetProtocol();
00046         if ((protocol == "file") || (protocol == "dataServer"))
00047         {
00048             return mRepFile.Add(loc, data);
00049         }
00050         if (protocol == "mapi")
00051         {
00052             return mRepMonet.Add(loc, data);
00053         }
00054         ILOG_ERROR("Add: unknown protocol: [" << loc.GetProtocol() << "] in "
00055                    << loc);
00056     }
00057 
00058 protected:
00059 
00060     RepositoryInFileType  mRepFile;
00061     RepositoryInMonetType mRepMonet;
00062 
00063     ILOG_VAR_DEC;
00064 };
00065 
00066 ILOG_VAR_INIT_TEMPL_4(RepositoryDispatcher, LocatorType, DataType,
00067                       RepositoryInFileType, RepositoryInMonetType,
00068                       Impala.Persistency);
00069 
00070 } // namespace Persistency
00071 } // namespace Impala
00072 
00073 #endif

Generated on Fri Mar 19 09:31:44 2010 for ImpalaSrc by  doxygen 1.5.1