blitzdg
an open-source project aiming to implement parallel discontinuous Galerkin (dg) solvers for common partial differential equations systems using blitz++ for array and tensor manipulations and MPI for distributed parallelism.
context.h
1 
2 // Copyright Joakim Karlsson & Kim Gräsman 2010-2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef IGLOO_CONTEXT_H
8 #define IGLOO_CONTEXT_H
9 
10 #include <igloo/core/testresult.h>
11 #include <igloo/core/context.h>
12 
13 namespace igloo {
14 
15  //
16  // This class enables us to store attributes with contexts.
17  // Attributes are named string values that can be used for
18  // filtering and reporting etc.
19  //
20  // A testlistener can retrieve the attributes for a context
21  // during a test run.
22  //
23  template <typename ContextType>
25  {
26  static void Set(const std::string name, std::string value)
27  {
28  attributeContainer()[name] = value;
29  }
30 
31  static const std::string& Get(const std::string& name)
32  {
33  return attributeContainer()[name];
34  }
35 
36  private:
37 
38  static std::map<std::string, std::string>& attributeContainer()
39  {
40  static std::map<std::string, std::string> attributeContainer;
41  return attributeContainer;
42  }
43  };
44 
45 
46  //
47  // This class is a base class to ContextProvider and adds
48  // the possibility to add attributes to a context.
49  //
50  template <typename ContextType>
52  {
53  void SetAttribute(const std::string& name, const char* value) const
54  {
56  }
57 
58  const std::string& GetAttribute(const std::string& name) const
59  {
61  }
62  };
63 }
64 
65 #endif
Definition: context.h:51
Definition: context.h:13
Definition: context.h:24
Definition: contextbase.h:15