kfbxdatastream.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_DATASTREAM_H_
00005 #define _FBXSDK_DATASTREAM_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2000 - 2007 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material
00013  (collectively the "Data") in these files contain unpublished information
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015  Canada and United States of America federal copyright law and by international
00016  treaties.
00017 
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <klib/ktime.h>
00048 #include <klib/kstring.h>
00049 
00050 
00051 
00052 #include <fbxfilesdk_nsbegin.h>
00053 
00054 class KFbxDataStream_internal;
00055 
00059 class KFBX_DLL KFbxDataStream
00060 {
00061     public:
00062 
00064     KFbxDataStream();
00065 
00067     KFbxDataStream(KFbxDataStream const &pDataStream);
00068 
00070     ~KFbxDataStream();
00071 
00078 
00081     bool ReadBegin();
00082 
00085     bool ReadEnd();
00086 
00089     void FieldReadResetPosition();
00090 
00093     int FieldGetCount();
00094 
00098     char* FieldGetName(int pFieldIndex);
00099 
00103     int FieldGetInstanceCount(char* pFieldName);
00104 
00109     bool FieldReadBegin(int pFieldIndex, int pInstance);
00110 
00114     bool FieldReadBegin(char* pFieldName);
00115 
00120     bool FieldReadBegin(char* pFieldName, int pInstance);
00121 
00124     void FieldReadEnd();
00125 
00128     bool FieldReadIsBlock();
00129 
00132     bool FieldReadBlockBegin();
00133 
00136     void FieldReadBlockEnd();
00137 
00140     int FieldReadGetCount();
00141 
00144     int FieldReadGetRemain();
00145 
00148     char FieldReadGetType();
00149 
00152     char FieldReadCH();
00153 
00158     char FieldReadCH(char* pFieldName, char pDefault=0);
00159 
00162     char* FieldReadC();
00163 
00168     char* FieldReadC(char* pFieldName, char* pDefault="");
00169 
00172     inline char* FieldReadS() {return FieldReadC ();}
00173 
00178     inline char* FieldReadS(char* pFieldName, char* pDefault="") {return FieldReadC (pFieldName, pDefault);}
00179 
00182     inline bool FieldReadB() { return FieldReadI() != 0; }
00183 
00188     inline bool FieldReadB(char* pFieldName, bool pDefault = false ) { return FieldReadI( pFieldName, pDefault ) != 0; }
00189 
00192     int FieldReadI();
00193 
00198     int FieldReadI(char* pFieldName, int pDefault=0);
00199 
00202     kLongLong FieldReadLL();
00203 
00208     kLongLong FieldReadLL(char* pFieldName, kLongLong pDefault=0);
00209 
00212     float FieldReadF();
00213 
00218     float FieldReadF(char* pFieldName, float pDefault=0);
00219 
00222     double FieldReadD();
00223 
00228     double FieldReadD(char* pFieldName, double pDefault=0);
00229 
00233     KTime FieldReadT(char* pFieldName);
00234 
00237     KTime FieldReadT();
00238 
00242     KTimeSpan FieldReadTS(char* pFieldName);
00243 
00246     KTimeSpan FieldReadTS();
00247 
00252     inline void FieldReadFn(float* pValue, kUInt pn) {for (kUInt c=0; c<pn; c++) {pValue[c] = FieldReadF ();}}
00253 
00257     inline void FieldRead3F(float* pValue) {FieldReadFn (pValue, 3);}
00258 
00262     inline void FieldRead4F(float* pValue) {FieldReadFn (pValue, 4);}
00263 
00270     void FieldReadFn(char* pFieldName, float* pValue, float *pDefault, kUInt pn);
00271 
00277     inline void FieldRead3F(char* pFieldName, float* pValue, float* pDefault=NULL) {FieldReadFn (pFieldName, pValue, pDefault, 3);} 
00278 
00284     inline void FieldRead4F(char* pFieldName, float* pValue, float* pDefault=NULL) {FieldReadFn (pFieldName, pValue, pDefault, 4);}
00285 
00290     inline void FieldReadDn(double* pValue, kUInt pn) {for (kUInt c=0; c<pn; c++) {pValue[c] = FieldReadD ();}}
00291 
00295     inline void FieldRead3D(double* pValue) {FieldReadDn (pValue, 3);}
00296 
00300     inline void FieldRead4D(double* pValue) {FieldReadDn (pValue, 4);}
00301 
00307     void FieldReadDn(char* pFieldName, double* pValue, double *pDefault, kUInt pn);
00308 
00314     inline void FieldRead3D(char* pFieldName, double* pValue, double* pDefault=NULL) {FieldReadDn (pFieldName, pValue, pDefault, 3);} 
00315 
00321     inline void FieldRead4D(char* pFieldName, double* pValue, double* pDefault=NULL) {FieldReadDn (pFieldName, pValue, pDefault, 4);}
00322 
00326     void* FieldReadR(int* pByteSize);
00327 
00332     void* FieldReadR(char* pFieldName,int* pByteSize);
00333 
00335 
00342 
00345     bool WriteBegin();
00346 
00349     bool WriteEnd();
00350 
00354     void FieldWriteBegin(char* pFieldName);
00355 
00358     void FieldWriteEnd();
00359 
00362     void FieldWriteBlockBegin();
00363 
00369     void FieldWriteObjectBegin(char* pObjectType, char* pName, char* pSubType=NULL);
00370 
00373     void FieldWriteObjectEnd(); 
00374 
00379     void FieldWriteBlockBegin(char* pFileName);
00380 
00383     void FieldWriteBlockEnd ();
00384 
00388     void FieldWriteCH(char pValue);
00389 
00394     inline void FieldWriteCH(char* pFieldName, char pValue) {FieldWriteBegin (pFieldName); FieldWriteCH (pValue); FieldWriteEnd ();}
00395 
00399     void FieldWriteC(char* pValue);
00400 
00405     inline void FieldWriteC(char* pFieldName, char* pValue) {FieldWriteBegin (pFieldName); FieldWriteC (pValue); FieldWriteEnd ();}
00406 
00410     inline void FieldWriteS(KString pValue) {FieldWriteC (pValue.Buffer ());}
00411 
00416     inline void FieldWriteS(char* pFieldName, KString pValue) {FieldWriteC (pFieldName, pValue.Buffer ());}
00417 
00421     inline void FieldWriteB(bool pValue){ FieldWriteI( pValue ); }
00422 
00427     inline void FieldWriteB(char* pFieldName, bool pValue) {FieldWriteBegin (pFieldName); FieldWriteB (pValue); FieldWriteEnd ();}
00428 
00432     void FieldWriteI(int pValue);
00433 
00438     inline void FieldWriteI(char* pFieldName, int pValue) {FieldWriteBegin (pFieldName); FieldWriteI (pValue); FieldWriteEnd ();}
00439 
00443     void FieldWriteLL(kLongLong pValue);
00444 
00449     inline void FieldWriteLL(char* pFieldName, kLongLong pValue) {FieldWriteBegin (pFieldName); FieldWriteLL (pValue); FieldWriteEnd ();}
00450 
00455     void FieldWriteF(float pValue);
00456 
00462     inline void FieldWriteF(char* pFieldName, float pValue) {FieldWriteBegin (pFieldName); FieldWriteF (pValue); FieldWriteEnd ();}
00463 
00467     void FieldWriteD(double  pValue);
00468 
00473     inline void FieldWriteD(char* pFieldName, double pValue) {FieldWriteBegin (pFieldName); FieldWriteD (pValue); FieldWriteEnd ();}
00474 
00478     void FieldWriteT(KTime pTime);
00479 
00484     inline void FieldWriteT(char* pFieldName,KTime pValue) {FieldWriteBegin (pFieldName); FieldWriteT (pValue); FieldWriteEnd ();}
00485 
00489     void FieldWriteTS(KTimeSpan pTimeSpan);
00490 
00495     inline void FieldWriteTS(char* pFieldName,KTimeSpan pValue) {FieldWriteBegin (pFieldName); FieldWriteTS (pValue); FieldWriteEnd ();}
00496 
00501     inline void FieldWriteFn(float* pValue, kUInt pn) {for (kUInt c=0; c<pn; c++) {FieldWriteF (pValue[c]);}}
00502 
00508     inline void FieldWriteFn(char* pFieldName, float* pValue, kUInt pn) {FieldWriteBegin (pFieldName); FieldWriteFn (pValue, pn); FieldWriteEnd ();}
00509 
00513     inline void FieldWrite3F(float* pValue) {FieldWriteFn (pValue, 3);}
00514 
00519     inline void FieldWrite3F(char* pFieldName, float* pValue) {FieldWriteFn (pFieldName, pValue, 3);}
00520 
00524     inline void FieldWrite4F(float* pValue) {FieldWriteFn (pValue, 4);}
00525 
00530     inline void FieldWrite4F(char* pFieldName, float* pValue) {FieldWriteFn (pFieldName, pValue, 4);}
00531 
00536     inline void FieldWriteDn(double* pValue, kUInt pn) {for (kUInt c=0; c<pn; c++) {FieldWriteD (pValue[c]);}}
00537 
00543     inline void FieldWriteDn(char* pFieldName, double* pValue, kUInt pn) {FieldWriteBegin (pFieldName); FieldWriteDn (pValue, pn); FieldWriteEnd ();}
00544 
00548     inline void FieldWrite3D(double* pValue) {FieldWriteDn (pValue, 3);}
00549 
00554     inline void FieldWrite3D(char* pFieldName, double* pValue) {FieldWriteDn (pFieldName, pValue, 3);}
00555 
00559     inline void FieldWrite4D(double* pValue) {FieldWriteDn (pValue, 4);}
00560 
00565     inline void FieldWrite4D(char* pFieldName, double* pValue) {FieldWriteDn (pFieldName, pValue, 4);}
00566 
00572     void FieldWriteR(void* pRawData, int pByteSize);
00573 
00580     inline void FieldWriteR(char* pFieldName, void* pRawData, int pByteSize) {FieldWriteBegin (pFieldName); FieldWriteR (pRawData, pByteSize); FieldWriteEnd ();}
00581 
00585     inline void FieldWriteObjectReference(char* pName) {FieldWriteC (pName);}
00586 
00591     inline void FieldWriteObjectReference(char* pFieldName, char* pName) {FieldWriteC (pFieldName, pName);}
00592 
00596     void WriteComments(char* pFieldName);
00598 
00599 
00601     KFbxDataStream& operator=(const KFbxDataStream& pDataStream);
00602 
00603     private:
00604         KFbxDataStream_internal*    mInternal;
00605 };
00606 
00607 #include <fbxfilesdk_nsend.h>
00608 
00609 #endif // #ifndef _FBXSDK_DATASTREAM_H_
00610 
00611