Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="BroRecord"/>.
        /// </summary>
        /// <exception cref="OutOfMemoryException">Failed to create Bro record.</exception>
        public BroRecord()
        {
            m_recordPtr = BroApi.bro_record_new();

            if (m_recordPtr.IsInvalid())
            {
                throw new OutOfMemoryException("Failed to create Bro record.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Removes all fields from this <see cref="BroRecord"/>.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Cannot clear, <see cref="BroRecord"/> is disposed.</exception>
        public void Clear()
        {
            if (m_recordPtr.IsInvalid())
            {
                throw new ObjectDisposedException("Cannot clear items, Bro record is disposed.");
            }

#if USE_SAFE_HANDLES
            m_recordPtr.Dispose();
#else
            BroApi.bro_record_free(m_recordPtr);
#endif
            m_recordPtr = BroApi.bro_record_new();
        }