/// <summary> /// Returns the number of bytes written by the member ToByteArray() /// </summary> public virtual int SizeInBytes() { #if NO_STORE return(sizeof(int) + _bins.SizeInBytes()); #else return(sizeof(int) + ((this._bins != null) ? this._bins.SizeInBytes() : _memorySize)); #endif }
/// <summary> /// Serializes an IntArray into a byte array /// </summary> /// <param name="input">The IntArray object</param> /// <returns>The serialized byte array object</returns> private byte[] Serialize(IntArray input) { int position = 0; byte[] buffer = new byte[input.SizeInBytes()]; input.ToByteArray(buffer, ref position); return(buffer); }
/// <summary> /// Saves the feature bins into the file object store /// </summary> /// <param name="bins">The feature bins to store</param> private void SaveBins(IntArray bins) { _binsSize = BinsCache.WriteObject(ref _binsOffset, bins); BinsType = bins.Type; _memorySize = bins.SizeInBytes(); }