Merge remote-tracking branch 'origin/bug/235-corrupt-chain-file' into bug/235-corrupt-chain-file
This commit is contained in:
commit
f52648b6e5
11 changed files with 1041 additions and 1041 deletions
|
|
@ -542,9 +542,9 @@ void betting_market_group_object::dispatch_new_status(database& db, betting_mark
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
o("id", fc::variant(betting_market_group_obj.id, max_depth))
|
o("id", fc::variant(betting_market_group_obj.id, max_depth))
|
||||||
("description", fc::variant(betting_market_group_obj.description, max_depth))
|
("description", fc::variant(betting_market_group_obj.description, max_depth))
|
||||||
|
|
@ -558,11 +558,11 @@ void to_variant(const graphene::chain::betting_market_group_object& betting_mark
|
||||||
("status", fc::variant(betting_market_group_obj.get_status(), max_depth));
|
("status", fc::variant(betting_market_group_obj.get_status(), max_depth));
|
||||||
|
|
||||||
v = o;
|
v = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
betting_market_group_obj.id = v["id"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
betting_market_group_obj.id = v["id"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
||||||
betting_market_group_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
betting_market_group_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||||
betting_market_group_obj.event_id = v["event_id"].as<graphene::chain::event_id_type>( max_depth );
|
betting_market_group_obj.event_id = v["event_id"].as<graphene::chain::event_id_type>( max_depth );
|
||||||
|
|
@ -573,6 +573,6 @@ void from_variant(const fc::variant& v, graphene::chain::betting_market_group_ob
|
||||||
betting_market_group_obj.settling_time = v["settling_time"].as<fc::optional<fc::time_point_sec>>( max_depth );
|
betting_market_group_obj.settling_time = v["settling_time"].as<fc::optional<fc::time_point_sec>>( max_depth );
|
||||||
graphene::chain::betting_market_group_status status = v["status"].as<graphene::chain::betting_market_group_status>( max_depth );
|
graphene::chain::betting_market_group_status status = v["status"].as<graphene::chain::betting_market_group_status>( max_depth );
|
||||||
const_cast<int*>(betting_market_group_obj.my->state_machine.current_state())[0] = (int)status;
|
const_cast<int*>(betting_market_group_obj.my->state_machine.current_state())[0] = (int)status;
|
||||||
}
|
}
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,9 +467,9 @@ void betting_market_object::on_canceled_event(database& db)
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect betting_market_object to variant to properly reflect "state"
|
// Manually reflect betting_market_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
o("id", fc::variant(event_obj.id, max_depth) )
|
o("id", fc::variant(event_obj.id, max_depth) )
|
||||||
("group_id", fc::variant(event_obj.group_id, max_depth))
|
("group_id", fc::variant(event_obj.group_id, max_depth))
|
||||||
|
|
@ -479,11 +479,11 @@ void to_variant(const graphene::chain::betting_market_object& event_obj, fc::var
|
||||||
("status", fc::variant(event_obj.get_status(), max_depth));
|
("status", fc::variant(event_obj.get_status(), max_depth));
|
||||||
|
|
||||||
v = o;
|
v = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually reflect betting_market_object to variant to properly reflect "state"
|
// Manually reflect betting_market_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
event_obj.id = v["id"].as<graphene::chain::betting_market_id_type>( max_depth );
|
event_obj.id = v["id"].as<graphene::chain::betting_market_id_type>( max_depth );
|
||||||
event_obj.group_id = v["name"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
event_obj.group_id = v["name"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
||||||
event_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
event_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||||
|
|
@ -491,5 +491,5 @@ void from_variant(const fc::variant& v, graphene::chain::betting_market_object&
|
||||||
event_obj.resolution = v["resolution"].as<fc::optional<graphene::chain::betting_market_resolution_type>>( max_depth );
|
event_obj.resolution = v["resolution"].as<fc::optional<graphene::chain::betting_market_resolution_type>>( max_depth );
|
||||||
graphene::chain::betting_market_status status = v["status"].as<graphene::chain::betting_market_status>( max_depth );
|
graphene::chain::betting_market_status status = v["status"].as<graphene::chain::betting_market_status>( max_depth );
|
||||||
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
||||||
}
|
}
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors.
|
* Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors.
|
||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEFAULT_LOGGER "betting"
|
#define DEFAULT_LOGGER "betting"
|
||||||
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#include <boost/msm/back/tools.hpp>
|
#include <boost/msm/back/tools.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
enum class event_state {
|
enum class event_state {
|
||||||
upcoming,
|
upcoming,
|
||||||
frozen_upcoming,
|
frozen_upcoming,
|
||||||
in_progress,
|
in_progress,
|
||||||
|
|
@ -44,7 +44,7 @@ enum class event_state {
|
||||||
finished,
|
finished,
|
||||||
canceled,
|
canceled,
|
||||||
settled
|
settled
|
||||||
};
|
};
|
||||||
} }
|
} }
|
||||||
|
|
||||||
FC_REFLECT_ENUM(graphene::chain::event_state,
|
FC_REFLECT_ENUM(graphene::chain::event_state,
|
||||||
|
|
@ -58,65 +58,65 @@ FC_REFLECT_ENUM(graphene::chain::event_state,
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
namespace msm = boost::msm;
|
namespace msm = boost::msm;
|
||||||
namespace mpl = boost::mpl;
|
namespace mpl = boost::mpl;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
// Events -- most events happen when the witnesses publish an event_update operation with a new
|
// Events -- most events happen when the witnesses publish an event_update operation with a new
|
||||||
// status, so if they publish an event with the status set to `frozen`, we'll generate a `frozen_event`
|
// status, so if they publish an event with the status set to `frozen`, we'll generate a `frozen_event`
|
||||||
struct upcoming_event
|
struct upcoming_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
upcoming_event(database& db) : db(db) {}
|
upcoming_event(database& db) : db(db) {}
|
||||||
};
|
};
|
||||||
struct in_progress_event
|
struct in_progress_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
in_progress_event(database& db) : db(db) {}
|
in_progress_event(database& db) : db(db) {}
|
||||||
};
|
};
|
||||||
struct frozen_event
|
struct frozen_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
frozen_event(database& db) : db(db) {}
|
frozen_event(database& db) : db(db) {}
|
||||||
};
|
};
|
||||||
struct finished_event
|
struct finished_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
finished_event(database& db) : db(db) {}
|
finished_event(database& db) : db(db) {}
|
||||||
};
|
};
|
||||||
struct canceled_event
|
struct canceled_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
canceled_event(database& db) : db(db) {}
|
canceled_event(database& db) : db(db) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// event triggered when a betting market group in this event is resolved,
|
// event triggered when a betting market group in this event is resolved,
|
||||||
// when we get this, check and see if all betting market groups are now
|
// when we get this, check and see if all betting market groups are now
|
||||||
// canceled/settled; if so, transition the event to canceled/settled,
|
// canceled/settled; if so, transition the event to canceled/settled,
|
||||||
// otherwise remain in the current state
|
// otherwise remain in the current state
|
||||||
struct betting_market_group_resolved_event
|
struct betting_market_group_resolved_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
betting_market_group_id_type resolved_group;
|
betting_market_group_id_type resolved_group;
|
||||||
bool was_canceled;
|
bool was_canceled;
|
||||||
betting_market_group_resolved_event(database& db, betting_market_group_id_type resolved_group, bool was_canceled) : db(db), resolved_group(resolved_group), was_canceled(was_canceled) {}
|
betting_market_group_resolved_event(database& db, betting_market_group_id_type resolved_group, bool was_canceled) : db(db), resolved_group(resolved_group), was_canceled(was_canceled) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// event triggered when a betting market group is closed. When we get this,
|
// event triggered when a betting market group is closed. When we get this,
|
||||||
// if all child betting market groups are closed, transition to finished
|
// if all child betting market groups are closed, transition to finished
|
||||||
struct betting_market_group_closed_event
|
struct betting_market_group_closed_event
|
||||||
{
|
{
|
||||||
database& db;
|
database& db;
|
||||||
betting_market_group_id_type closed_group;
|
betting_market_group_id_type closed_group;
|
||||||
betting_market_group_closed_event(database& db, betting_market_group_id_type closed_group) : db(db), closed_group(closed_group) {}
|
betting_market_group_closed_event(database& db, betting_market_group_id_type closed_group) : db(db), closed_group(closed_group) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
struct event_state_machine_ : public msm::front::state_machine_def<event_state_machine_>
|
struct event_state_machine_ : public msm::front::state_machine_def<event_state_machine_>
|
||||||
|
|
||||||
{
|
{
|
||||||
// disable a few state machine features we don't use for performance
|
// disable a few state machine features we don't use for performance
|
||||||
typedef int no_exception_thrown;
|
typedef int no_exception_thrown;
|
||||||
typedef int no_message_queue;
|
typedef int no_message_queue;
|
||||||
|
|
@ -344,7 +344,6 @@ struct event_state_machine_ : public msm::front::state_machine_def<event_state_m
|
||||||
{
|
{
|
||||||
FC_THROW_EXCEPTION(graphene::chain::no_transition, "No transition");
|
FC_THROW_EXCEPTION(graphene::chain::no_transition, "No transition");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Fsm>
|
template <class Fsm>
|
||||||
void no_transition(canceled_event const& e, Fsm&, int state)
|
void no_transition(canceled_event const& e, Fsm&, int state)
|
||||||
{
|
{
|
||||||
|
|
@ -354,25 +353,25 @@ struct event_state_machine_ : public msm::front::state_machine_def<event_state_m
|
||||||
|
|
||||||
event_object* event_obj;
|
event_object* event_obj;
|
||||||
event_state_machine_(event_object* event_obj) : event_obj(event_obj) {}
|
event_state_machine_(event_object* event_obj) : event_obj(event_obj) {}
|
||||||
};
|
};
|
||||||
typedef msm::back::state_machine<event_state_machine_> event_state_machine;
|
typedef msm::back::state_machine<event_state_machine_> event_state_machine;
|
||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
class event_object::impl {
|
class event_object::impl {
|
||||||
public:
|
public:
|
||||||
event_state_machine state_machine;
|
event_state_machine state_machine;
|
||||||
|
|
||||||
impl(event_object* self) : state_machine(self) {}
|
impl(event_object* self) : state_machine(self) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
event_object::event_object() :
|
event_object::event_object() :
|
||||||
at_least_one_betting_market_group_settled(false),
|
at_least_one_betting_market_group_settled(false),
|
||||||
my(new impl(this))
|
my(new impl(this))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
event_object::event_object(const event_object& rhs) :
|
event_object::event_object(const event_object& rhs) :
|
||||||
graphene::db::abstract_object<event_object>(rhs),
|
graphene::db::abstract_object<event_object>(rhs),
|
||||||
name(rhs.name),
|
name(rhs.name),
|
||||||
season(rhs.season),
|
season(rhs.season),
|
||||||
|
|
@ -381,13 +380,13 @@ event_object::event_object(const event_object& rhs) :
|
||||||
at_least_one_betting_market_group_settled(rhs.at_least_one_betting_market_group_settled),
|
at_least_one_betting_market_group_settled(rhs.at_least_one_betting_market_group_settled),
|
||||||
scores(rhs.scores),
|
scores(rhs.scores),
|
||||||
my(new impl(this))
|
my(new impl(this))
|
||||||
{
|
{
|
||||||
my->state_machine = rhs.my->state_machine;
|
my->state_machine = rhs.my->state_machine;
|
||||||
my->state_machine.event_obj = this;
|
my->state_machine.event_obj = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_object& event_object::operator=(const event_object& rhs)
|
event_object& event_object::operator=(const event_object& rhs)
|
||||||
{
|
{
|
||||||
//graphene::db::abstract_object<event_object>::operator=(rhs);
|
//graphene::db::abstract_object<event_object>::operator=(rhs);
|
||||||
id = rhs.id;
|
id = rhs.id;
|
||||||
name = rhs.name;
|
name = rhs.name;
|
||||||
|
|
@ -401,16 +400,16 @@ event_object& event_object::operator=(const event_object& rhs)
|
||||||
my->state_machine.event_obj = this;
|
my->state_machine.event_obj = this;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_object::~event_object()
|
event_object::~event_object()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool verify_event_status_constants()
|
bool verify_event_status_constants()
|
||||||
{
|
{
|
||||||
unsigned error_count = 0;
|
unsigned error_count = 0;
|
||||||
typedef msm::back::generate_state_set<event_state_machine::stt>::type all_states;
|
typedef msm::back::generate_state_set<event_state_machine::stt>::type all_states;
|
||||||
static char const* filled_state_names[mpl::size<all_states>::value];
|
static char const* filled_state_names[mpl::size<all_states>::value];
|
||||||
|
|
@ -445,11 +444,11 @@ bool verify_event_status_constants()
|
||||||
wlog("There were ${count} errors in the event status constants", ("count", error_count));
|
wlog("There were ${count} errors in the event status constants", ("count", error_count));
|
||||||
|
|
||||||
return error_count == 0;
|
return error_count == 0;
|
||||||
}
|
}
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
event_status event_object::get_status() const
|
event_status event_object::get_status() const
|
||||||
{
|
{
|
||||||
static bool state_constants_are_correct = verify_event_status_constants();
|
static bool state_constants_are_correct = verify_event_status_constants();
|
||||||
(void)&state_constants_are_correct;
|
(void)&state_constants_are_correct;
|
||||||
event_state state = (event_state)my->state_machine.current_state()[0];
|
event_state state = (event_state)my->state_machine.current_state()[0];
|
||||||
|
|
@ -474,60 +473,60 @@ event_status event_object::get_status() const
|
||||||
default:
|
default:
|
||||||
FC_THROW("Unexpected event state");
|
FC_THROW("Unexpected event state");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::pack_impl(std::ostream& stream) const
|
void event_object::pack_impl(std::ostream& stream) const
|
||||||
{
|
{
|
||||||
boost::archive::binary_oarchive oa(stream, boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_xml_tag_checking);
|
boost::archive::binary_oarchive oa(stream, boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_xml_tag_checking);
|
||||||
oa << my->state_machine;
|
oa << my->state_machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::unpack_impl(std::istream& stream)
|
void event_object::unpack_impl(std::istream& stream)
|
||||||
{
|
{
|
||||||
boost::archive::binary_iarchive ia(stream, boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_xml_tag_checking);
|
boost::archive::binary_iarchive ia(stream, boost::archive::no_header|boost::archive::no_codecvt|boost::archive::no_xml_tag_checking);
|
||||||
ia >> my->state_machine;
|
ia >> my->state_machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_upcoming_event(database& db)
|
void event_object::on_upcoming_event(database& db)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(upcoming_event(db));
|
my->state_machine.process_event(upcoming_event(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_in_progress_event(database& db)
|
void event_object::on_in_progress_event(database& db)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(in_progress_event(db));
|
my->state_machine.process_event(in_progress_event(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_frozen_event(database& db)
|
void event_object::on_frozen_event(database& db)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(frozen_event(db));
|
my->state_machine.process_event(frozen_event(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_finished_event(database& db)
|
void event_object::on_finished_event(database& db)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(finished_event(db));
|
my->state_machine.process_event(finished_event(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_canceled_event(database& db)
|
void event_object::on_canceled_event(database& db)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(canceled_event(db));
|
my->state_machine.process_event(canceled_event(db));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_betting_market_group_resolved(database& db, betting_market_group_id_type resolved_group, bool was_canceled)
|
void event_object::on_betting_market_group_resolved(database& db, betting_market_group_id_type resolved_group, bool was_canceled)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(betting_market_group_resolved_event(db, resolved_group, was_canceled));
|
my->state_machine.process_event(betting_market_group_resolved_event(db, resolved_group, was_canceled));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_object::on_betting_market_group_closed(database& db, betting_market_group_id_type closed_group)
|
void event_object::on_betting_market_group_closed(database& db, betting_market_group_id_type closed_group)
|
||||||
{
|
{
|
||||||
my->state_machine.process_event(betting_market_group_closed_event(db, closed_group));
|
my->state_machine.process_event(betting_market_group_closed_event(db, closed_group));
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are the only statuses that can be explicitly set by witness operations. The missing
|
// These are the only statuses that can be explicitly set by witness operations. The missing
|
||||||
// status, 'settled', is automatically set when all of the betting market groups have
|
// status, 'settled', is automatically set when all of the betting market groups have
|
||||||
// settled/canceled
|
// settled/canceled
|
||||||
void event_object::dispatch_new_status(database& db, event_status new_status)
|
void event_object::dispatch_new_status(database& db, event_status new_status)
|
||||||
{
|
{
|
||||||
switch (new_status) {
|
switch (new_status) {
|
||||||
case event_status::upcoming: // by witnesses to unfreeze a frozen event
|
case event_status::upcoming: // by witnesses to unfreeze a frozen event
|
||||||
on_upcoming_event(db);
|
on_upcoming_event(db);
|
||||||
|
|
@ -547,14 +546,14 @@ void event_object::dispatch_new_status(database& db, event_status new_status)
|
||||||
default:
|
default:
|
||||||
FC_THROW("Status ${new_status} cannot be explicitly set", ("new_status", new_status));
|
FC_THROW("Status ${new_status} cannot be explicitly set", ("new_status", new_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect event_object to variant to properly reflect "state"
|
// Manually reflect event_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
o("id", fc::variant(event_obj.id, max_depth))
|
o("id", fc::variant(event_obj.id, max_depth))
|
||||||
("name", fc::variant(event_obj.name, max_depth))
|
("name", fc::variant(event_obj.name, max_depth))
|
||||||
|
|
@ -565,11 +564,11 @@ void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v,
|
||||||
("status", fc::variant(event_obj.get_status(), max_depth));
|
("status", fc::variant(event_obj.get_status(), max_depth));
|
||||||
|
|
||||||
v = o;
|
v = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually reflect event_object to variant to properly reflect "state"
|
// Manually reflect event_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
event_obj.id = v["id"].as<graphene::chain::event_id_type>( max_depth );
|
event_obj.id = v["id"].as<graphene::chain::event_id_type>( max_depth );
|
||||||
event_obj.name = v["name"].as<graphene::chain::internationalized_string_type>( max_depth );
|
event_obj.name = v["name"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||||
event_obj.season = v["season"].as<graphene::chain::internationalized_string_type>( max_depth );
|
event_obj.season = v["season"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||||
|
|
@ -578,7 +577,7 @@ void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj
|
||||||
event_obj.scores = v["scores"].as<std::vector<std::string>>( max_depth );
|
event_obj.scores = v["scores"].as<std::vector<std::string>>( max_depth );
|
||||||
graphene::chain::event_status status = v["status"].as<graphene::chain::event_status>( max_depth );
|
graphene::chain::event_status status = v["status"].as<graphene::chain::event_status>( max_depth );
|
||||||
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
||||||
}
|
}
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -548,9 +548,9 @@ namespace graphene { namespace chain {
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect game_object to variant to properly reflect "state"
|
// Manually reflect game_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("tournament"), "In game_obj to_variant");
|
fc_elog(fc::logger::get("tournament"), "In game_obj to_variant");
|
||||||
elog("In game_obj to_variant");
|
elog("In game_obj to_variant");
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
|
|
@ -563,11 +563,11 @@ void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, ui
|
||||||
("state", fc::variant(game_obj.get_state(), max_depth ));
|
("state", fc::variant(game_obj.get_state(), max_depth ));
|
||||||
|
|
||||||
v = o;
|
v = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually reflect game_object to variant to properly reflect "state"
|
// Manually reflect game_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("tournament"), "In game_obj from_variant");
|
fc_elog(fc::logger::get("tournament"), "In game_obj from_variant");
|
||||||
game_obj.id = v["id"].as<graphene::chain::game_id_type>( max_depth );
|
game_obj.id = v["id"].as<graphene::chain::game_id_type>( max_depth );
|
||||||
game_obj.match_id = v["match_id"].as<graphene::chain::match_id_type>( max_depth );
|
game_obj.match_id = v["match_id"].as<graphene::chain::match_id_type>( max_depth );
|
||||||
|
|
@ -577,5 +577,7 @@ void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj,
|
||||||
game_obj.next_timeout = v["next_timeout"].as<fc::optional<time_point_sec> >( max_depth );
|
game_obj.next_timeout = v["next_timeout"].as<fc::optional<time_point_sec> >( max_depth );
|
||||||
graphene::chain::game_state state = v["state"].as<graphene::chain::game_state>( max_depth );
|
graphene::chain::game_state state = v["state"].as<graphene::chain::game_state>( max_depth );
|
||||||
const_cast<int*>(game_obj.my->state_machine.current_state())[0] = (int)state;
|
const_cast<int*>(game_obj.my->state_machine.current_state())[0] = (int)state;
|
||||||
}
|
}
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,15 +31,15 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
class betting_market_object;
|
class betting_market_object;
|
||||||
class betting_market_group_object;
|
class betting_market_group_object;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth = 1);
|
||||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth = 1);
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
@ -722,100 +722,100 @@ FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::betting_market_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::betting_market_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::betting_market_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::betting_market_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::betting_market_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::betting_market_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::betting_market_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::betting_market_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::betting_market_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::betting_market_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw::detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::betting_market_object> {
|
struct get_typename<graphene::chain::betting_market_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::betting_market_object";
|
return "graphene::chain::betting_market_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::betting_market_object> {
|
struct reflector<graphene::chain::betting_market_object> {
|
||||||
typedef graphene::chain::betting_market_object type;
|
typedef graphene::chain::betting_market_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::betting_market_group_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::betting_market_group_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::betting_market_group_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::betting_market_group_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::betting_market_group_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::betting_market_group_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::betting_market_group_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::betting_market_group_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::betting_market_group_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::betting_market_group_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw:detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::betting_market_group_object> {
|
struct get_typename<graphene::chain::betting_market_group_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::betting_market_group_object";
|
return "graphene::chain::betting_market_group_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::betting_market_group_object> {
|
struct reflector<graphene::chain::betting_market_group_object> {
|
||||||
typedef graphene::chain::betting_market_group_object type;
|
typedef graphene::chain::betting_market_group_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,26 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors.
|
* Copyright (c) 2018 Peerplays Blockchain Standards Association, and contributors.
|
||||||
*
|
*
|
||||||
* The MIT License
|
* The MIT License
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in
|
* The above copyright notice and this permission notice shall be included in
|
||||||
* all copies or substantial portions of the Software.
|
* all copies or substantial portions of the Software.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <graphene/chain/protocol/types.hpp>
|
#include <graphene/chain/protocol/types.hpp>
|
||||||
|
|
@ -32,12 +32,12 @@
|
||||||
#include <boost/multi_index/composite_key.hpp>
|
#include <boost/multi_index/composite_key.hpp>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
class event_object;
|
class event_object;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth = 1);
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
@ -46,7 +46,7 @@ class database;
|
||||||
|
|
||||||
class event_object : public graphene::db::abstract_object< event_object >
|
class event_object : public graphene::db::abstract_object< event_object >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const uint8_t space_id = protocol_ids;
|
static const uint8_t space_id = protocol_ids;
|
||||||
static const uint8_t type_id = event_object_type;
|
static const uint8_t type_id = event_object_type;
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ public:
|
||||||
void on_betting_market_group_resolved(database& db, betting_market_group_id_type resolved_group, bool was_canceled);
|
void on_betting_market_group_resolved(database& db, betting_market_group_id_type resolved_group, bool was_canceled);
|
||||||
void on_betting_market_group_closed(database& db, betting_market_group_id_type closed_group);
|
void on_betting_market_group_closed(database& db, betting_market_group_id_type closed_group);
|
||||||
void dispatch_new_status(database& db, event_status new_status);
|
void dispatch_new_status(database& db, event_status new_status);
|
||||||
private:
|
private:
|
||||||
class impl;
|
class impl;
|
||||||
std::unique_ptr<impl> my;
|
std::unique_ptr<impl> my;
|
||||||
};
|
};
|
||||||
|
|
@ -112,9 +112,9 @@ typedef multi_index_container<
|
||||||
|
|
||||||
typedef generic_index<event_object, event_object_multi_index_type> event_object_index;
|
typedef generic_index<event_object, event_object_multi_index_type> event_object_index;
|
||||||
|
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
inline Stream& operator<<( Stream& s, const event_object& event_obj )
|
inline Stream& operator<<( Stream& s, const event_object& event_obj )
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("event"), "In event_obj to_raw");
|
fc_elog(fc::logger::get("event"), "In event_obj to_raw");
|
||||||
// pack all fields exposed in the header in the usual way
|
// pack all fields exposed in the header in the usual way
|
||||||
// instead of calling the derived pack, just serialize the one field in the base class
|
// instead of calling the derived pack, just serialize the one field in the base class
|
||||||
|
|
@ -134,10 +134,10 @@ inline Stream& operator<<( Stream& s, const event_object& event_obj )
|
||||||
fc::raw::pack(s, stream.str());
|
fc::raw::pack(s, stream.str());
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
template<typename Stream>
|
template<typename Stream>
|
||||||
inline Stream& operator>>( Stream& s, event_object& event_obj )
|
inline Stream& operator>>( Stream& s, event_object& event_obj )
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("event"), "In event_obj from_raw");
|
fc_elog(fc::logger::get("event"), "In event_obj from_raw");
|
||||||
// unpack all fields exposed in the header in the usual way
|
// unpack all fields exposed in the header in the usual way
|
||||||
//fc::raw::unpack<Stream, graphene::db::abstract_object<event_object> >(s, event_obj);
|
//fc::raw::unpack<Stream, graphene::db::abstract_object<event_object> >(s, event_obj);
|
||||||
|
|
@ -156,55 +156,55 @@ inline Stream& operator>>( Stream& s, event_object& event_obj )
|
||||||
event_obj.unpack_impl(stream);
|
event_obj.unpack_impl(stream);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::event_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::event_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::event_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::event_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::event_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::event_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::event_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::event_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::event_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::event_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw::detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::event_object> {
|
struct get_typename<graphene::chain::event_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::event_object";
|
return "graphene::chain::event_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::event_object> {
|
struct reflector<graphene::chain::event_object> {
|
||||||
typedef graphene::chain::event_object type;
|
typedef graphene::chain::event_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
@ -30,12 +30,12 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
class game_object;
|
class game_object;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth = 1);
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
@ -164,50 +164,50 @@ FC_REFLECT_ENUM(graphene::chain::game_state,
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::game_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::game_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::game_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::game_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::game_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::game_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::game_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::game_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::game_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::game_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw::detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::game_object> {
|
struct get_typename<graphene::chain::game_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::game_object";
|
return "graphene::chain::game_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::game_object> {
|
struct reflector<graphene::chain::game_object> {
|
||||||
typedef graphene::chain::game_object type;
|
typedef graphene::chain::game_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
@ -5,12 +5,12 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
class match_object;
|
class match_object;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth = 1);
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -162,50 +162,50 @@ FC_REFLECT_ENUM(graphene::chain::match_state,
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::match_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::match_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::match_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::match_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::match_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::match_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::match_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::match_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::match_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::match_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw::detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::match_object> {
|
struct get_typename<graphene::chain::match_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::match_object";
|
return "graphene::chain::match_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::match_object> {
|
struct reflector<graphene::chain::match_object> {
|
||||||
typedef graphene::chain::match_object type;
|
typedef graphene::chain::match_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
class tournament_object;
|
class tournament_object;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth = 1);
|
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth = 1);
|
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth = 1);
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
@ -247,50 +247,50 @@ FC_REFLECT_ENUM(graphene::chain::tournament_state,
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::tournament_object &v, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::from_variant(const variant &vo, graphene::chain::tournament_object &v, uint32_t max_depth) {
|
||||||
from_variant(vo, v, max_depth);
|
from_variant(vo, v, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::tournament_object &v, variant &vo, uint32_t max_depth) {
|
inline void if_enum<fc::false_type>::to_variant(const graphene::chain::tournament_object &v, variant &vo, uint32_t max_depth) {
|
||||||
to_variant(v, vo, max_depth);
|
to_variant(v, vo, max_depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace raw { namespace detail {
|
namespace raw { namespace detail {
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::tournament_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<size_t> &s, const graphene::chain::tournament_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::tournament_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::pack(fc::datastream<char*> &s, const graphene::chain::tournament_object &v, uint32_t) {
|
||||||
s << v;
|
s << v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
template<>
|
template<>
|
||||||
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::tournament_object &v, uint32_t) {
|
inline void if_enum<fc::false_type>::unpack(fc::datastream<const char*> &s, graphene::chain::tournament_object &v, uint32_t) {
|
||||||
s >> v;
|
s >> v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} }
|
} } // namespace fc::raw::detail
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct get_typename<graphene::chain::tournament_object> {
|
struct get_typename<graphene::chain::tournament_object> {
|
||||||
static const char *name() {
|
static const char *name() {
|
||||||
return "graphene::chain::tournament_object";
|
return "graphene::chain::tournament_object";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
struct reflector<graphene::chain::tournament_object> {
|
struct reflector<graphene::chain::tournament_object> {
|
||||||
typedef graphene::chain::tournament_object type;
|
typedef graphene::chain::tournament_object type;
|
||||||
typedef fc::true_type is_defined;
|
typedef fc::true_type is_defined;
|
||||||
typedef fc::false_type is_enum;
|
typedef fc::false_type is_enum;
|
||||||
};
|
};
|
||||||
} // namespace fc
|
} // namespace fc
|
||||||
|
|
@ -363,9 +363,9 @@ namespace graphene { namespace chain {
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect match_object to variant to properly reflect "state"
|
// Manually reflect match_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{ try {
|
{ try {
|
||||||
fc_elog(fc::logger::get("tournament"), "In match_obj to_variant");
|
fc_elog(fc::logger::get("tournament"), "In match_obj to_variant");
|
||||||
elog("In match_obj to_variant");
|
elog("In match_obj to_variant");
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
|
|
@ -384,9 +384,9 @@ void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v,
|
||||||
v = o;
|
v = o;
|
||||||
} FC_RETHROW_EXCEPTIONS(warn, "") }
|
} FC_RETHROW_EXCEPTIONS(warn, "") }
|
||||||
|
|
||||||
// Manually reflect match_object to variant to properly reflect "state"
|
// Manually reflect match_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth)
|
||||||
{ try {
|
{ try {
|
||||||
fc_elog(fc::logger::get("tournament"), "In match_obj from_variant");
|
fc_elog(fc::logger::get("tournament"), "In match_obj from_variant");
|
||||||
match_obj.id = v["id"].as<graphene::chain::match_id_type>( max_depth );
|
match_obj.id = v["id"].as<graphene::chain::match_id_type>( max_depth );
|
||||||
match_obj.tournament_id = v["tournament_id"].as<graphene::chain::tournament_id_type>( max_depth );
|
match_obj.tournament_id = v["tournament_id"].as<graphene::chain::tournament_id_type>( max_depth );
|
||||||
|
|
|
||||||
|
|
@ -722,9 +722,9 @@ namespace graphene { namespace chain {
|
||||||
} } // graphene::chain
|
} } // graphene::chain
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
// Manually reflect tournament_object to variant to properly reflect "state"
|
// Manually reflect tournament_object to variant to properly reflect "state"
|
||||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth)
|
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("tournament"), "In tournament_obj to_variant");
|
fc_elog(fc::logger::get("tournament"), "In tournament_obj to_variant");
|
||||||
elog("In tournament_obj to_variant");
|
elog("In tournament_obj to_variant");
|
||||||
fc::mutable_variant_object o;
|
fc::mutable_variant_object o;
|
||||||
|
|
@ -739,11 +739,11 @@ void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::va
|
||||||
("state", fc::variant(tournament_obj.get_state(), max_depth));
|
("state", fc::variant(tournament_obj.get_state(), max_depth));
|
||||||
|
|
||||||
v = o;
|
v = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually reflect tournament_object to variant to properly reflect "state"
|
// Manually reflect tournament_object to variant to properly reflect "state"
|
||||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth)
|
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth)
|
||||||
{
|
{
|
||||||
fc_elog(fc::logger::get("tournament"), "In tournament_obj from_variant");
|
fc_elog(fc::logger::get("tournament"), "In tournament_obj from_variant");
|
||||||
tournament_obj.id = v["id"].as<graphene::chain::tournament_id_type>( max_depth );
|
tournament_obj.id = v["id"].as<graphene::chain::tournament_id_type>( max_depth );
|
||||||
tournament_obj.creator = v["creator"].as<graphene::chain::account_id_type>( max_depth );
|
tournament_obj.creator = v["creator"].as<graphene::chain::account_id_type>( max_depth );
|
||||||
|
|
@ -755,8 +755,7 @@ void from_variant(const fc::variant& v, graphene::chain::tournament_object& tour
|
||||||
tournament_obj.tournament_details_id = v["tournament_details_id"].as<graphene::chain::tournament_details_id_type>( max_depth );
|
tournament_obj.tournament_details_id = v["tournament_details_id"].as<graphene::chain::tournament_details_id_type>( max_depth );
|
||||||
graphene::chain::tournament_state state = v["state"].as<graphene::chain::tournament_state>( max_depth );
|
graphene::chain::tournament_state state = v["state"].as<graphene::chain::tournament_state>( max_depth );
|
||||||
const_cast<int*>(tournament_obj.my->state_machine.current_state())[0] = (int)state;
|
const_cast<int*>(tournament_obj.my->state_machine.current_state())[0] = (int)state;
|
||||||
}
|
}
|
||||||
} //end namespace fc
|
} //end namespace fc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue