Revert "Improve namespace names"

This reverts commit 973df43fe0.

On a second thought, namespaces are close to classes in the sense that both encapsulate data, so they should both use Pascal case notation.
This commit is contained in:
Tiago Gomes
2013-02-08 21:01:53 +00:00
parent 264ef7a067
commit 6a1a209ee3
33 changed files with 381 additions and 382 deletions

View File

@@ -16,7 +16,6 @@
#include "Horus.h"
namespace horus {
namespace {
@@ -26,7 +25,7 @@ const double NEG_INF = -std::numeric_limits<double>::infinity();
}
namespace util {
namespace Util {
template <typename T> void
addToVector (std::vector<T>&, const std::vector<T>&);
@@ -88,7 +87,7 @@ unsigned nrDigits (int);
bool isInteger (const std::string&);
std::string parametersToString (
const Params&, unsigned = constants::PRECISION);
const Params&, unsigned = Constants::PRECISION);
std::vector<std::string> getStateLines (const Vars&);
@@ -107,7 +106,7 @@ void printDashedLine (std::ostream& os = std::cout);
template <typename T> void
util::addToVector (std::vector<T>& v, const std::vector<T>& elements)
Util::addToVector (std::vector<T>& v, const std::vector<T>& elements)
{
v.insert (v.end(), elements.begin(), elements.end());
}
@@ -115,7 +114,7 @@ util::addToVector (std::vector<T>& v, const std::vector<T>& elements)
template <typename T> void
util::addToSet (std::set<T>& s, const std::vector<T>& elements)
Util::addToSet (std::set<T>& s, const std::vector<T>& elements)
{
s.insert (elements.begin(), elements.end());
}
@@ -123,7 +122,7 @@ util::addToSet (std::set<T>& s, const std::vector<T>& elements)
template <typename T> void
util::addToQueue (std::queue<T>& q, const std::vector<T>& elements)
Util::addToQueue (std::queue<T>& q, const std::vector<T>& elements)
{
for (size_t i = 0; i < elements.size(); i++) {
q.push (elements[i]);
@@ -133,7 +132,7 @@ util::addToQueue (std::queue<T>& q, const std::vector<T>& elements)
template <typename T> bool
util::contains (const std::vector<T>& v, const T& e)
Util::contains (const std::vector<T>& v, const T& e)
{
return std::find (v.begin(), v.end(), e) != v.end();
}
@@ -141,7 +140,7 @@ util::contains (const std::vector<T>& v, const T& e)
template <typename T> bool
util::contains (const std::set<T>& s, const T& e)
Util::contains (const std::set<T>& s, const T& e)
{
return s.find (e) != s.end();
}
@@ -149,7 +148,7 @@ util::contains (const std::set<T>& s, const T& e)
template <typename K, typename V> bool
util::contains (const std::unordered_map<K, V>& m, const K& k)
Util::contains (const std::unordered_map<K, V>& m, const K& k)
{
return m.find (k) != m.end();
}
@@ -157,7 +156,7 @@ util::contains (const std::unordered_map<K, V>& m, const K& k)
template <typename T> size_t
util::indexOf (const std::vector<T>& v, const T& e)
Util::indexOf (const std::vector<T>& v, const T& e)
{
return std::distance (v.begin(),
std::find (v.begin(), v.end(), e));
@@ -166,7 +165,7 @@ util::indexOf (const std::vector<T>& v, const T& e)
template <class Operation> void
util::apply_n_times (
Util::apply_n_times (
Params& v1,
const Params& v2,
unsigned repetitions,
@@ -188,7 +187,7 @@ util::apply_n_times (
template <typename T> void
util::log (std::vector<T>& v)
Util::log (std::vector<T>& v)
{
std::transform (v.begin(), v.end(), v.begin(), ::log);
}
@@ -196,7 +195,7 @@ util::log (std::vector<T>& v)
template <typename T> void
util::exp (std::vector<T>& v)
Util::exp (std::vector<T>& v)
{
std::transform (v.begin(), v.end(), v.begin(), ::exp);
}
@@ -204,7 +203,7 @@ util::exp (std::vector<T>& v)
template <typename T> std::string
util::elementsToString (const std::vector<T>& v, std::string sep)
Util::elementsToString (const std::vector<T>& v, std::string sep)
{
std::stringstream ss;
for (size_t i = 0; i < v.size(); i++) {
@@ -216,7 +215,7 @@ util::elementsToString (const std::vector<T>& v, std::string sep)
template <typename T> std::string
util::toString (const T& t)
Util::toString (const T& t)
{
std::stringstream ss;
ss << t;
@@ -226,7 +225,7 @@ util::toString (const T& t)
inline double
util::logSum (double x, double y)
Util::logSum (double x, double y)
{
// std::log (std::exp (x) + std::exp (y)) can overflow!
assert (std::isnan (x) == false);
@@ -259,23 +258,23 @@ util::logSum (double x, double y)
inline unsigned
util::maxUnsigned (void)
Util::maxUnsigned (void)
{
return std::numeric_limits<unsigned>::max();
}
namespace log_aware {
namespace LogAware {
inline double one() { return globals::logDomain ? 0.0 : 1.0; }
inline double zero() { return globals::logDomain ? NEG_INF : 0.0; }
inline double addIdenty() { return globals::logDomain ? NEG_INF : 0.0; }
inline double multIdenty() { return globals::logDomain ? 0.0 : 1.0; }
inline double withEvidence() { return globals::logDomain ? 0.0 : 1.0; }
inline double noEvidence() { return globals::logDomain ? NEG_INF : 0.0; }
inline double log (double v) { return globals::logDomain ? ::log (v) : v; }
inline double exp (double v) { return globals::logDomain ? ::exp (v) : v; }
inline double one() { return Globals::logDomain ? 0.0 : 1.0; }
inline double zero() { return Globals::logDomain ? NEG_INF : 0.0; }
inline double addIdenty() { return Globals::logDomain ? NEG_INF : 0.0; }
inline double multIdenty() { return Globals::logDomain ? 0.0 : 1.0; }
inline double withEvidence() { return Globals::logDomain ? 0.0 : 1.0; }
inline double noEvidence() { return Globals::logDomain ? NEG_INF : 0.0; }
inline double log (double v) { return Globals::logDomain ? ::log (v) : v; }
inline double exp (double v) { return Globals::logDomain ? ::exp (v) : v; }
void normalize (Params&);
@@ -291,7 +290,7 @@ void pow (Params&, unsigned);
void pow (Params&, double);
} // namespace log_aware
} // namespace LogAware
@@ -393,7 +392,7 @@ template <typename T> std::ostream&
operator<< (std::ostream& os, const std::vector<T>& v)
{
os << "[" ;
os << util::elementsToString (v, ", ");
os << Util::elementsToString (v, ", ");
os << "]" ;
return os;
}