#ifndef __ACCOUNTSTATE__ #define __ACCOUNTSTATE__ // An account's state in one or more accepted ledgers #include #include "boost/shared_ptr.hpp" #include "types.h" #include "uint256.h" class AccountState { public: typedef boost::shared_ptr pointer; private: uint160 mAccountID; uint64 mBalance; uint32 mAccountSeq; bool mValid; public: AccountState(const uint160& mAccountID); // new account AccountState(const std::vector&); // raw form const uint160& getAccountID() const { return mAccountID; } uint64 getBalance() const { return mBalance; } uint32 getSeq() const { return mAccountSeq; } bool charge(uint64 a) { mBalance+=a; } bool credit(uint64 a) { assert(mBalance>=a); mBalance-=a; } void incSeq(void) { mAccountSeq++; } void decSeq(void) { assert(mAccountSeq!=0); mAccountSeq--; } std::vector getRaw() const; }; #endif