forked from PBSA/peerplays
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Peerplays SON plugin skeleton (#122)
* Peerplays SON plugin skeleton * SON tests skeleton
- Loading branch information
obucinac
authored
Sep 11, 2019
1 parent
d1a2ea1
commit 7553091
Showing
8 changed files
with
140 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
file(GLOB HEADERS "include/graphene/peerplays_sidechain_history/*.hpp") | ||
|
||
add_library( peerplays_sidechain | ||
peerplays_sidechain_plugin.cpp | ||
) | ||
|
||
target_link_libraries( peerplays_sidechain graphene_chain graphene_app ) | ||
target_include_directories( peerplays_sidechain | ||
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) | ||
|
||
install( TARGETS | ||
peerplays_sidechain | ||
|
||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/peerplays_sidechain" ) | ||
|
34 changes: 34 additions & 0 deletions
34
...s/peerplays_sidechain/include/graphene/peerplays_sidechain/peerplays_sidechain_plugin.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#pragma once | ||
|
||
#include <graphene/app/plugin.hpp> | ||
#include <graphene/chain/database.hpp> | ||
#include <graphene/chain/account_object.hpp> | ||
|
||
#include <fc/thread/future.hpp> | ||
|
||
namespace graphene { namespace peerplays_sidechain { | ||
using namespace chain; | ||
|
||
namespace detail | ||
{ | ||
class peerplays_sidechain_plugin_impl; | ||
} | ||
|
||
class peerplays_sidechain_plugin : public graphene::app::plugin | ||
{ | ||
public: | ||
peerplays_sidechain_plugin(); | ||
virtual ~peerplays_sidechain_plugin(); | ||
|
||
std::string plugin_name()const override; | ||
virtual void plugin_set_program_options( | ||
boost::program_options::options_description& cli, | ||
boost::program_options::options_description& cfg) override; | ||
virtual void plugin_initialize(const boost::program_options::variables_map& options) override; | ||
virtual void plugin_startup() override; | ||
|
||
std::unique_ptr<detail::peerplays_sidechain_plugin_impl> my; | ||
}; | ||
|
||
} } //graphene::peerplays_sidechain_plugin | ||
|
59 changes: 59 additions & 0 deletions
59
libraries/plugins/peerplays_sidechain/peerplays_sidechain_plugin.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <graphene/peerplays_sidechain/peerplays_sidechain_plugin.hpp> | ||
|
||
namespace graphene { namespace peerplays_sidechain { | ||
|
||
namespace detail | ||
{ | ||
|
||
|
||
class peerplays_sidechain_plugin_impl | ||
{ | ||
public: | ||
peerplays_sidechain_plugin_impl(peerplays_sidechain_plugin& _plugin) | ||
: _self( _plugin ) | ||
{ } | ||
virtual ~peerplays_sidechain_plugin_impl(); | ||
|
||
peerplays_sidechain_plugin& _self; | ||
}; | ||
|
||
peerplays_sidechain_plugin_impl::~peerplays_sidechain_plugin_impl() | ||
{ | ||
return; | ||
} | ||
|
||
} // end namespace detail | ||
|
||
peerplays_sidechain_plugin::peerplays_sidechain_plugin() : | ||
my( new detail::peerplays_sidechain_plugin_impl(*this) ) | ||
{ | ||
} | ||
|
||
peerplays_sidechain_plugin::~peerplays_sidechain_plugin() | ||
{ | ||
return; | ||
} | ||
|
||
std::string peerplays_sidechain_plugin::plugin_name()const | ||
{ | ||
return "peerplays_sidechain"; | ||
} | ||
|
||
void peerplays_sidechain_plugin::plugin_set_program_options( | ||
boost::program_options::options_description& /*cli*/, | ||
boost::program_options::options_description& /*cfg*/ | ||
) | ||
{ | ||
} | ||
|
||
void peerplays_sidechain_plugin::plugin_initialize(const boost::program_options::variables_map& /*options*/) | ||
{ | ||
ilog("peerplays sidechain plugin: plugin_initialize()"); | ||
} | ||
|
||
void peerplays_sidechain_plugin::plugin_startup() | ||
{ | ||
ilog("peerplays sidechain plugin: plugin_startup()"); | ||
} | ||
|
||
} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <boost/test/unit_test.hpp> | ||
|
||
#define BOOST_TEST_MODULE Peerplays SON Tests | ||
|
||
BOOST_AUTO_TEST_CASE(peerplays_sidechain) | ||
{ | ||
|
||
} | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
#include <boost/test/included/unit_test.hpp> | ||
|
||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { | ||
std::srand(time(NULL)); | ||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl; | ||
|
||
return nullptr; | ||
} | ||
|