psana/src/Context.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: Context.cpp 5435 2013-02-13 01:02:07Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class Context...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "psana/Context.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //-----------------------------------------------------------------------
00027 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00028 //-----------------------------------------------------------------------
00029 
00030 namespace {
00031 
00032   psana::Context::context_t g_next = 0;
00033   psana::Context::context_t g_current = 0;
00034 
00035 }
00036 
00037 //              ----------------------------------------
00038 //              -- Public Function Member Definitions --
00039 //              ----------------------------------------
00040 
00041 // generate new unique context value, never returns 0 value.
00042 psana::Context::context_t
00043 psana::Context::generate()
00044 {
00045   return ++::g_next;
00046 }
00047 
00048 // Set the context
00049 void
00050 psana::Context::set(psana::Context::context_t ctx)
00051 {
00052   ::g_current = ctx;
00053 }
00054 
00055 // Get current context, returns 0 if context was not set yet
00056 psana::Context::context_t
00057 psana::Context::get()
00058 {
00059   return ::g_current;
00060 }

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7