/// <summary> /// Returns a deep copy of the underlying order book. /// </summary> /// <returns>A deep snapshot of the current Order Book</returns> public MamdaOrderBook getDeepBookSnapshot() { MamdaOrderBook mSnapshot = null; if (null != mFullBook) { mSnapshot = new MamdaOrderBook(); // aquire lock lock (mFullBook) { mSnapshot.deepCopy(mFullBook); mSnapshot.setSymbol(mFullBook.getSymbol()); // strings are immutable, hence safe for assignment mSnapshot.setIsConsistent(mFullBook.getIsConsistent()); } } return(mSnapshot); }
/// <summary> /// Returns a shallow copy of the underlying order book. /// As such this method should not be called from a separate thread. /// The recommended use of this method is to use a timer on the same queue /// as data for this book is being dispatched and grab the snapshot at /// regular intervals. /// </summary> /// <returns>A snapshot of the current Order Book</returns> public MamdaOrderBook getBookSnapshot() { MamdaOrderBook mSnapshot = null; if (mFullBook != null) { mSnapshot = new MamdaOrderBook(); // aquire lock lock (mFullBook) { mSnapshot.copy(mFullBook); mSnapshot.setSymbol(mFullBook.getSymbol()); mSnapshot.setIsConsistent(mFullBook.getIsConsistent()); } } return(mSnapshot); }
/// <summary> /// Returns a deep copy of the underlying order book. /// </summary> /// <returns>A deep snapshot of the current Order Book</returns> public MamdaOrderBook getDeepBookSnapshot() { MamdaOrderBook mSnapshot = null; if (null != mFullBook) { mSnapshot = new MamdaOrderBook(); // aquire lock lock (mFullBook) { mSnapshot.deepCopy(mFullBook); mSnapshot.setSymbol(mFullBook.getSymbol()); // strings are immutable, hence safe for assignment mSnapshot.setIsConsistent(mFullBook.getIsConsistent()); } } return mSnapshot; }
/// <summary> /// Returns a shallow copy of the underlying order book. /// As such this method should not be called from a separate thread. /// The recommended use of this method is to use a timer on the same queue /// as data for this book is being dispatched and grab the snapshot at /// regular intervals. /// </summary> /// <returns>A snapshot of the current Order Book</returns> public MamdaOrderBook getBookSnapshot() { MamdaOrderBook mSnapshot = null; if (mFullBook != null) { mSnapshot = new MamdaOrderBook(); // aquire lock lock (mFullBook) { mSnapshot.copy(mFullBook); mSnapshot.setSymbol(mFullBook.getSymbol()); mSnapshot.setIsConsistent(mFullBook.getIsConsistent()); } } return mSnapshot; }