Newer
Older
#ifndef MANTID_API_FRAMEWORKMANAGER_H_
#define MANTID_API_FRAMEWORKMANAGER_H_
Peterson, Peter
committed
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include <string>
Russell Taylor
committed
#ifdef MPI_BUILD
#include <boost/mpi/environment.hpp>
#endif
Gigg, Martyn Anthony
committed
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/FileLoaderRegistry.h"
Peterson, Peter
committed
#include "MantidKernel/SingletonHolder.h"
Janik Zikovsky
committed
#include <boost/shared_ptr.hpp>
Russell Taylor
committed
Peterson, Peter
committed
namespace Mantid
{
Gigg, Martyn Anthony
committed
namespace API
{
//----------------------------------------------------------------------
// Forward declarations
//----------------------------------------------------------------------
class IAlgorithm;
class Workspace;
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/** The main public API via which users interact with the Mantid framework.
Peterson, Peter
committed
Russell Taylor
committed
@author Russell Taylor, Tessella Support Services plc
@date 05/10/2007
Peterson, Peter
committed
Russell Taylor
committed
Copyright © 2007-2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Peterson, Peter
committed
Russell Taylor
committed
This file is part of Mantid.
Peterson, Peter
committed
Russell Taylor
committed
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Peterson, Peter
committed
Russell Taylor
committed
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Peterson, Peter
committed
Russell Taylor
committed
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Peterson, Peter
committed
File change history is stored at: <https://github.com/mantidproject/mantid>.
Russell Taylor
committed
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
Gigg, Martyn Anthony
committed
class MANTID_API_DLL FrameworkManagerImpl
Gigg, Martyn Anthony
committed
{
public:
/// Set the number of OpenMP threads to use based on the config value
void setNumOMPThreadsToConfigValue();
/// Set the number of OpenMP threads to the given value
void setNumOMPThreads(const int nthreads);
/// Returns the number of OpenMP threads that will be used
int getNumOMPThreads() const;
Gigg, Martyn Anthony
committed
/// Clears all memory associated with the AlgorithmManager, ADS & IDS
void clear();
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Clear memory associated with the AlgorithmManager
void clearAlgorithms();
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Clear memory associated with the ADS
void clearData();
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Clear memory associated with the IDS
Russell Taylor
committed
void clearInstruments();
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Creates and instance of an algorithm
IAlgorithm* createAlgorithm(const std::string& algName, const int& version=-1);
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Creates an instance of an algorithm and sets the properties provided
IAlgorithm* createAlgorithm(const std::string& algName, const std::string& propertiesArray,const int& version=-1);
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
/// Creates an instance of an algorithm, sets the properties provided & then executes it.
IAlgorithm* exec(const std::string& algName, const std::string& propertiesArray,const int& version=-1);
Peterson, Peter
committed
Janik Zikovsky
committed
/// Creates an algorithm and runs it, with variadic arguments
boost::shared_ptr<IAlgorithm> exec(const std::string& algorithmName, int count, ...);
Gigg, Martyn Anthony
committed
/// Returns a shared pointer to the workspace requested
Workspace* getWorkspace(const std::string& wsName);
Peterson, Peter
committed
/// Deletes a workspace from the framework
bool deleteWorkspace(const std::string& wsName);
Gigg, Martyn Anthony
committed
private:
friend struct Mantid::Kernel::CreateUsingNew<FrameworkManagerImpl>;
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
///Private Constructor
FrameworkManagerImpl();
///Private Destructor
Russell Taylor
committed
~FrameworkManagerImpl();
Gigg, Martyn Anthony
committed
/// Private copy constructor - NO COPY ALLOWED
FrameworkManagerImpl(const FrameworkManagerImpl&);
/// Private assignment operator - NO ASSIGNMENT ALLOWED
FrameworkManagerImpl& operator = (const FrameworkManagerImpl&);
/// Set up the global locale
void setGlobalLocaleToAscii();
/// Load the plugins
void loadAllPlugins();
/// Load a set of plugins
void loadPluginsUsingKey(const std::string & key);
/// Silence NeXus output
void disableNexusOutput();
Peterson, Peter
committed
#ifdef MPI_BUILD
Russell Taylor
committed
/** Member variable that initialises the MPI environment on construction (in the
* FrameworkManager constructor) and finalises it on destruction.
* The class has no non-static member functions, so is not exposed in the class interface.
*/
boost::mpi::environment m_mpi_environment;
#endif
Gigg, Martyn Anthony
committed
};
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it.
Peterson, Peter
committed
#ifdef _WIN32
Russell Taylor
committed
// this breaks new namespace declaration rules; need to find a better fix
Gigg, Martyn Anthony
committed
template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<FrameworkManagerImpl>;
Peterson, Peter
committed
#endif /* _WIN32 */
Gigg, Martyn Anthony
committed
typedef MANTID_API_DLL Mantid::Kernel::SingletonHolder<FrameworkManagerImpl> FrameworkManager;
Peterson, Peter
committed
Gigg, Martyn Anthony
committed
} // namespace Kernel
Peterson, Peter
committed
} // namespace Mantid
#endif /*MANTID_API_FRAMEWORKMANAGER_H_*/