From: barate Date: Wed, 20 Apr 2011 15:35:28 +0000 (+0000) Subject: Added method to test the presence of a BatchManager Factory X-Git-Tag: V1_3_0rc3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b7580718472d885a7f66f9cdf8980e0bdc617df8;p=tools%2Flibbatch.git Added method to test the presence of a BatchManager Factory --- diff --git a/src/Core/Batch_BatchManagerCatalog.cxx b/src/Core/Batch_BatchManagerCatalog.cxx index c5fc992..3d6fc43 100644 --- a/src/Core/Batch_BatchManagerCatalog.cxx +++ b/src/Core/Batch_BatchManagerCatalog.cxx @@ -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; } diff --git a/src/Core/Batch_BatchManagerCatalog.hxx b/src/Core/Batch_BatchManagerCatalog.hxx index 7286c59..295ea27 100644 --- a/src/Core/Batch_BatchManagerCatalog.hxx +++ b/src/Core/Batch_BatchManagerCatalog.hxx @@ -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 * dict();