10 #include <stk_util/environment/ProductRegistry.hpp> 11 #ifdef STK_BUILT_IN_SIERRA 12 #include <stk_util/environment/stk_version.hpp> 14 #define STK_VERSION "0.1a" 64 return s_productRegistry;
73 static const char *s_version = STK_VERSION;
81 const std::string & name,
83 const std::string & qualifier)
85 std::pair<ProductMap::iterator, bool> iit = m_productMap.insert(std::make_pair(name,
AttributeMap()));
86 ProductMap::iterator it = iit.first;
88 (*it).second[
NAME] = name.c_str();
93 std::string ¤t_version = (*it).second[
VERSION];
94 std::string ¤t_qualifer = (*it).second[
QUALIFIER];
95 if (current_version.empty())
96 current_version = version;
97 if (current_qualifer.empty())
98 current_qualifer = qualifier;
99 if (current_version != version || current_qualifer != qualifier) {
100 (*it).second[
ERROR] = std::string(
"Product registration of ") + (*it).first +
" version/qualifier conflict, " 102 +
" tried to change to " + version +
"/" + qualifier;
114 std::pair<ProductMap::iterator, bool> iit = m_productMap.insert(std::make_pair(name,
AttributeMap()));
115 ProductMap::iterator it = iit.first;
117 (*it).second[
NAME] = name.c_str();
126 const std::string & name)
132 return attribute_map;
138 const std::string & name)
140 return m_productMap[name];
146 const std::string & name,
147 const std::string & attribute)
const 149 return m_productMap[name][attribute];
155 const std::string & name,
156 const std::string & attribute)
158 return m_productMap[name][attribute];
164 const std::string & name,
165 const std::string & attribute,
166 const std::string & value)
168 m_productMap[name][attribute] = value;
187 const char * qualifier )
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...
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's product_type attribute.
static const std::string REGION_TITLE
Product's region_title 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 NAME
Product's name attribute.
static const std::string PRODUCT_TYPE_REGION
Region product_type value.
static const std::string TITLE
Product's title attribute.
static const std::string BANNER_DETAIL
Product's additional banner info attribute.
static const std::string COPYRIGHT
Product's copyright information.
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's qualifier attribute.
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's contact attribute.
size_t product_registry_size()
Extern "C" function product_registry_size returns the number of products in the registry.
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'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's error attribute.
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 VERSION
TPL'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's build_time attribute.