Sierra Toolkit  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProductRegistry.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
10 #define STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
11 
12 #include <map>
13 #include <string>
14 
15 namespace stk {
16 
31 {
32 public:
33  typedef std::map<std::string, std::string> AttributeMap;
34  typedef std::map<std::string, AttributeMap> ProductMap;
35 
41  static ProductRegistry &instance();
42 
43 private:
49  : m_productMap(),
50  m_productName(),
51  m_registryOK(true)
52  {}
53 
55 
56  ProductRegistry &operator=(const ProductRegistry &);
57 
59  {}
60 
61 
62 public:
68  static const char *version();
69 
77  m_registryOK = false;
78  }
79 
87  bool isRegistryOK() {
88  return m_registryOK;
89  }
90 
96  const std::string &getProductName() const {
97  return m_productName;
98  }
99 
104  void setProductName(const std::string &product_name) {
105  m_productName = product_name;
106  }
107 
115  return m_productMap;
116  }
117 
127  AttributeMap &addProduct(const std::string &name);
128 
145  AttributeMap &addTPL(const std::string &name, const std::string &version, const std::string &qualifier = "");
146 
158  AttributeMap &addRegion(const std::string &name);
159 
170  AttributeMap &getProductAttributeMap(const std::string &name);
171 
186  const std::string &getProductAttribute(const std::string &name, const std::string &attribute) const;
187 
202  std::string &getProductAttribute(const std::string &name, const std::string &attribute);
203 
218  void setProductAttribute(const std::string &name, const std::string &attribute, const std::string &value);
219 
220 public:
221  static const std::string NAME;
222  static const std::string TITLE;
223  static const std::string VERSION;
224  static const std::string QUALIFIER;
225  static const std::string CONTACT;
226  static const std::string ERROR;
227  static const std::string PRODUCT_TYPE;
228 
229  static const std::string EXECUTABLE;
230  static const std::string BUILD_TIME;
231 
232  static const std::string BANNER_DETAIL;
233  static const std::string COPYRIGHT;
234 
235  static const std::string REGION_TITLE;
236 
237  static const std::string PRODUCT_TYPE_REGION;
238 
239 private:
240  mutable ProductMap m_productMap;
241  std::string m_productName;
242  bool m_registryOK;
243 };
244 
245 } // namespace stk
246 
247 #ifdef STK_BUILT_IN_SIERRA
248 #undef VERSION // Nice, Trilinos leaves us this gem
249 
250 namespace sierra {
251 
252 typedef stk::ProductRegistry ProductRegistry;
253 
254 } // namespace sierra
255 #endif // STK_BUILT_IN_SIERRA
256 
257 
258 #endif // STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
void setProductAttribute(const std::string &name, const std::string &attribute, const std::string &value)
Member function setAttribute sets the attribute for the named poduct to the specified value...
std::map< std::string, AttributeMap > ProductMap
Map of product name to attribute map.
AttributeMap & addRegion(const std::string &name)
Member function addRegion add a region as a product to the registry. A region product is a product wi...
static const std::string PRODUCT_TYPE
Product&#39;s product_type attribute.
static const std::string REGION_TITLE
Product&#39;s region_title attribute.
static const std::string NAME
Product&#39;s name attribute.
static const std::string PRODUCT_TYPE_REGION
Region product_type value.
static const std::string TITLE
Product&#39;s title attribute.
static const std::string BANNER_DETAIL
Product&#39;s additional banner info attribute.
static const std::string COPYRIGHT
Product&#39;s copyright information.
void setProductName(const std::string &product_name)
Member function setProductName sets the product name.
static ProductRegistry & instance()
Member function instance returns a reference to the registry singleton.
AttributeMap & getProductAttributeMap(const std::string &name)
Member function getProduct returns a reference to the product attribute map.
static const std::string QUALIFIER
TPL&#39;s qualifier attribute.
bool isRegistryOK()
Member function isRegistryOK returns true if the registry has not been flagged as having an error via...
AttributeMap & addProduct(const std::string &name)
Member function addProduct adds a product to the registry.
AttributeMap & addTPL(const std::string &name, const std::string &version, const std::string &qualifier="")
Member function addTPL adds a product to the registry. A product always has the VERSION and QUALIFIER...
static const char * version()
Member function version returns the version number of the combined product.
static const std::string CONTACT
Product&#39;s contact attribute.
const std::string & getProductName() const
Member function getProductName returns the product name.
Class ProductRegistry maps product names and attributes to brief descriptive values. Each added product has at a minimum the NAME value initialized. A region type product also has the PRODUCT_TYPE set to PRODUCT_TYPE_REGION.
static const std::string EXECUTABLE
Product&#39;s executable attribute.
std::map< std::string, std::string > AttributeMap
Map of attribute keyword to value.
void setRegistryInvalid()
Member function setRegistryInvalid marks th registry as contain a conflict of some sort...
const std::string & getProductAttribute(const std::string &name, const std::string &attribute) const
Member function getAttribute returns the attribute for the named product.
static const std::string ERROR
Product&#39;s error attribute.
static const std::string VERSION
TPL&#39;s version attribute.
ProductMap & getProductMap() const
Member function getProductMap returns a reference to the map of all products.
static const std::string BUILD_TIME
Product&#39;s build_time attribute.
const std::string & product_name()
Function product_name returns the product&#39;s name. This name is used to query the product registry for...
Definition: Env.cpp:172