35 #include <stk_util/environment/ProductRegistry.hpp> 36 #ifdef STK_BUILT_IN_SIERRA 37 #include <stk_util/environment/stk_version.hpp> 39 #define STK_VERSION "0.1a" 89 return s_productRegistry;
98 static const char *s_version = STK_VERSION;
106 const std::string & name,
107 const std::string & version,
108 const std::string & qualifier)
110 std::pair<ProductMap::iterator, bool> iit = m_productMap.insert(std::make_pair(name,
AttributeMap()));
111 ProductMap::iterator it = iit.first;
113 (*it).second[
NAME] = name.c_str();
118 std::string ¤t_version = (*it).second[
VERSION];
119 std::string ¤t_qualifer = (*it).second[
QUALIFIER];
120 if (current_version.empty())
122 if (current_qualifer.empty())
123 current_qualifer = qualifier;
124 if (current_version !=
version || current_qualifer != qualifier) {
125 (*it).second[
ERROR] = std::string(
"Product registration of ") + (*it).first +
" version/qualifier conflict, " 127 +
" tried to change to " +
version +
"/" + qualifier;
139 std::pair<ProductMap::iterator, bool> iit = m_productMap.insert(std::make_pair(name,
AttributeMap()));
140 ProductMap::iterator it = iit.first;
142 (*it).second[
NAME] = name.c_str();
151 const std::string & name)
157 return attribute_map;
163 const std::string & name)
165 return m_productMap[name];
171 const std::string & name,
172 const std::string & attribute)
const 174 return m_productMap[name][attribute];
180 const std::string & name,
181 const std::string & attribute)
183 return m_productMap[name][attribute];
189 const std::string & name,
190 const std::string & attribute,
191 const std::string & value)
193 m_productMap[name][attribute] = value;
210 const char * version,
211 const char * qualifier )
static const std::string BANNER_DETAIL
Product's additional banner info attribute.
void product_registry_add(const char *name)
Extern "C" function product_registry_add provides a means for c programs to register a product...
static const std::string TITLE
Product's title attribute.
static const std::string PRODUCT_TYPE_REGION
Region product_type value.
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...
static const std::string BUILD_TIME
Product's build_time attribute.
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 CONTACT
Product's contact attribute.
static const char * version()
Member function version returns the version number of the combined product.
static ProductRegistry & instance()
Member function instance returns a reference to the registry singleton.
static const std::string REGION_TITLE
Product's region_title attribute.
const std::string & getProductAttribute(const std::string &name, const std::string &attribute) const
Member function getAttribute returns the attribute for the named product.
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 std::string QUALIFIER
TPL's qualifier attribute.
static const std::string EXECUTABLE
Product's executable attribute.
static const std::string COPYRIGHT
Product's copyright information.
std::map< std::string, std::string > AttributeMap
Map of attribute keyword to value.
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...
void product_registry_add_tpl(const char *name, const char *version, const char *qualifier)
Extern "C" function product_registry_add_tpl provides a means for c programs to register a tpl...
static const std::string ERROR
Product's error attribute.
static const std::string VERSION
TPL's version attribute.
static const std::string PRODUCT_TYPE
Product's product_type attribute.
void setRegistryInvalid()
Member function setRegistryInvalid marks th registry as contain a conflict of some sort...
static const std::string NAME
Product's name attribute.
AttributeMap & addProduct(const std::string &name)
Member function addProduct adds a product to the registry.
AttributeMap & getProductAttributeMap(const std::string &name)
Member function getProduct returns a reference to the product attribute map.