3.2 Creating Ports and Components

Let's create a component. First make sure that your current working directory is inside the project directory:

$ pwd

/home/livetau/workshop-acts/cca/WORK/tutorial-src/doc/scratch/cxx/demo

It is important to be in the project directory (or its subdirectories) when you invoke bocca because it picks up all of the context for your project from there (similar to CVS or Subversion). Go ahead and create the component now:

$ bocca create component emptyComponent

Babel updating the cxx implementation of component demo.emptyComponent ...

Notice that Bocca selected demo as the default package name for emptyComponent since no package name was specified when creating the component. Normally, Bocca uses the project name as the package name for both ports and components unless a different default package name was specified when the project was created. We have named our component emptyComponent because it has no uses nor provides ports and thus is rather uninteresting. Nonetheless, Bocca has generated all of the necessary make system scaffolding and code for the component, including the setServicescall. Listing the directory shows the files Bocca has generated (shown here for LANGcxx):

$ ls components/demo.emptyComponent

BOCCA
demo_emptyComponent_Impl.cxx
demo_emptyComponent_Impl.hxx
demo_emptyComponent_Impl.hxx.rej
glue
Makefile
make.rules.user
make.vars.user

Components created in Fortran, C, and Python will contain a similar set files appropriate to the language. In the components directory a new directory, demo.emptyComponent, has been created to hold your component. And inside there is the code already generated for the component (again continuing with LANG =  cxx) in the files: demo_emptyComponent_Impl.cxx, demo_emptyComponent_Impl.hxx with some Babel glue code in the glue subdirectory. Note the file ending in .rej named demo_emptyComponent_Impl.hxx.rej. This file is produced by the Bocca splicing process. It records code fragments that Bocca discarded while generating demo_emptyComponent_Impl.hxx and can usually be ignored and even deleted.



Subsections
2010-08-11