kfbxiopluginregistry.h

Go to the documentation of this file.
00001 
00004 #ifndef _KFBX_IO_PLUGIN_REGISTRY_H_
00005 #define _KFBX_IO_PLUGIN_REGISTRY_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 2001 - 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 <kaydara.h>
00048 
00049 #include <kfbxio/kfbxreader.h>
00050 #include <kfbxio/kfbxwriter.h>
00051 
00052 #include <kbaselib_forward.h>
00053 
00054 #ifndef MB_FBXSDK
00055 #include <kbaselib_nsuse.h>
00056 #endif
00057 
00058 #include <fbxfilesdk_nsbegin.h>
00059 
00060 
00061 class KFbxSdkManager;
00062 class KFbxIOPluginRegistry;
00063 class KFbxExporter;
00064 class KFbxImporter;
00065 
00066 
00067 
00068 
00071 class KFbxIOPluginRegistryAccessor
00072 {
00073 public:
00074 
00078     static KFbxIOPluginRegistry* Get();
00079 
00081 //
00082 //  WARNING!
00083 //
00084 //  Anything beyond these lines may not be documented accurately and is 
00085 //  subject to change without notice.
00086 //
00088 
00089 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00090 private:
00091     friend class KFbxSdkManager;
00092 
00093     static void Acquire();
00094     static void Release();
00095 
00096     static KFbxIOPluginRegistry* mRegistry;
00097     static int mAcquireCount;
00098 #endif //DOXYGEN
00099 };
00100 
00101 
00102 
00108 class KFbxIOPluginRegistry
00109 {
00110 public:
00111 
00117     void RegisterReader(char const* pPluginPath,
00118                         int& pFirstPluginID,
00119                         int& pRegisteredCount);
00120 
00127     void RegisterReader(KFbxReader::CreateFuncType pCreateF, 
00128                         KFbxReader::GetInfoFuncType pInfoF,
00129                         int& pFirstPluginID,
00130                         int& pRegisteredCount);
00131 
00132 
00138     void RegisterWriter(char const* pPluginPath,
00139                         int& pFirstPluginID,
00140                         int& pRegisteredCount);
00141 
00148     void RegisterWriter(KFbxWriter::CreateFuncType pCreateF, 
00149                         KFbxWriter::GetInfoFuncType pInfoF,
00150                         int& pFirstPluginID,
00151                         int& pRegisteredCount);
00152 
00157     KFbxReader* CreateReader(KFbxSdkManager& pManager, 
00158                              KFbxImporter& pImporter, 
00159                              int pPluginID) const;
00160 
00166     KFbxWriter* CreateWriter(KFbxSdkManager& pManager, 
00167                              KFbxExporter& pExporter,
00168                              int pPluginID) const;
00169 
00173     int FindReaderIDByExtension(char const* pExt) const;
00174 
00178     int FindWriterIDByExtension(char const* pExt) const;
00179     
00183     int FindReaderIDByDescription(char const* pDesc) const;
00184 
00188     int FindWriterIDByDescription(char const* pDesc) const;
00189     
00193     bool ReaderIsFBX(int pFileFormat) const;
00194 
00198     bool WriterIsFBX(int pFileFormat) const;
00199 
00203     int GetReaderFormatCount() const;
00204 
00211     int GetWriterFormatCount() const;
00212 
00217     char const* GetReaderFormatDescription(int pFileFormat) const;
00218 
00223     char const* GetWriterFormatDescription(int pFileFormat) const;
00224 
00229     char const* GetReaderFormatExtension(int pFileFormat) const;
00230     
00235     char const* GetWriterFormatExtension(int pFileFormat) const;
00236 
00241     char const* const* GetWritableVersions(int pFileFormat) const;
00242 
00253     bool DetectFileFormat(const char* pFileName, int& pFileFormat) const;
00254     
00258     int GetNativeReaderFormat();
00259 
00263     int GetNativeWriterFormat();
00264 
00266 //
00267 //  WARNING!
00268 //
00269 //  Anything beyond these lines may not be documented accurately and is 
00270 //  subject to change without notice.
00271 //
00273 
00274 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00275 
00276     void RegisterInternalIOPlugins();
00277 protected:
00278     struct ReaderPluginEntry
00279     {
00280         ReaderPluginEntry(char const* pExtension, 
00281                           char const* pDescription, 
00282                           KFbxReader::CreateFuncType pCreatorFunction,
00283                           int pBaseID);
00284         
00285         char const* mExtension;
00286         char const* mDescription;
00287         KFbxReader::CreateFuncType mCreatorFunction;
00288         int mBaseID;
00289         bool mIsFBX;
00290     };
00291     
00292     struct WriterPluginEntry
00293     {
00294         WriterPluginEntry(char const* pExtension, 
00295                           char const* pDescription, 
00296                           char const* const* pVersions, 
00297                           KFbxWriter::CreateFuncType pCreatorFunction,
00298                           int pBaseID);
00299         
00300         char const* mExtension;
00301         char const* mDescription;
00302         char const* const* mVersions;
00303         KFbxWriter::CreateFuncType mCreatorFunction;
00304         int mBaseID;
00305         bool mIsFBX;
00306     };
00307 
00308 
00309     KArrayTemplate<ReaderPluginEntry*> mReaders;
00310     KArrayTemplate<WriterPluginEntry*> mWriters;
00311 
00312     int mNativeReaderFormat;
00313     int mNativeWriterFormat;
00314 
00315 private:
00316     friend class KFbxIOPluginRegistryAccessor;
00317     KFbxIOPluginRegistry();
00318     ~KFbxIOPluginRegistry();
00319 #endif //DOXYGEN
00320 };
00321 
00322 
00323 #include <fbxfilesdk_nsend.h>
00324 
00325 #endif // _KFbxIOPluginRegistry_h
00326