Newer
Older
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Sample.h"
namespace Mantid
{
namespace API
{
/// Constructor
Sample::Sample() :
Gigg, Martyn Anthony
committed
m_name(), m_manager(), m_protonCharge(0.0), m_sample_shape(), m_geom_id(0), m_thick(0.0),
m_height(0.0), m_width(0.0)
Russell Taylor
committed
Sofia Antony
committed
/** copy constructor
* @param copy const reference to the sample object
Sofia Antony
committed
*/
Russell Taylor
committed
Sample::Sample(const Sample& copy) :
m_name(copy.m_name), m_manager(copy.m_manager), m_protonCharge(copy.m_protonCharge),
Russell Taylor
committed
m_sample_shape(copy.m_sample_shape), m_geom_id(copy.m_geom_id),
m_thick(copy.m_thick), m_height(copy.m_height), m_width(copy.m_width)
Russell Taylor
committed
{
}
Russell Taylor
committed
Sofia Antony
committed
/** assignment operator
* @param rhs const reference to the sample object
Sofia Antony
committed
*/
const Sample& Sample::operator=(const Sample&rhs)
Russell Taylor
committed
{
if (this == &rhs) return *this;
m_name = rhs.m_name;
Russell Taylor
committed
m_manager = rhs.m_manager;
Russell Taylor
committed
m_protonCharge = rhs.m_protonCharge;
Russell Taylor
committed
m_sample_shape = rhs.m_sample_shape;
Russell Taylor
committed
m_geom_id = rhs.m_geom_id;
m_thick = rhs.m_thick;
m_height = rhs.m_height;
m_width = rhs.m_width;
return *this;
}
/// Destructor
Sample::~Sample()
{
}
/** Set the name of the sample
* @param name The name to assign
*/
void Sample::setName( const std::string &name )
{
m_name = name;
}
/** Gets the name of the sample
* @return The name of the sample
*/
const std::string& Sample::getName() const
{
return m_name;
}
/** Add a set of data as read in from a log file.
* Note that the sample takes over ownership of the data, so the user should not delete it.
* @param p A pointer to the property (typically a TimeSeriesProperty) containing the data.
*/
void Sample::addLogData( Kernel::Property *p )
{
m_manager.declareProperty(p);
}
/** Retrieve a particular dataset
* @param name The name of the dataset (as contained in the original property object)
* @return A pointer to the property containing the dataset
*/
Kernel::Property* Sample::getLogData( const std::string &name ) const
{
return m_manager.getProperty(name);
}
/** Retrieve the full set of log properties
* @return A vector of pointers to the property objects
*/
const std::vector<Kernel::Property*>& Sample::getLogData() const
{
return m_manager.getProperties();
}
/** Set the good proton charge total for this run
* @param charge The proton charge in uA.hour
*/
void Sample::setProtonCharge( const double &charge)
{
m_protonCharge = charge;
}
/** Retrieve the total good proton charge delivered in this run
* @return The proton charge in uA.hour
*/
const double& Sample::getProtonCharge() const
{
return m_protonCharge;
}
Gigg, Martyn Anthony
committed
/**
* Set the object that describes the sample shape
* @param sample_shape The shape object
*/
Russell Taylor
committed
void Sample::setShapeObject(const Geometry::Object & sample_shape)
Gigg, Martyn Anthony
committed
{
m_sample_shape = sample_shape;
}
/**
* Get a pointer to the sample shape object
* @returns A shared pointer to the sample object
*/
Russell Taylor
committed
const Geometry::Object& Sample::getShapeObject() const
Gigg, Martyn Anthony
committed
{
return m_sample_shape;
}
Gigg, Martyn Anthony
committed
/**
* Set the geometry flag that is specfied in the raw file within the SPB_STRUCT
* 1 = cylinder, 2 = flat plate, 3 = disc, 4 = single crystal
* @param geom_id The flag for the geometry
*/
void Sample::setGeometryFlag(int geom_id)
{
m_geom_id = geom_id;
}
/**
* Get the geometry flag that is specified in the raw file within the SPB_STRUCT
* 1 = cylinder, 2 = flat plate, 3 = disc, 4 = single crystal
* @returns The flag for the sample geometry
*/
int Sample::getGeometryFlag() const
{
return m_geom_id;
}
/**
Gigg, Martyn Anthony
committed
* Set the thickness value
Gigg, Martyn Anthony
committed
* @param thick The parameter e_thick in the SPB_STRUCT
*/
Gigg, Martyn Anthony
committed
void Sample::setThickness(double thick)
Gigg, Martyn Anthony
committed
{
m_thick = thick;
Gigg, Martyn Anthony
committed
}
/**
* Get the thickness value
* @returns The parameter thickness parameter
*/
double Sample::getThickness() const
{
return m_thick;
}
/**
* Set the height value
Gigg, Martyn Anthony
committed
* @param height The parameter e_height in the SPB_STRUCT
Gigg, Martyn Anthony
committed
*/
void Sample::setHeight(double height)
{
Gigg, Martyn Anthony
committed
m_height = height;
}
/**
Gigg, Martyn Anthony
committed
* Get the height value
* @returns The parameter height parameter
Gigg, Martyn Anthony
committed
*/
Gigg, Martyn Anthony
committed
double Sample::getHeight() const
Gigg, Martyn Anthony
committed
{
Gigg, Martyn Anthony
committed
return m_height;
Gigg, Martyn Anthony
committed
}
Gigg, Martyn Anthony
committed
/**
* Set the width value
* @param width The parameter e_width in the SPB_STRUCT
*/
void Sample::setWidth(double width)
{
m_width = width;
}
/**
* Get the height value
* @returns The parameter height parameter
*/
double Sample::getWidth() const
{
return m_width;
}
Russell Taylor
committed
/**Deletes a log data item
* @param name The name of the item to delete
*/
Russell Taylor
committed
{
m_manager.removeProperty(name);
}
Gigg, Martyn Anthony
committed
} // namespace API
} // namespace Mantid