How To Use the Dictionary Service

LCG Project | LCG Applications Area

SEAL Project | Project Portal

 

$Date: 2004/06/28 17:34:30 $

Overview

This guide explains how to use the Dictionary Service from a component (refer to how to create a component).

Accessing the Service

The use interacts with the DicitonaryService using the IDictionaryService interface. To obtain the pointer (IHandle) to the service the user may simple ask for it using its current context. Eventually the user may need to load it if it is not already loaded.

Typical method implementation looks like this:

#include "SealKernel/IDictionaryService.h"
#include "SealKernel/ComponentLoader.h"

// Obtain a Handle to IDictionaryService
IHandle<IDictionaryService> dictsvc = context()->query<IDictionaryService>(); // Eventually load it if not found using Component Loader ... if ( !dictsvc ) { Handle<ComponentLoader> loader = context()->component<ComponentLoader>(); loader->load( IDictionaryService::classContextLabel() ); dictsvc = context()->query<IDictionaryService>(); }

The main method available is loadClass() to obtain a pointer to the Reflection Class knowing its name or type_info. If the dictionary for the class if not yet loaded, the plugin manager will take care of loading the corresponding dictionary library (as long as the Dictionary library has been build as a Seal capability module).

Typical method implementation looks like:

#include "Reflection/Class.h"

const Class* cl = dictsvc->loadClass("std::vector<int>");

Configuring the DictionaryService

For the time being there is nothing to configure the DictionaryService.


Contact: Pere Mato