psana::Context Namespace Reference
[psana package]

Methods dealing with Framework context. More...


Typedefs

typedef int context_t
 Abstraction of a context type.

Functions

context_t generate ()
 generate new unique context value, never returns 0 value.
void set (context_t ctx)
 Set the context.
context_t get ()
 Get current context, returns 0 if context was not set yet.
psana::Context::context_t generate ()
 generate new unique context value, never returns 0 value.
void set (psana::Context::context_t ctx)
 Set the context.
psana::Context::context_t get ()
 Get current context, returns 0 if context was not set yet.


Detailed Description

Methods dealing with Framework context.

There could be several instances of the psana framework (including separate sets of modules and separate configurations) in one application. Some services need to know which framework instance they serve, for example configuration service needs to provide different set of parameters for modules in different frameworks. To simplify implementation of user modules we want to avoid passing information about current framework instance from framework down to modules. Instead we use concept of context to implement indirect notification of the clients about current context.

The context is implemented as a global object keeping some abstract values that are unique for different frameworks (index of a framework instance could be used for example). This global object is set by framework instance during initialization. Any object that needs to know context should copy its value and use it later to identify framework instance. Constructor of a module is one good place where the context can be checked. After framework initialization it is never guaranteed that context could be updated.

NOTE: current implementation not thread safe and should not be used from multiple threads.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
Id
Context.h 5435 2013-02-13 01:02:07Z salnikov@SLAC.STANFORD.EDU
Author:
Andy Salnikov


Typedef Documentation

typedef int psana::Context::context_t

Abstraction of a context type.

Definition at line 76 of file Context.h.


Function Documentation

context_t psana::Context::generate (  ) 

generate new unique context value, never returns 0 value.

Definition at line 43 of file Context.cpp.

References g_next.

void psana::Context::set ( context_t  ctx  ) 

Set the context.

Definition at line 50 of file Context.cpp.

References g_current.

Referenced by psana::PSAna::dataSource(), and psana::PSAna::PSAna().

context_t psana::Context::get (  ) 

Get current context, returns 0 if context was not set yet.

Definition at line 57 of file Context.cpp.

References g_current.

psana::Context::context_t psana::Context::generate (  ) 

generate new unique context value, never returns 0 value.

Definition at line 43 of file Context.cpp.

References g_next.

void psana::Context::set ( psana::Context::context_t  ctx  ) 

Set the context.

Definition at line 50 of file Context.cpp.

References g_current.

Referenced by psana::PSAna::dataSource(), and psana::PSAna::PSAna().

psana::Context::context_t psana::Context::get (  ) 

Get current context, returns 0 if context was not set yet.

Definition at line 57 of file Context.cpp.

References g_current.


Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7