Salome HOME
Added method to test the presence of a BatchManager Factory V1_3_0rc3
authorbarate <barate>
Wed, 20 Apr 2011 15:35:28 +0000 (15:35 +0000)
committerbarate <barate>
Wed, 20 Apr 2011 15:35:28 +0000 (15:35 +0000)
src/Core/Batch_BatchManagerCatalog.cxx
src/Core/Batch_BatchManagerCatalog.hxx

index c5fc99206a418563b78bd0105392c971e3337444..3d6fc43205ecf8f6d6ebcf467ef77c0289fad663 100644 (file)
@@ -70,11 +70,20 @@ namespace Batch {
     }
   }
 
+  bool BatchManagerCatalog::hasFactBatchManager(const char * type)
+  {
+    pthread_mutex_lock(&_mutex);
+    bool result = (_catalog.find(type) != _catalog.end());
+    pthread_mutex_unlock(&_mutex);
+    return result;
+  }
+
   // Functor
   FactBatchManager * BatchManagerCatalog::operator() (const char * type)
   {
+    FactBatchManager * result = NULL;
     pthread_mutex_lock(&_mutex);
-    FactBatchManager * result = _catalog[type];
+    if (_catalog.find(type) != _catalog.end()) result = _catalog[type];
     pthread_mutex_unlock(&_mutex);
     return result;
   }
index 7286c5966704dc3e572a31dd844839ce57ce1119..295ea27339b14a174d1941d5af87f39faef7704f 100644 (file)
@@ -48,6 +48,7 @@ namespace Batch {
     static BatchManagerCatalog& getInstance();
 
     void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM);
+    bool hasFactBatchManager(const char * type);
     Batch::FactBatchManager * operator() (const char * type);
 
     virtual std::map<std::string, FactBatchManager *> * dict();