mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 15:21:30 +02:00
merge() functions are virtual to enable polymorphism
This commit is contained in:
@@ -80,6 +80,10 @@ namespace monero {
|
||||
return node;
|
||||
}
|
||||
|
||||
void MoneroBlock::merge(const shared_ptr<MoneroBlockHeader>& self, const shared_ptr<MoneroBlockHeader>& other) {
|
||||
merge(static_pointer_cast<MoneroBlock>(self), static_pointer_cast<MoneroBlock>(other));
|
||||
}
|
||||
|
||||
void MoneroBlock::merge(const shared_ptr<MoneroBlock>& self, const shared_ptr<MoneroBlock>& other) {
|
||||
if (this != self.get()) throw runtime_error("this != self");
|
||||
if (self == other) return;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace monero {
|
||||
boost::optional<string> powHash;
|
||||
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroBlockHeader>& self, const shared_ptr<MoneroBlockHeader>& other);
|
||||
virtual void merge(const shared_ptr<MoneroBlockHeader>& self, const shared_ptr<MoneroBlockHeader>& other);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -95,6 +95,7 @@ namespace monero {
|
||||
vector<string> txIds;
|
||||
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroBlockHeader>& self, const shared_ptr<MoneroBlockHeader>& other);
|
||||
void merge(const shared_ptr<MoneroBlock>& self, const shared_ptr<MoneroBlock>& other);
|
||||
};
|
||||
|
||||
@@ -144,7 +145,7 @@ namespace monero {
|
||||
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
boost::optional<uint64_t> getHeight() const;
|
||||
void merge(const shared_ptr<MoneroTx>& self, const shared_ptr<MoneroTx>& other);
|
||||
virtual void merge(const shared_ptr<MoneroTx>& self, const shared_ptr<MoneroTx>& other) ;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -170,6 +171,6 @@ namespace monero {
|
||||
boost::optional<string> stealthPublicKey;
|
||||
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroOutput>& self, const shared_ptr<MoneroOutput>& other);
|
||||
virtual void merge(const shared_ptr<MoneroOutput>& self, const shared_ptr<MoneroOutput>& other);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace monero {
|
||||
return !incomingTransfers.empty();
|
||||
}
|
||||
|
||||
void MoneroTxWallet::merge(const shared_ptr<MoneroTx>& self, const shared_ptr<MoneroTx>& other) {
|
||||
cout << "MoneroTxWallet::merge(MoneroTx&, MoneroTx&)" << endl;
|
||||
merge(static_pointer_cast<MoneroTxWallet>(self), static_pointer_cast<MoneroTxWallet>(other));
|
||||
}
|
||||
|
||||
void MoneroTxWallet::merge(const shared_ptr<MoneroTxWallet>& self, const shared_ptr<MoneroTxWallet>& other) {
|
||||
cout << "MoneroTxWallet::merge()" << endl;
|
||||
if (this != self.get()) throw runtime_error("this != self");
|
||||
@@ -382,11 +387,6 @@ namespace monero {
|
||||
return node;
|
||||
}
|
||||
|
||||
void MoneroOutputWallet::merge(const shared_ptr<MoneroOutputWallet>& self, const shared_ptr<MoneroOutputWallet>& other) {
|
||||
cout << "MoneroOutputWallet::merge()" << endl;
|
||||
throw runtime_error("not implemented");
|
||||
}
|
||||
|
||||
// ------------------------ MONERO OUTPUT REQUEST ---------------------------
|
||||
|
||||
boost::property_tree::ptree MoneroOutputRequest::toPropertyTree() const {
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace monero {
|
||||
return !(*getIsIncoming());
|
||||
}
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroTransfer>& self, const shared_ptr<MoneroTransfer>& other);
|
||||
virtual void merge(const shared_ptr<MoneroTransfer>& self, const shared_ptr<MoneroTransfer>& other);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -161,7 +161,6 @@ namespace monero {
|
||||
boost::optional<bool> isFrozen;
|
||||
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroOutputWallet>& self, const shared_ptr<MoneroOutputWallet>& other);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -189,6 +188,7 @@ namespace monero {
|
||||
bool getIsIncoming() const;
|
||||
bool getIsOutgoing() const;
|
||||
boost::property_tree::ptree toPropertyTree() const;
|
||||
void merge(const shared_ptr<MoneroTx>& self, const shared_ptr<MoneroTx>& other);
|
||||
void merge(const shared_ptr<MoneroTxWallet>& self, const shared_ptr<MoneroTxWallet>& other);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user