Newer
Older
#ifndef MANTID_KERNEL_PROPERTYMANAGER_H_
#define MANTID_KERNEL_PROPERTYMANAGER_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
Russell Taylor
committed
#include <vector>
//#include "MantidKernel/PropertyWithValue.h"
#include "MantidKernel/IPropertyManager.h"
Sofia Antony
committed
//#include "MantidAPI/Sample.h"
namespace Mantid
{
namespace Kernel
{
Russell Taylor
committed
//----------------------------------------------------------------------
// Forward Declaration
//----------------------------------------------------------------------
class Logger;
Russell Taylor
committed
/** @class PropertyManager PropertyManager.h Kernel/PropertyManager.h
Property manager helper class.
This class is used by algorithms and services for helping to manage their own set of properties.
Russell Taylor
committed
N.B. ONCE YOU HAVE DECLARED A PROPERTY TO THE MANAGER IT IS OWNED BY THIS CLASS (I.E. DON'T DELETE IT!)
Russell Taylor
committed
Property values of any type except std::string can be extracted using getProperty().
For assignment of string properties it is necessary to use getPropertyValue().
@author Russell Taylor, Tessella Support Services plc
@author Based on the Gaudi class PropertyMgr (see http://proj-gaudi.web.cern.ch/proj-gaudi/)
@date 20/11/2007
Russell Taylor
committed
Copyright © 2007-8 STFC Rutherford Appleton Laboratory
This file is part of Mantid.
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.
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Russell Taylor
committed
File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport PropertyManager: virtual public IPropertyManager
Sofia Antony
committed
PropertyManager();
virtual ~PropertyManager();
// Function to declare properties (i.e. store them)
Steve Williams
committed
void declareProperty( Property *p, const std::string &doc="" );
Russell Taylor
committed
// Sets all the declared properties from
void setProperties(const std::string &propertiesArray);
void setPropertyValue(const std::string &name, const std::string &value);
void setPropertyOrdinal(const int &index, const std::string &value);
bool existsProperty(const std::string &name) const;
bool validateProperties() const;
std::string getPropertyValue(const std::string &name) const;
const std::vector< Property*>& getProperties() const;
/// Get the value of a property
TypedValue getProperty(const std::string &name) const;
Russell Taylor
committed
protected:
Russell Taylor
committed
using IPropertyManager::declareProperty;
friend class PropertyManagerOwner;
Property* getPointerToProperty(const std::string &name) const;
Property* getPointerToPropertyOrdinal(const int &index) const;
Sofia Antony
committed
Sofia Antony
committed
/// Private copy constructor.
//PropertyManager(PropertyManager&);
Russell Taylor
committed
/// Private copy assignment operator.
Sofia Antony
committed
// PropertyManager& operator=(const PropertyManager&);
/// typedef for the map holding the properties
typedef std::map<std::string, Property*> PropertyMap;
/// The properties under management
PropertyMap m_properties;
/// Stores the order that the properties were declared in
std::vector<Property*> m_orderedProperties;
Russell Taylor
committed
/// Static reference to the logger class
static Logger& g_log;
Russell Taylor
committed
};
} // namespace Kernel
} // namespace Mantid
#endif /*MANTID_KERNEL_PROPERTYMANAGER_H_*/