Exemplo n.º 1
0
        public override void Load(BinaryReader reader)
        {
            Global.Debugf("iodetail", "<componentlist>");
            string s;

            BinIO.string_read(reader, out s);
            if (s != "<componentlist>")
            {
                throw new Exception("Expected string: <componentlist>");
            }
            BinIO.string_read(reader, out s);
            int n;

            if (!int.TryParse(s, out n))
            {
                throw new Exception("Incorrect number format (count of component).");
            }
            data.Resize(n);
            for (int i = 0; i < n; i++)
            {
                data[i] = ComponentIO.load_component(reader);
                if (data[i] != null)
                {
                    Global.Debugf("iodetail", "   {0}", data[i].Name);
                }
            }
            BinIO.string_read(reader, out s);
            if (s != "</componentlist>")
            {
                throw new Exception("Expected string: </componentlist>");
            }
            Global.Debugf("iodetail", "</componentlist>");
        }
Exemplo n.º 2
0
        public override void Load(System.IO.BinaryReader reader)
        {
            T val;

            BinIO.scalar_read <T>(reader, out val);
            data = val;
        }
Exemplo n.º 3
0
 public override void Save(BinaryWriter writer)
 {
     BinIO.magic_write(writer, "dataset");
     BinIO.scalar_write(writer, DatatypeSize);
     BinIO.narray_write(writer, data);
     BinIO.narray_write(writer, classes);
     BinIO.scalar_write(writer, nc);
     BinIO.scalar_write(writer, nf);
 }
Exemplo n.º 4
0
 public override void Save(BinaryWriter writer)
 {
     BinIO.magic_write(writer, "dataset");
     BinIO.scalar_write(writer, DatatypeSize);
     BinIO.scalar_write(writer, data.Dim(0));
     BinIO.scalar_write(writer, nc);
     BinIO.scalar_write(writer, nf);
     for (int i = 0; i < data.Dim(0); i++)
     {
         BinIO.narray_write(writer, data[i]);
     }
     BinIO.narray_write(writer, classes);
 }
Exemplo n.º 5
0
        public override void Load(BinaryReader reader)
        {
            BinIO.magic_read(reader, "dataset");
            int t;

            BinIO.scalar_read(reader, out t);
            CHECK_ARG(t == DatatypeSize, "t == sizeof(sbyte)");
            BinIO.narray_read(reader, data);
            BinIO.narray_read(reader, classes);
            BinIO.scalar_read(reader, out nc);
            BinIO.scalar_read(reader, out nf);
            CHECK_ARG(nf > 0 && nf < 1000000, "nf > 0 && nf < 1000000");
            CHECK_ARG(nc > 0 && nc < 1000000, "nc > 0 && nc < 1000000");
        }
Exemplo n.º 6
0
        public override void Load(BinaryReader reader)
        {
            BinIO.magic_read(reader, "dataset");
            int t, nsamples;

            BinIO.scalar_read(reader, out t);
            CHECK_ARG(t == DatatypeSize, "t == sizeof(byte)");
            BinIO.scalar_read(reader, out nsamples);
            BinIO.scalar_read(reader, out nc);
            BinIO.scalar_read(reader, out nf);
            data.Clear();
            for (int i = 0; i < nsamples; i++)
            {
                BinIO.narray_read(reader, data.Push(new Narray <byte>()));
            }
            BinIO.narray_read(reader, classes);
            CHECK_ARG(nf > 0 && nf < 1000000, "nf > 0 && nf < 1000000");
            CHECK_ARG(nc > 0 && nc < 1000000, "nc > 0 && nc < 1000000");
        }
Exemplo n.º 7
0
 public override void Save(BinaryWriter writer)
 {
     Global.Debugf("iodetail", "<componentlist>");
     // write start tag
     BinIO.string_write(writer, "<componentlist>");
     // write array length
     BinIO.string_write(writer, data.Length().ToString());
     // write components
     for (int i = 0; i < data.Length(); i++)
     {
         if (data[i] != null)
         {
             Global.Debugf("iodetail", "   {0}", data[i].Name);
         }
         ComponentIO.save_component(writer, data[i]);
     }
     // write end tag
     BinIO.string_write(writer, "</componentlist>");
     Global.Debugf("iodetail", "</componentlist>");
 }
Exemplo n.º 8
0
 public override void Load(BinaryReader reader)
 {
     BinIO.narray_read(reader, data);
 }
Exemplo n.º 9
0
 public override void Save(BinaryWriter writer)
 {
     BinIO.narray_write(writer, data);
 }
Exemplo n.º 10
0
 public override void Save(BinaryWriter writer)
 {
     BinIO.scalar_write(writer, (T)data);
 }