Sierra Toolkit Version of the Day
ProductRegistry.hpp
00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #ifndef STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
00010 #define STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
00011 
00012 #include <map>
00013 #include <string>
00014 
00015 namespace stk {
00016 
00030 class ProductRegistry
00031 {
00032 public:
00033   typedef std::map<std::string, std::string> AttributeMap;  
00034   typedef std::map<std::string, AttributeMap> ProductMap; 
00035 
00041   static ProductRegistry &instance();
00042 
00043 private:
00048   ProductRegistry()
00049     : m_productMap(),
00050       m_productName(),
00051       m_registryOK(true)
00052   {}
00053 
00054   ProductRegistry(const ProductRegistry &);
00055 
00056   ProductRegistry &operator=(const ProductRegistry &);
00057 
00058   ~ProductRegistry()
00059   {}
00060 
00061 
00062 public:
00068   static const char *version();
00069 
00076   void setRegistryInvalid() {
00077     m_registryOK = false;
00078   }
00079 
00087   bool isRegistryOK() {
00088     return m_registryOK;
00089   }
00090 
00096   const std::string &getProductName() const {
00097     return m_productName;
00098   }
00099 
00104   void setProductName(const std::string &product_name) {
00105     m_productName = product_name;
00106   }
00107 
00114   ProductMap &getProductMap() const {
00115     return m_productMap;
00116   }
00117 
00127   AttributeMap &addProduct(const std::string &name);
00128 
00145   AttributeMap &addTPL(const std::string &name, const std::string &version, const std::string &qualifier = "");
00146 
00158   AttributeMap &addRegion(const std::string &name);
00159 
00170   AttributeMap &getProductAttributeMap(const std::string &name);
00171 
00186   const std::string &getProductAttribute(const std::string &name, const std::string &attribute) const;
00187 
00202   std::string &getProductAttribute(const std::string &name, const std::string &attribute);
00203 
00218   void setProductAttribute(const std::string &name, const std::string &attribute, const std::string &value);
00219 
00220 public:
00221   static const std::string  NAME;       
00222   static const std::string  TITLE;        
00223   static const std::string      VERSION;                        
00224   static const std::string      QUALIFIER;                      
00225   static const std::string  CONTACT;      
00226   static const std::string  ERROR;        
00227   static const std::string  PRODUCT_TYPE;     
00228 
00229   static const std::string  EXECUTABLE;     
00230   static const std::string  BUILD_TIME;     
00231 
00232   static const std::string  BANNER_DETAIL;      
00233   static const std::string  COPYRIGHT;      
00234 
00235   static const std::string  REGION_TITLE;     
00236 
00237   static const std::string  PRODUCT_TYPE_REGION;    
00238 
00239 private:
00240   mutable ProductMap    m_productMap;     
00241   std::string                   m_productName;                  
00242   bool        m_registryOK;     
00243 };
00244 
00245 } // namespace stk
00246 
00247 #ifdef STK_BUILT_IN_SIERRA
00248 #undef VERSION // Nice, Trilinos leaves us this gem
00249 
00250 namespace sierra {
00251 
00252 typedef stk::ProductRegistry ProductRegistry;
00253 
00254 } // namespace sierra
00255 #endif // STK_BUILT_IN_SIERRA
00256 
00257 
00258 #endif // STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines