Anoncoin  0.9.4
P2P Digital Currency
coincontrol.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Copyright (c) 2013-2014 The Anoncoin Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef COINCONTROL_H
7 #define COINCONTROL_H
8 
9 #include "core.h"
10 
13 {
14 public:
16 
18  {
19  SetNull();
20  }
21 
22  void SetNull()
23  {
24  destChange = CNoDestination();
25  setSelected.clear();
26  }
27 
28  bool HasSelected() const
29  {
30  return (setSelected.size() > 0);
31  }
32 
33  bool IsSelected(const uint256& hash, unsigned int n) const
34  {
35  COutPoint outpt(hash, n);
36  return (setSelected.count(outpt) > 0);
37  }
38 
39  void Select(COutPoint& output)
40  {
41  setSelected.insert(output);
42  }
43 
44  void UnSelect(COutPoint& output)
45  {
46  setSelected.erase(output);
47  }
48 
49  void UnSelectAll()
50  {
51  setSelected.clear();
52  }
53 
54  void ListSelected(std::vector<COutPoint>& vOutpoints)
55  {
56  vOutpoints.assign(setSelected.begin(), setSelected.end());
57  }
58 
59 private:
60  std::set<COutPoint> setSelected;
61 
62 };
63 
64 #endif // COINCONTROL_H
bool IsSelected(const uint256 &hash, unsigned int n) const
Definition: coincontrol.h:33
Coin Control Features.
Definition: coincontrol.h:12
std::set< COutPoint > setSelected
Definition: coincontrol.h:60
void SetNull()
Definition: coincontrol.h:22
CTxDestination destChange
Definition: coincontrol.h:15
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: core.h:24
void UnSelectAll()
Definition: coincontrol.h:49
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: keystore.h:17
256-bit unsigned integer
Definition: uint256.h:532
void Select(COutPoint &output)
Definition: coincontrol.h:39
void ListSelected(std::vector< COutPoint > &vOutpoints)
Definition: coincontrol.h:54
void UnSelect(COutPoint &output)
Definition: coincontrol.h:44
bool HasSelected() const
Definition: coincontrol.h:28