23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Athena</strong><br />

Chapter 17 Physical design issues Version/Issue: 2.0.0<br />

When a component library is loaded, the framework attempts to locate a single entrypoint, called<br />

getFactoryEntries(). This is expected to declare and load the component factories from the<br />

library. Several macros are available to simplify the declaration and loading of the components via this<br />

mechanism.<br />

Consider a simple package MyComponents, that declares and defines the MyAlgorithm class,<br />

being a subclass of Algorithm, and the MyService class, being a subclass of Service. Thus the<br />

package will contain the header and implementation files for these classes (MyAlgorithm.h,<br />

MyAlgorithm.cxx, MyService.h and MyService.cxx) in addition to whatever other files<br />

are necessary for the correct functioning of these components.<br />

In order to satisfy the requirements of a component library, two additional files must also be present in<br />

the package. One is used to declare the components, the other to load them. Because of the technical<br />

limitations inherent in the use of shared libraries, it is important that these two files remain separate,<br />

and that no attempt is made to combine their contents into a single file.<br />

The names of these files and their contents are described in the following sections.<br />

17.3.1.1 Declaring Components<br />

Components within the component library are declared in a file MyComponents_entries.cxx.<br />

By convention, the name of this file is the package name concatenated with _entries. The contents<br />

of this file are shown in Listing 17.3:<br />

Listing 17.3 The MyComponents_entries.cxx file<br />

#include "Gaudi/Kernel/DeclareFactoryEntries.h"<br />

DECLARE_FACTORY_ENTRIES( MyComponents ) { [1]<br />

DECLARE_ALGORITHM( MyAlgorithm ); [2]<br />

DECLARE_SERVICE ( MyService );<br />

}<br />

Notes:<br />

1. The argument to the DECLARE_FACTORY_ENTRIES statement is the name of the<br />

component library.<br />

2. Each component within the library should be declared using one of the DECLARE_XXX<br />

statements discussed in detail in the next Section.<br />

page 151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!