changed get and operator functions to const ( using find operator of a map instead of [] )

release/4.3a0
Manohar Paluri 2009-08-27 20:04:10 +00:00
parent b70f081ebc
commit 630bc9144f
1 changed files with 10 additions and 2 deletions

View File

@ -53,8 +53,16 @@ public:
void erase(const std::string& key);
/** return node with given key */
inline ConditionalGaussian::shared_ptr get (const std::string& key) { return nodes[key];}
inline ConditionalGaussian::shared_ptr operator[](const std::string& key) { return nodes[key];}
inline ConditionalGaussian::shared_ptr get (const std::string& key) const
{
const_iterator cg = nodes.find(key); // get node
return cg->second;
}
inline ConditionalGaussian::shared_ptr operator[](const std::string& key) const
{
const_iterator cg = nodes.find(key); // get node
return cg->second;
}
/** return begin and end of the nodes. FD: breaks encapsulation? */
typedef Nodes::const_iterator const_iterator;