SEAL Component Model
ROOT/CORE Meeting 8 April 2005
- P. Mato / CERN
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)
ROOT/CORE Meeting 8 April 2005
8 April 2005 SEAL Component Model
2
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
8 April 2005 SEAL Component Model
3
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
8 April 2005 SEAL Component Model
4
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
8 April 2005 SEAL Component Model
5
#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
8 April 2005 SEAL Component Model
6
#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
8 April 2005 SEAL Component Model
7
#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”
Component1
“example/MyComponent2”
8 April 2005 SEAL Component Model
8
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
8 April 2005 SEAL Component Model
9
#include “TROOT.h” #include “TGlobal.h” #include “MyComponent.” MyComponent* handle = (MyComponent*)(gROOT->GetGlobal(“gMyComponent”).GetAddress()); handle->doSomething();