Presentation is loading. Please wait.

Presentation is loading. Please wait.

The BinX API eDIKT project team May 2003 Ted Wen Robert Carroll

Similar presentations


Presentation on theme: "The BinX API eDIKT project team May 2003 Ted Wen Robert Carroll"— Presentation transcript:

1 The BinX API eDIKT project team May 2003 Ted Wen tedwen@nesc.ac.uk tedwen@nesc.ac.uk Robert Carroll robertc@nesc.ac.uk robertc@nesc.ac.uk

2 Contents Format of the BinX document Format of the BinX document The binary data file The binary data file BinX data types BinX data types Format of the dataBinX document Format of the dataBinX document BinX library API BinX library API

3 A BinX document Root element Data class section Data instance section Abstract data type

4 The BinX document http://schema.nesc.ac.uk/binx <short-16/><integer-32/><ieeeDouble-64/></file></dataset>

5 Another BinX document … … <definitions> <arrayFixed><byte-8/> </definitions> </dataset>

6 The binary data file DataBinX<short-16>100</short-16><integer-32>10000</integer-32> Binary Data 1100100 10011100010000 Hexadecimal 00 64 00 00 27 10

7 BinX Data Types

8 Primitive data types BxByte8 BxCharacter8 BxShort16 BxInteger32 BxLong64 BxUnsignedShort16 BxUnsignedInteger32 BxUnsignedLong64 BxFloat32 BxDouble64 BxExtended80 BxQuadruple128

9 Complex data types BxDataset BxUnion BxArrayFixed BxArrayVariable BxArrayStreamed

10 User type definition <struct></struct></defineType> <arrayFixed></arrayFixed></defineType> <union></union></defineType>

11 DataBinX Document

12 Primate types in DataBinX http://schema.nesc.ac.uk/binx <file><short-16>32</short-16><integer-32>100</integer-32><ieeeDouble-64>50.5</ieeeDouble-64></file></dataset>

13 Struct in DataBinX … … 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9

14 Array in DataBinX <arrayFixed><byte-8/> </arrayFixed><arraydata> 1 1 2 2 3 3 4 4 </arraydata>

15 BinX Library API

16 Parsing a BinX document BxBinxFile* pReader = new BxBinxFile(); If (pReader->parse(“mybinx.xml”)) { BxDataset* pDataset = pReader->getDataset(); }

17 Output from the library DataBinX DataBinX The combined data and BinX document SchemaBinX SchemaBinX Binary data stream Binary data stream DataBinX = SchemaBinX + Binary data

18 Creating BinX document BxBinxFileWriter* pWriter=new BxBinxFileWriter(); Create a object to write out the document Create a object to write out the document BxDataset* pData = new BxDataset(); Create a new dataset (in memory BinX document) Create a new dataset (in memory BinX document) BxShort16* i16 = new BxShort16(100); pData->addDataObject(i16); Add data to the dataset Add data to the dataset

19 Creating BinX document BxBinaryFile* pbf = new BxBinaryFile(); Create a new binary file Create a new binary filepbf->setDatasetPointer(pData); Create a link to the BinX document Create a link to the BinX document pWriter->setBinaryFilePtr(pbf); pWriter->save("TestDataset.xml"); Save the BinX document Save the BinX document

20 Merge binary data BxBinxFileReader * pFile1 = new BxBinxFileReader(“file1.xml”); BxBinxFileReader * pFile2 = new BxBinxFileReader(“file2.xml”); BxDataset * pDataset1 = pFile1->getDataset(); BxDataset * pDataset2 = pFile2->getDataset(); BxArray * pArray1 = pDataset1->getArray(0); BxArray * pArray2 = pDataset2->getArray(0); BxDataObject * pData1 = pArray1->getNext(); BxDataObject * pData2 = pArray2->getNext(); FILE * fo = fopen(“output.dat”,”wb”); pData1->toStreamBinary(fo);pData2->toStreamBinary(fo);

21 Summary One BinX document can describe One BinX document can describe many binary files Generate BinX document from code Generate BinX document from code Easy to use interfaces Easy to use interfaces Flexible Flexible


Download ppt "The BinX API eDIKT project team May 2003 Ted Wen Robert Carroll"

Similar presentations


Ads by Google