예제 #1
0
        /// <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
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
 /// <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();
 }