Browse Source

Repot defaults.

cl-refactor
Gav Wood 11 years ago
parent
commit
04453aada0
  1. 1
      eth/main.cpp
  2. 11
      libethereum/BlockChain.cpp
  3. 17
      libethereum/BlockChain.h
  4. 4
      libethereum/Client.cpp
  5. 33
      libethereum/Defaults.cpp
  6. 46
      libethereum/Defaults.h
  7. 4
      libethereum/State.cpp
  8. 1
      test/state.cpp

1
eth/main.cpp

@ -21,6 +21,7 @@
*/
#include <fstream>
#include "Defaults.h"
#include "Client.h"
#include "PeerNetwork.h"
#include "BlockChain.h"

11
libethereum/BlockChain.cpp

@ -19,6 +19,8 @@
* @date 2014
*/
#include "BlockChain.h"
#include <boost/filesystem.hpp>
#include "Common.h"
#include "RLP.h"
@ -26,8 +28,8 @@
#include "Dagger.h"
#include "BlockInfo.h"
#include "State.h"
#include "BlockChain.h"
#include "FileSystem.h"
#include "Defaults.h"
using namespace std;
using namespace eth;
@ -48,13 +50,6 @@ std::ostream& operator<<(std::ostream& _out, BlockChain const& _bc)
}
}
Defaults* Defaults::s_this = nullptr;
Defaults::Defaults()
{
m_dbPath = getDataDir();
}
BlockDetails::BlockDetails(RLP const& _r)
{
number = _r[0].toInt<uint>();

17
libethereum/BlockChain.h

@ -27,23 +27,6 @@ namespace ldb = leveldb;
namespace eth
{
struct Defaults
{
friend class BlockChain;
friend class State;
public:
Defaults();
static Defaults* get() { if (!s_this) s_this = new Defaults; return s_this; }
static void setDBPath(std::string const& _dbPath) { get()->m_dbPath = _dbPath; }
private:
std::string m_dbPath;
static Defaults* s_this;
};
class RLP;
class RLPStream;

4
libethereum/Client.cpp

@ -19,8 +19,10 @@
* @date 2014
*/
#include "Common.h"
#include "Client.h"
#include "Common.h"
#include "Defaults.h"
using namespace std;
using namespace eth;

33
libethereum/Defaults.cpp

@ -0,0 +1,33 @@
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file Defaults.cpp
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#include "Defaults.h"
#include "FileSystem.h"
using namespace std;
using namespace eth;
Defaults* Defaults::s_this = nullptr;
Defaults::Defaults()
{
m_dbPath = getDataDir();
}

46
libethereum/Defaults.h

@ -0,0 +1,46 @@
/*
This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file Defaults.h
* @author Gav Wood <i@gavwood.com>
* @date 2014
*/
#pragma once
#include "Common.h"
namespace eth
{
struct Defaults
{
friend class BlockChain;
friend class State;
public:
Defaults();
static Defaults* get() { if (!s_this) s_this = new Defaults; return s_this; }
static void setDBPath(std::string const& _dbPath) { get()->m_dbPath = _dbPath; }
private:
std::string m_dbPath;
static Defaults* s_this;
};
}

4
libethereum/State.cpp

@ -19,6 +19,8 @@
* @date 2014
*/
#include "State.h"
#include <secp256k1.h>
#include <boost/filesystem.hpp>
#if WIN32
@ -40,7 +42,7 @@
#include "Instruction.h"
#include "Exceptions.h"
#include "Dagger.h"
#include "State.h"
#include "Defaults.h"
using namespace std;
using namespace eth;

1
test/state.cpp

@ -23,6 +23,7 @@
#include <secp256k1.h>
#include <BlockChain.h>
#include <State.h>
#include <Defaults.h>
using namespace std;
using namespace eth;

Loading…
Cancel
Save