D
Duncan Mac-Vicar Prett
Hello guys, I am wrapping a C++ library and after changing from define=20
singleton method "new" to alloc function and initialize, I ran into this=20
problem, imagine the classes are like those:
class MyOtherClass
{
public:
=A0=A0=A0=A0=A0=A0=A0=A0MyOtherClass(int a, int b);=A0=A0=A0=A0=A0
private:
=A0=A0=A0=A0=A0=A0=A0=A0int a;
=A0=A0=A0=A0=A0=A0=A0=A0int b;
}
class MyClass
{
public:
=A0=A0=A0=A0=A0=A0=A0=A0MyClass(int a, int b);
=A0=A0=A0=A0=A0=A0=A0=A0MyOtherClass myFunc(int c);
private:
=A0=A0=A0=A0=A0=A0=A0=A0int a;
=A0=A0=A0=A0=A0=A0=A0=A0int b;
};
1.- in alloc function, I have to create a MyClass object and wrap it with=20
Data_Wrap_Struct, but I cant create an object at that time, because I have =
no=20
constructor parameter until initialize (and I dont have a default construct=
or=20
either). How do I solve this?
2.- If class MyClass func returns a MyOther class object, whats the best wa=
y=20
to wrap this?, I have even a function that returns a collection of=20
MyOtherClass objects, so I think I have to iterate trough it, and create a=
=20
ruby wrapped object not from scratch but wrapping the current object in the=
=20
collection, and then add all the ruby objects to a Ruby array, in this case=
,=20
whats the best way to wrap it?
Thanks for the help guys!
Duncan
singleton method "new" to alloc function and initialize, I ran into this=20
problem, imagine the classes are like those:
class MyOtherClass
{
public:
=A0=A0=A0=A0=A0=A0=A0=A0MyOtherClass(int a, int b);=A0=A0=A0=A0=A0
private:
=A0=A0=A0=A0=A0=A0=A0=A0int a;
=A0=A0=A0=A0=A0=A0=A0=A0int b;
}
class MyClass
{
public:
=A0=A0=A0=A0=A0=A0=A0=A0MyClass(int a, int b);
=A0=A0=A0=A0=A0=A0=A0=A0MyOtherClass myFunc(int c);
private:
=A0=A0=A0=A0=A0=A0=A0=A0int a;
=A0=A0=A0=A0=A0=A0=A0=A0int b;
};
1.- in alloc function, I have to create a MyClass object and wrap it with=20
Data_Wrap_Struct, but I cant create an object at that time, because I have =
no=20
constructor parameter until initialize (and I dont have a default construct=
or=20
either). How do I solve this?
2.- If class MyClass func returns a MyOther class object, whats the best wa=
y=20
to wrap this?, I have even a function that returns a collection of=20
MyOtherClass objects, so I think I have to iterate trough it, and create a=
=20
ruby wrapped object not from scratch but wrapping the current object in the=
=20
collection, and then add all the ruby objects to a Ruby array, in this case=
,=20
whats the best way to wrap it?
Thanks for the help guys!
Duncan