Пример #1
0
        /// <summary>
        /// Loads a BlobProto from a binary reader.
        /// </summary>
        /// <param name="br">Specifies the binary reader.</param>
        /// <param name="bNewInstance">When <i>true</i> a new instance is created, otherwise the data is read into the existing BlobProto.</param>
        /// <returns>The instance of the BlobProto is returned.</returns>
        public object Load(BinaryReader br, bool bNewInstance)
        {
            BlobProto p = this;

            if (bNewInstance)
            {
                p = new BlobProto();
            }

            if (br.ReadBoolean())
            {
                m_rgShape = BlobShape.Load(br);
            }

            m_rgdfData = Utility.Load <double>(br);
            m_rgdfDiff = Utility.Load <double>(br);
            m_rgfData  = Utility.Load <float>(br);
            m_rgfDiff  = Utility.Load <float>(br);

            if (br.ReadBoolean())
            {
                m_nNum = br.ReadInt32();
            }

            if (br.ReadBoolean())
            {
                m_nChannels = br.ReadInt32();
            }

            if (br.ReadBoolean())
            {
                m_nHeight = br.ReadInt32();
            }

            if (br.ReadBoolean())
            {
                m_nWidth = br.ReadInt32();
            }

            return(p);
        }
Пример #2
0
        /// <summary>
        /// Load the BlobShape from a binary reader.
        /// </summary>
        /// <param name="br">The binary reader to use.</param>
        /// <returns>A new BlobShape instance is returned.</returns>
        public static BlobShape Load(BinaryReader br)
        {
            BlobShape b = new BlobShape();

            return((BlobShape)b.Load(br, true));
        }