* add the axis source test
[hkl.git] / src / samplefactory.cpp
blob726f24a9ff41991401f1125fbcfeb202159a2255
2 #include "samplefactory.h"
3 #include "geometry.h"
5 #include "sample_monocrystal.h"
6 namespace hkl
9 /**
10 * @brief The default constructor.
11 * @param geometry the Geometry use to fill the Reflection._geometry.
14 SampleFactory::SampleFactory(hkl::Geometry & geometry) :
15 _geometry(geometry)
19 std::vector<SampleType> SampleFactory::types() const
21 std::vector<SampleType> types;
22 types.push_back(SAMPLE_MONOCRYSTAL);
24 return types;
27 /**
28 * @brief Create a new reflection.
29 * @return The created Reflection.
32 hkl::Sample * SampleFactory::create(const std::string & name, hkl::SampleType type) const throw(hkl::HKLException)
34 Sample * sample;
36 switch (type)
38 case SAMPLE_MONOCRYSTAL :
39 sample = new sample::MonoCrystal(_geometry, name);
40 break;
41 default :
42 HKLEXCEPTION("Unknown sample Type.", "Please use a correct type.");
44 return sample;
48 } // namespace hkl