fbsdk/fbunion.h Source File
 
 
 
fbsdk/fbunion.h
Go to the documentation of this file.
00001 #ifndef __FBUNION_H__
00002 #define __FBUNION_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00039 #include <kaydaradef.h>
00040 #ifndef FBSDK_DLL 
00041 
00044         #define FBSDK_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <fbsdk/fbcomponent.h>
00048 #include <fbsdk/fbcore.h>
00049 
00050 class KUnion;
00051 
00052 #ifdef FBSDKUseNamespace
00053         namespace FBSDKNamespace {
00054 #endif
00055 
00056 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00057 
00059 __FB_FORWARD(FBLogger);
00060 __FB_FORWARD(FBVisitor);
00061 
00063 // FBUnion
00065 
00070 class FBSDK_DLL FBUnion  {
00071 public:
00075         FBUnion(KUnion *pValue = NULL);
00076 
00080     FBUnion(FBUnion const &pValue);
00081 
00086     FBUnion &operator = (FBUnion const &pValue);
00087 
00090     ~FBUnion();
00091 
00092 
00098     static FBUnion DumpObject (FBPlug const &pObject, int pDepth = 1);
00099 
00100     /* Visit - get the values contained from a FBUnion.
00101     *  First create a FBVisitor by inheritance and override each function.
00102     *  Call Visit with your visitor to have the values from the Union pushed to the Visitor.
00103     *  Each overridden operator () of your visitor will retrieve a value of a different type.
00104     *  See FBVisitor for details.
00105     */
00106         void Visit(FBVisitor &pVisitor) const;
00107 
00110     void Trace(int pDepth = 20) const;
00111 
00112 private:
00113 
00114     KUnion *mValue;
00115 };
00116 
00117 
00118 
00122 class FBSDK_DLL FBVisitor 
00123 {
00124 public:
00127     virtual void operator () ()    = 0;
00128 
00132     virtual void operator () (int &pVal)    = 0;
00133 
00137     virtual void operator () (long long &pVal)    = 0;
00138 
00142     virtual void operator () (unsigned long long &pVal)    = 0;
00143 
00147     virtual void operator () (double &pVal)   = 0;
00148 
00152     virtual void operator () (float &pVal)   = 0;
00153 
00157     virtual void operator () (bool &pVal)     = 0;
00158 
00162     virtual void operator () (FBTime const &pVal) = 0;
00163 
00167     virtual void operator () (const char *pVal) = 0;
00168 
00173     virtual void operator () (HdlFBPlug const &pVal) = 0;
00174 
00178     virtual void operator () (FBVector2d const &pVal) = 0;
00179 
00183     virtual void operator () (FBVector3d const &pVal) = 0;
00184 
00188     virtual void operator () (FBVector4d const &pVal) = 0;
00189 
00194     virtual void BeginMap() = 0;
00195 
00201     virtual void operator () (const char *pName, FBUnion const &pVal) = 0;
00202 
00205     virtual void EndMap() = 0;
00206 
00211     virtual void BeginArray() = 0;
00212 
00218     virtual void operator () (int pIndex, FBUnion const &pVal) = 0;
00219 
00222     virtual void EndArray() = 0;
00223 
00226     virtual ~FBVisitor() { }
00227 };
00228 
00229 #endif // DOXYGEN_SHOULD_SKIP_THIS
00230 
00231 #ifdef FBSDKUseNamespace
00232         }
00233 #endif
00234 
00235 #endif /* __FBUNION_H__ */