Esempio n. 1
0
        internal T LoadResult <T>(
            [PexAssumeUnderTest] SaveVarObject target,
            IVariable iVariable,
            ROOTNET.Interface.NTObject obj
            )
        {
            T result = target.LoadResult <T>(iVariable, obj);

            return(result);
            // TODO: add assertions to method SaveVarObjectTest.LoadResult(SaveVarObject, IVariable, NTObject)
        }
        /// <summary>
        /// Do the accumulation for a root object.
        /// </summary>
        /// <param name="nTObject"></param>
        private void InternalAccumulateHash(ROOTNET.Interface.NTObject nTObject)
        {
            if (nTObject == null)
            {
                throw new ArgumentNullException("The argument to InternalAccumulateHash was null - not allowed.");
            }

            // Write it to a ROOT buffer
            using (var buffer = new ROOTNET.NTBufferFile(ROOTNET.Interface.NTBuffer.EMode.kWrite))
            {
                buffer.WriteObject(nTObject);
                //var result = buffer.Buffer().as_array(buffer.Length());
                var result = BufferAsBytes(buffer);

                // And update the hash value we are holding onto.
                ComputeHash(result);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Write out an object. Eventually, with ROOTNET improvements this will work better and perahps
        /// won't be needed!
        /// </summary>
        /// <param name="obj">The object to be written. Assumed not null.</param>
        /// <param name="dir"></param>
        internal static void InternalWriteObject(this ROOTNET.Interface.NTObject obj, ROOTNET.Interface.NTDirectory dir)
        {
            if (obj == null)
            {
                Console.WriteLine("WARNING: Unable to write out null object to a TDirectory!");
                return;
            }

            using (ROOTLock.Lock())
            {
                if (obj is ROOTNET.Interface.NTH1 h)
                {
                    var copy = h.Clone();
                    dir.WriteTObject(copy); // Ugly from a memory pov, but...
                    copy.SetNull();
                }

                else
                {
                    dir.WriteTObject(obj);
                    obj.SetNull();
                }
            }
        }