1818*****************************************************************************/
1919
2020#include < boost/python/class.hpp>
21+ #include < boost/python/manage_new_object.hpp>
22+ #include < boost/python/pure_virtual.hpp>
2123
2224#include < iostream>
2325
@@ -32,22 +34,42 @@ namespace {
3234class ReflectionProfileWrap :
3335 public ReflectionProfile, public wrapper<ReflectionProfile>
3436{
35- // :TODO: :KLUDGE: Dummy override of pure virtual functions
3637 public:
37- ReflectionProfileWrap () : ReflectionProfile() {}
38- virtual ReflectionProfile* CreateCopy () const {}
39- virtual CrystVector_REAL GetProfile (
38+
39+ // Pure virtual functions
40+
41+ ReflectionProfile* CreateCopy () const
42+ {
43+ return this ->get_override (" CreateCopy" )();
44+ }
45+
46+ CrystVector_REAL GetProfile (
4047 const CrystVector_REAL& x, const REAL xcenter,
4148 const REAL h, const REAL k, const REAL l) const
42- {}
43- virtual REAL GetFullProfileWidth (
49+ {
50+ bp::override f = this ->get_override (" GetProfile" );
51+ return f (x, xcenter, h, k, l);
52+ }
53+
54+ REAL GetFullProfileWidth (
4455 const REAL relativeIntensity, const REAL xcenter,
4556 const REAL h, const REAL k, const REAL l)
46- {}
47- virtual void XMLOutput (ostream& os, int indent) const
48- {}
49- virtual void XMLInput (istream& is, const XMLCrystTag& tag)
50- {}
57+ {
58+ bp::override f = this ->get_override (" GetFullProfileWidth" );
59+ return f (relativeIntensity, xcenter, h, k, l);
60+ }
61+
62+ void XMLOutput (ostream& os, int indent) const
63+ {
64+ bp::override f = this ->get_override (" XMLOutput" );
65+ f (os, indent);
66+ }
67+
68+ void XMLInput (istream& is, const XMLCrystTag& tag)
69+ {
70+ bp::override f = this ->get_override (" GetProfile" );
71+ f (is, tag);
72+ }
5173};
5274
5375} // namespace
@@ -57,5 +79,9 @@ void wrap_reflectionprofile()
5779{
5880 class_<ReflectionProfileWrap, bases<RefinableObj>, boost::noncopyable>(
5981 " ReflectionProfile" )
82+ // TODO add pure_virtual bindings to the remaining public methods
83+ .def (" CreateCopy" ,
84+ pure_virtual (&ReflectionProfile::CreateCopy),
85+ return_value_policy<manage_new_object>())
6086 ;
6187}
0 commit comments