Defining a Class

In the following pages we will examine in detail most of the aspects related to exposing classes and functions to CliPP.
We will do this by examining an example class, point. We will start from the basics and gradually build up a complete and working wrapper for the class.

The first iteration of class point looks like this:

    class point : public object {
    public:
	//construction
	point(double x,double y,double z);
    private:
	double x_,y_,z_;
    };

And here is the code for exposing point to the scripting language:

    class_<point,object> cls("point",c);

Let's examine this piece by piece.

class_ The class_ identifier is used to indicate that we are exposing a class or a struct to CliPP.
point This is the class we want to expose
object       The base class for point. Currently only 1 base class is allowed.
"point" The name of the class when accessing it from CliPP.
c This is the object where the class information is stored (will be explained in detail later)