To create the implementation, you must first have a valid SIDL file, then invoke Babel as follows:
% babel -server=C++ file.sidlor simply
% babel -sC++ file.sidl
This will create a makefile fragment called babel.make, several C headers and source files, and numerous C++ header and source files. To create a working implementation, the only files that need to be hand-edited are the C++ "Impl" files (header and source files that end in _Impl.hh or _Impl.cc). All your additions to this file should be made between code splicer pairs. Code splicing is a technique Babel uses to preserve hand-edited code between multiple invocations of Babel. This allows a developer to refine their SIDL file without ruining all their previous implementations. Code between splicer pairs will be retained by subsequent invocations of Babel; code outside splicer pairs is not.
Here is an example of a code splicer pair in C++. In this example, you would replace the line "// Insert code here... " with your implementation.
void MyPackage::MyClass::myMethod() { // DO-NOT-DELETE splicer.begin(MyPackage.MyClass.myMethod) // Insert code here... // DO-NOT-DELETE splicer.end(MyPackage.MyClass.myMethod) }
It is important to understand where and why splicer blocks occur. Splicer blocks appear at the beginning and end of each Impl header and source file; for developers to add #include's and other miscellaneous items respectively. In the headers, there is a splicer block that allows a user to make the impl class inherit from some other class. From SIDL's point of view this is private inheritance -- meaning that it is useful for inheriting implementation details, but they can't be automatically exposed to the SIDL method dispatch mechanism. There is a splicer block inside the class definition for developers to add any data members the wish to the class. In the source files, splicer blocks appear in each method implementation. There are two implicit methods (i.e., methods that did not appear in the SIDL file) that must also be implemented. The _ctor method is a constructor function that is run whenever an object is created. The _dtor method is a destructor function that is run whenever an object is destroyed. If the object has no state, these functions are typically empty.