//Returns MemoryBlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original MemoryBlockchainStorage will contain elements from [0, splitIndex - 1]. //Returns MemoryBlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original MemoryBlockchainStorage will contain elements from [0, splitIndex - 1]. public override std::unique_ptr <BlockchainStorage.IBlockchainStorageInternal> splitStorage(uint splitIndex) { Debug.Assert(splitIndex > 0); Debug.Assert(splitIndex < blocks.Count); std::unique_ptr <MemoryBlockchainStorage> newStorage = new std::unique_ptr <MemoryBlockchainStorage>(new MemoryBlockchainStorage(new uint(splitIndex))); std::move(blocks.GetEnumerator() + splitIndex, blocks.end(), std::back_inserter(newStorage.blocks)); blocks.Resize(splitIndex); blocks.shrink_to_fit(); return(std::move(newStorage)); }
//C++ TO C# CONVERTER TODO TASK: 'rvalue references' have no equivalent in C#: public TransactionPoolCleanWrapper(std::unique_ptr <ITransactionPool> && transactionPool, std::unique_ptr <ITimeProvider> && timeProvider, Logging.ILogger logger, ulong timeout) { this.transactionPool = std::move(transactionPool); this.timeProvider = std::move(timeProvider); this.logger = new Logging.LoggerRef(logger, "TransactionPoolCleanWrapper"); //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created: //ORIGINAL LINE: this.timeout = timeout; this.timeout.CopyFrom(timeout); Debug.Assert(this.timeProvider); }
public static CryptoNote.INode createNode(string daemonAddress, ushort daemonPort, Logging.ILogger logger) { std::unique_ptr <CryptoNote.INode> node = new std::unique_ptr <CryptoNote.INode>(new CryptoNote.NodeRpcProxy(daemonAddress, daemonPort, logger)); NodeInitObserver initObserver = new NodeInitObserver(); node.init(std::bind(NodeInitObserver.initCompleted, initObserver, std::placeholders._1)); initObserver.waitForInitEnd(); return(node.release()); }
// ITransfersSynchronizer public override ITransfersSubscription addSubscription(AccountSubscription acc) { var it = m_consumers.find(acc.keys.address.viewPublicKey); if (it == m_consumers.end()) { std::unique_ptr <TransfersConsumer> consumer = new std::unique_ptr <TransfersConsumer>(new TransfersConsumer(m_currency, m_node, m_logger.GetLogger(), acc.keys.viewSecretKey)); m_sync.addConsumer(consumer.get()); consumer.addObserver(this); it = m_consumers.Add(acc.keys.address.viewPublicKey, std::move(consumer)).first; } //C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops: return(it.second.addSubscription(acc)); }
//Returns MemoryBlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original SwappedBlockchainStorage will contain elements from [0, splitIndex - 1]. //Returns MemoryBlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original SwappedBlockchainStorage will contain elements from [0, splitIndex - 1]. public override std::unique_ptr <BlockchainStorage.IBlockchainStorageInternal> splitStorage(uint splitIndex) { Debug.Assert(splitIndex > 0); Debug.Assert(splitIndex < blocks.size()); std::unique_ptr <MemoryBlockchainStorage> newStorage = new std::unique_ptr <MemoryBlockchainStorage>(new MemoryBlockchainStorage(new uint(splitIndex))); ulong blocksCount = blocks.size(); for (ulong i = splitIndex; i < blocksCount; ++i) { newStorage.pushBlock(RawBlock(blocks[i])); } for (ulong i = 0; i < blocksCount - splitIndex; ++i) { blocks.pop_back(); } return(std::move(newStorage)); }
private BlockchainStorage(std::unique_ptr <IBlockchainStorageInternal> storage) { this.internalStorage = std::move(storage); }
//Returns BlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original BlockchainStorage will contain elements from [0, splitIndex - 1]. //Returns MemoryBlockchainStorage with elements from [splitIndex, blocks.size() - 1]. //Original MemoryBlockchainStorage will contain elements from [0, splitIndex - 1]. public virtual std::unique_ptr <BlockchainStorage> splitStorage(uint splitIndex) { std::unique_ptr <BlockchainStorage> newStorage = new std::unique_ptr <BlockchainStorage>(new BlockchainStorage(internalStorage.splitStorage(splitIndex))); return(newStorage); }