WriteObject() 공개 메소드

Write an object.
public WriteObject ( IEncogPersistedObject obj ) : void
obj IEncogPersistedObject The object to write.
리턴 void
        /// <summary>
        /// Add an EncogPersistedObject to the collection.
        /// </summary>
        /// <param name="name">The name of the object to load.</param>
        /// <param name="obj">The object to add.</param>
        public void Add(String name, IEncogPersistedObject obj)
        {
            if (obj is BasicNetwork)
            {
                ((BasicNetwork)obj).Structure.UpdateFlatNetwork();
            }

            obj.Name = name;
            PersistWriter writer = new PersistWriter(this.fileTemp);

            writer.Begin();
            writer.WriteHeader();
            writer.BeginObjects();
            writer.WriteObject(obj);
            writer.MergeObjects(this.filePrimary, name);
            writer.EndObjects();
            writer.End();
            writer.Close();
            MergeTemp();
            BuildDirectory();
        }
예제 #2
0
        /// <summary>
        /// Save the contents of this collection to a location.
        /// </summary>
        /// <param name="location">The location to save to.</param>
        public void Save(IPersistenceLocation location)
        {
            PersistWriter writer = null;

            writer = new PersistWriter(location);
            try
            {
                writer.Begin();
                writer.WriteHeader();
                writer.BeginObjects();
                foreach (IEncogPersistedObject obj in this.Contents.Values)
                {
                    writer.WriteObject(obj);
                }
                writer.EndObjects();
            }
            finally
            {
                writer.End();
                writer.Close();
            }
        }
        /// <summary>
        /// Add an EncogPersistedObject to the collection.
        /// </summary>
        /// <param name="name">The name of the object to load.</param>
        /// <param name="obj">The object to add.</param>
        public void Add(String name, IEncogPersistedObject obj)
        {
            if (obj is BasicNetwork)
            {
                ((BasicNetwork)obj).Structure.UpdateFlatNetwork();
            }

            obj.Name = name;
            PersistWriter writer = new PersistWriter(this.fileTemp);
            writer.Begin();
            writer.WriteHeader();
            writer.BeginObjects();
            writer.WriteObject(obj);
            writer.MergeObjects(this.filePrimary, name);
            writer.EndObjects();
            writer.End();
            writer.Close();
            MergeTemp();
            BuildDirectory();
        }
        /// <summary>
        /// Save the contents of this collection to a location.
        /// </summary>
        /// <param name="location">The location to save to.</param>
        public void Save(IPersistenceLocation location)
        {
            PersistWriter writer = null;

            writer = new PersistWriter(location);
            try
            {
                writer.Begin();
                writer.WriteHeader();
                writer.BeginObjects();
                foreach (IEncogPersistedObject obj in this.Contents.Values)
                {
                    writer.WriteObject(obj);
                }
                writer.EndObjects();
            }
            finally
            {
                writer.End();
                writer.Close();
            }
        }