fbsdk/fbunion.h Source File

fbunion.h
Go to the documentation of this file.
1 #ifndef __FBUNION_H__
2 #define __FBUNION_H__
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
39 #include <kaydaradef.h>
40 #ifndef FBSDK_DLL
41 
44  #define FBSDK_DLL K_DLLIMPORT
45 #endif
46 
47 #include <fbsdk/fbcomponent.h>
48 #include <fbsdk/fbcore.h>
49 
50 class KUnion;
51 
52 #ifdef FBSDKUseNamespace
53  namespace FBSDKNamespace {
54 #endif
55 
56 #ifndef DOXYGEN_SHOULD_SKIP_THIS
57 
59 __FB_FORWARD(FBLogger);
60 __FB_FORWARD(FBVisitor);
61 
63 // FBUnion
65 
70 class FBSDK_DLL FBUnion {
71 public:
75  FBUnion(KUnion *pValue = NULL);
76 
80  FBUnion(FBUnion const &pValue);
81 
86  FBUnion &operator = (FBUnion const &pValue);
87 
90  ~FBUnion();
91 
92 
98  static FBUnion DumpObject (FBPlug const &pObject, int pDepth = 1);
99 
100  /* Visit - get the values contained from a FBUnion.
101  * First create a FBVisitor by inheritance and override each function.
102  * Call Visit with your visitor to have the values from the Union pushed to the Visitor.
103  * Each overridden operator () of your visitor will retrieve a value of a different type.
104  * See FBVisitor for details.
105  */
106  void Visit(FBVisitor &pVisitor) const;
107 
110  void Trace(int pDepth = 20) const;
111 
112 private:
113 
114  KUnion *mValue;
115 };
116 
117 
118 
122 class FBSDK_DLL FBVisitor
123 {
124 public:
127  virtual void operator () () = 0;
128 
132  virtual void operator () (int &pVal) = 0;
133 
137  virtual void operator () (long long &pVal) = 0;
138 
142  virtual void operator () (unsigned long long &pVal) = 0;
143 
147  virtual void operator () (double &pVal) = 0;
148 
152  virtual void operator () (float &pVal) = 0;
153 
157  virtual void operator () (bool &pVal) = 0;
158 
162  virtual void operator () (FBTime const &pVal) = 0;
163 
167  virtual void operator () (const char *pVal) = 0;
168 
173  virtual void operator () (HdlFBPlug const &pVal) = 0;
174 
178  virtual void operator () (FBVector2d const &pVal) = 0;
179 
183  virtual void operator () (FBVector3d const &pVal) = 0;
184 
188  virtual void operator () (FBVector4d const &pVal) = 0;
189 
194  virtual void BeginMap() = 0;
195 
201  virtual void operator () (const char *pName, FBUnion const &pVal) = 0;
202 
205  virtual void EndMap() = 0;
206 
211  virtual void BeginArray() = 0;
212 
218  virtual void operator () (int pIndex, FBUnion const &pVal) = 0;
219 
222  virtual void EndArray() = 0;
223 
226  virtual ~FBVisitor() { }
227 };
228 
229 #endif // DOXYGEN_SHOULD_SKIP_THIS
230 
231 #ifdef FBSDKUseNamespace
232  }
233 #endif
234 
235 #endif /* __FBUNION_H__ */
class FBVector4< double > FBVector4d
4D vector
Definition: fbtypes.h:441
class FBVector2< double > FBVector2d
2D vector.
Definition: fbtypes.h:435
#define NULL
Definition: kaydara.h:169
Contains definitions for devices, boxes and models.
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
class FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
Basic class definitions.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbunion.h:44