|
Sierra Toolkit
Version of the Day
|
00001 // Copyright (c) 2013, Sandia Corporation. 00002 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00003 // the U.S. Government retains certain rights in this software. 00004 // 00005 // Redistribution and use in source and binary forms, with or without 00006 // modification, are permitted provided that the following conditions are 00007 // met: 00008 // 00009 // * Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // 00012 // * Redistributions in binary form must reproduce the above 00013 // copyright notice, this list of conditions and the following 00014 // disclaimer in the documentation and/or other materials provided 00015 // with the distribution. 00016 // 00017 // * Neither the name of Sandia Corporation nor the names of its 00018 // contributors may be used to endorse or promote products derived 00019 // from this software without specific prior written permission. 00020 // 00021 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00024 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00025 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00026 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00028 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00029 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00030 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 // 00033 00034 #ifndef STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP 00035 #define STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP 00036 00037 #include <map> 00038 #include <string> 00039 00040 namespace stk_classic { 00041 00055 class ProductRegistry 00056 { 00057 public: 00058 typedef std::map<std::string, std::string> AttributeMap; 00059 typedef std::map<std::string, AttributeMap> ProductMap; 00060 00066 static ProductRegistry &instance(); 00067 00068 private: 00073 ProductRegistry() 00074 : m_productMap(), 00075 m_productName(), 00076 m_registryOK(true) 00077 {} 00078 00079 ProductRegistry(const ProductRegistry &); 00080 00081 ProductRegistry &operator=(const ProductRegistry &); 00082 00083 ~ProductRegistry() 00084 {} 00085 00086 00087 public: 00093 static const char *version(); 00094 00101 void setRegistryInvalid() { 00102 m_registryOK = false; 00103 } 00104 00112 bool isRegistryOK() { 00113 return m_registryOK; 00114 } 00115 00121 const std::string &getProductName() const { 00122 return m_productName; 00123 } 00124 00129 void setProductName(const std::string &product_name) { 00130 m_productName = product_name; 00131 } 00132 00139 ProductMap &getProductMap() const { 00140 return m_productMap; 00141 } 00142 00152 AttributeMap &addProduct(const std::string &name); 00153 00170 AttributeMap &addTPL(const std::string &name, const std::string &version, const std::string &qualifier = ""); 00171 00183 AttributeMap &addRegion(const std::string &name); 00184 00195 AttributeMap &getProductAttributeMap(const std::string &name); 00196 00211 const std::string &getProductAttribute(const std::string &name, const std::string &attribute) const; 00212 00227 std::string &getProductAttribute(const std::string &name, const std::string &attribute); 00228 00243 void setProductAttribute(const std::string &name, const std::string &attribute, const std::string &value); 00244 00245 public: 00246 static const std::string NAME; 00247 static const std::string TITLE; 00248 static const std::string VERSION; 00249 static const std::string QUALIFIER; 00250 static const std::string CONTACT; 00251 static const std::string ERROR; 00252 static const std::string PRODUCT_TYPE; 00253 00254 static const std::string EXECUTABLE; 00255 static const std::string BUILD_TIME; 00256 00257 static const std::string BANNER_DETAIL; 00258 static const std::string COPYRIGHT; 00259 00260 static const std::string REGION_TITLE; 00261 00262 static const std::string PRODUCT_TYPE_REGION; 00263 00264 private: 00265 mutable ProductMap m_productMap; 00266 std::string m_productName; 00267 bool m_registryOK; 00268 }; 00269 00270 } // namespace stk_classic 00271 00272 #ifdef STK_BUILT_IN_SIERRA 00273 #undef VERSION // Nice, Trilinos leaves us this gem 00274 00275 namespace sierra { 00276 00277 typedef stk_classic::ProductRegistry ProductRegistry; 00278 00279 } // namespace sierra 00280 #endif // STK_BUILT_IN_SIERRA 00281 00282 00283 #endif // STK_UTIL_ENVIRONMENT_PRODUCTREGISTRY_HPP