Make many more utility classes/headers public. (#76)

Moving these headers from src to include enables other libraries to use the
functionality provided.

* tcpsockets
* atomic_static
* raw_istream
* timestamp
* SafeThread
* Base64
* LEB128
* ConcurrentQueue

The classes have been moved into the wpi namespace as they're generic.
This commit is contained in:
Peter Johnson
2016-07-27 00:39:38 -07:00
committed by GitHub
parent d66f65e376
commit a73166a665
47 changed files with 361 additions and 259 deletions

View File

@@ -11,8 +11,9 @@
#include <cstdio>
#include <cstdlib>
#include "Dispatcher.h"
#include "support/timestamp.h"
#include "Log.h"
#include "Dispatcher.h"
#include "Notifier.h"
#include "RpcServer.h"
#include "Storage.h"
@@ -168,7 +169,7 @@ std::string PackRpcDefinition(const RpcDefinition& def) {
}
bool UnpackRpcDefinition(StringRef packed, RpcDefinition* def) {
raw_mem_istream is(packed.data(), packed.size());
wpi::raw_mem_istream is(packed.data(), packed.size());
WireDecoder dec(is, 0x0300);
if (!dec.Read8(&def->version)) return false;
if (!dec.ReadString(&def->name)) return false;
@@ -211,7 +212,7 @@ std::string PackRpcValues(ArrayRef<std::shared_ptr<Value>> values) {
std::vector<std::shared_ptr<Value>> UnpackRpcValues(StringRef packed,
ArrayRef<NT_Type> types) {
raw_mem_istream is(packed.data(), packed.size());
wpi::raw_mem_istream is(packed.data(), packed.size());
WireDecoder dec(is, 0x0300);
std::vector<std::shared_ptr<Value>> vec;
for (auto type : types) {
@@ -281,6 +282,10 @@ const char* LoadPersistent(
return Storage::GetInstance().LoadPersistent(filename, warn);
}
unsigned long long Now() {
return wpi::Now();
}
void SetLogger(LogFunc func, unsigned int min_level) {
Logger& logger = Logger::GetInstance();
logger.SetLogger(func);