SEAL Component Model ROOT/CORE Meeting 8 April 2005 P. Mato / CERN - - PowerPoint PPT Presentation

seal component model
SMART_READER_LITE
LIVE PREVIEW

SEAL Component Model ROOT/CORE Meeting 8 April 2005 P. Mato / CERN - - PowerPoint PPT Presentation

SEAL Component Model ROOT/CORE Meeting 8 April 2005 P. Mato / CERN Component Model Overview A way of resolving software complexity A generic set of software building blocks components , services Exposing well defined interface(s)


slide-1
SLIDE 1

SEAL Component Model

ROOT/CORE Meeting 8 April 2005

  • P. Mato / CERN
slide-2
SLIDE 2

8 April 2005 SEAL Component Model

  • P. Mato/CERN

2

Component Model Overview

A way of resolving software complexity A generic set of software building blocks

– components, services

Exposing well defined interface(s)

– contract, protocol

Easily configurable

– properties

Assembled via generic infrastructure

– contexts, scopes

Compile-time and/or run-time

– static and/or dynamic binding

Easy deployment based on plug-n-play architecture

– plug-ins

slide-3
SLIDE 3

8 April 2005 SEAL Component Model

  • P. Mato/CERN

3

  • 3. Component Model

Hierarchy of bases classes to

support the component model

Provide standard functionality

– Loading, instantiation, configuration, lifetime management,…

Each Component is in a Context Tree of Contexts Support for locating components

– If not in local context, look in parent

A Service provides its own local

Context

– Components of a Service are scoped in its own Context

User classes inherit from

Component or Service

– Plug-in functionality for free Component Service MyComponent MyService Context RefCounted

* * 1

Component Factory Component Loader

1

slide-4
SLIDE 4

8 April 2005 SEAL Component Model

  • P. Mato/CERN

4

Context Hierarchy

Any Component may attempt to locate another Component in the

running application (collaboration network)

– By “type” or by “key” – If the not found in the current context, the parent context is searched is recursively

Context

Application C1 C1 C1 C2

Component

Svc2 C1 C6 C1 C7 Svc1 C1 C3 C1 C4 C1 C5 Svc1

Service

C1 C7

slide-5
SLIDE 5

8 April 2005 SEAL Component Model

  • P. Mato/CERN

5

Component Model: How-To (1)

#ifndef MYCOMPONENT_H #define MYCOMPONENT_H 1 #include "SealKernel/Component.h“ class MyComponent : public seal::Component{ DECLARE_SEAL_COMPONENT; public: MyComponent (seal::Context* context, const std::string & label); // implicit copy constructor // implicit assignment operator // implicit destructor //.....component member functions.. void doSomething(); }; #endif // MYCOMPONENT_H

MyComponent.h

slide-6
SLIDE 6

8 April 2005 SEAL Component Model

  • P. Mato/CERN

6

Component Model: How-To (2)

#include "MyComponent.h“ #include <iostream> DEFINE_SEAL_COMPONENT (MyComponent, “example/MyComponent"); MyComponent::MyComponent (seal::Context* context, const std::string & label) : Component (context, label){} // member function implementations void MyComponent::doSomething() { std::cout << "MyComponent: Hello World ! " << std::endl; } #include "MyComponent.h“ #include "SealKernel/ComponentFactory.h“ #include "PluginManager/ModuleDef.h“ DEFINE_SEAL_MODULE (); DEFINE_SEAL_PLUGIN (seal::ComponentFactory, MyComponent, MyComponent::classContextLabel ());

MyComponent.cpp Module.cpp

slide-7
SLIDE 7

8 April 2005 SEAL Component Model

  • P. Mato/CERN

7

Component Look-up

#include “SealKernel/ComponentLoader.h” #include “MyComponent.h” Handle<MyComponent> handle = component<MyComponent>(); handle->doSomething();

OtherComponent.cpp

#include “SealKernel/ComponentLoader.h” #include “MyComponent.h” Handle<MyComponent> handle = component<MyComponent>(“example/MyComponent”); handle->doSomething(); Application

AppContext

1 2 3 4 5

Component7

Svc2

Svc2Context

1 … … 42 43

Component1

“example/MyComponent”

1

Component1

“example/MyComponent2”

2

slide-8
SLIDE 8

8 April 2005 SEAL Component Model

  • P. Mato/CERN

8

Existing Services

Application

– Defines the top level Context – Possibility to set the initial set of Components to be loaded in the application

Message Service

– Message composition, filtering and reporting – Closely related to MessageStream

Configuration Service

– Management of Component properties and loading configurations – Multiple backends foreseen: » Gaudi style options(current),.INI style, CMS style, XML,…

Dictionary Service

– Enables automatic loading of SEAL C++ reflection dictionaries simply by specifying a C++ type name

slide-9
SLIDE 9

8 April 2005 SEAL Component Model

  • P. Mato/CERN

9

Equivalence in ROOT

Similar functionality exists in ROOT with the use

  • f global variables

– Scoped lookups missing

#include “TROOT.h” #include “TGlobal.h” #include “MyComponent.” MyComponent* handle = (MyComponent*)(gROOT->GetGlobal(“gMyComponent”).GetAddress()); handle->doSomething();