Temporarily merge un-refactored modules into ripple_main

This commit is contained in:
Vinnie Falco
2013-06-01 20:54:16 -07:00
parent 456b6e5460
commit cd3195d901
12 changed files with 485 additions and 520 deletions

View File

@@ -6,7 +6,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include "modules/ripple_main/misc/ripple_HashValue.h"
#include "ripple_HashValue.h"
// VFALCO: TODO, Move this to someplace sensible!!

View File

@@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
std::size_t hash_value(const uint256& u)
{
std::size_t seed = theApp->getNonceST();
return u.hash_combine(seed);
}
std::size_t hash_value(const uint160& u)
{
std::size_t seed = theApp->getNonceST();
return u.hash_combine(seed);
}
std::size_t hash_value(const CBase58Data& b58)
{
std::size_t seed = theApp->getNonceST() + (b58.nVersion * 0x9e3779b9);
boost::hash_combine(seed, b58.vchData);
return seed;
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef RIPPLE_HASH_VALUE_H
#define RIPPLE_HASH_VALUE_H
// VFALCO: TODO, clean this up
//
// These are needed for boost::hash stuff. The implemnetations access
// the Application object for the nonce, introducing a nasty dependency
// so I have split them away from the relevant classes and put them here.
extern std::size_t hash_value(const uint160&);
extern std::size_t hash_value(const uint256&);
extern std::size_t hash_value(const CBase58Data& b58);
#endif

View File

@@ -0,0 +1,40 @@
// VFALCO: NOTE, this looks like some facility for giving websocket
// a way to produce logging output.
//
namespace websocketpp
{
namespace log
{
LogPartition websocketPartition("WebSocket");
void websocketLog(websocketpp::log::alevel::value v, const std::string& entry)
{
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
{
if (websocketPartition.doLog(lsTRACE))
Log(lsDEBUG, websocketPartition) << entry;
}
else if (websocketPartition.doLog(lsDEBUG))
Log(lsDEBUG, websocketPartition) << entry;
}
void websocketLog(websocketpp::log::elevel::value v, const std::string& entry)
{
LogSeverity s = lsDEBUG;
if ((v & websocketpp::log::elevel::INFO) != 0)
s = lsINFO;
else if ((v & websocketpp::log::elevel::FATAL) != 0)
s = lsFATAL;
else if ((v & websocketpp::log::elevel::RERROR) != 0)
s = lsERROR;
else if ((v & websocketpp::log::elevel::WARN) != 0)
s = lsWARNING;
if (websocketPartition.doLog(s))
Log(s, websocketPartition) << entry;
}
}
}
// vim:ts=4