00001 // 00002 // Copyright (c) 2000 by Tech Soft 3D, LLC. 00003 // The information contained herein is confidential and proprietary to 00004 // Tech Soft 3D, LLC., and considered a trade secret as defined under 00005 // civil and criminal statutes. Tech Soft 3D shall pursue its civil 00006 // and criminal remedies in the event of unauthorized use or misappropriation 00007 // of its trade secrets. Use of this information by anyone other than 00008 // authorized employees of Tech Soft 3D, LLC. is granted only under a 00009 // written non-disclosure agreement, expressly prescribing the scope and 00010 // manner of such use. 00011 // 00012 // $Id: 1d66798252e12560d31fba83d5c87aa2ead48d9d $ 00013 // 00014 #ifndef _HSharedKey_H 00015 #define _HSharedKey_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "HTools.h" 00023 00024 #include "vhash.h" 00025 #include "HStream.h" 00026 #include "HOpcodeShell.h" 00027 #include "HPolyPoly.h" 00028 00029 00030 #define OVERLOAD_INTERPRET_INT(base_class__name__abc) \ 00031 TK_Status Interpret (BStreamFileToolkit & tk, HC_KEY key, int variant = 0) \ 00032 { \ 00033 TK_Status status = base_class__name__abc::Interpret(tk,key,variant); \ 00034 m_key = key; \ 00035 return status; \ 00036 } 00037 #define OVERLOAD_INTERPRET_CHAR(base_class__name__abc) \ 00038 TK_Status Interpret (BStreamFileToolkit & tk, HC_KEY key, char const * name) \ 00039 { \ 00040 TK_Status status = base_class__name__abc::Interpret(tk,key,name); \ 00041 m_key = key; \ 00042 return status; \ 00043 } 00044 00045 #define OVERLOAD_WRITE(base_class__name__abc) \ 00046 TK_Status Write(BStreamFileToolkit & tk) \ 00047 { \ 00048 TK_Status status = base_class__name__abc::Write(tk); \ 00049 m_pPersIdent->AssociateKey(m_key); \ 00050 return status; \ 00051 } 00052 00053 #define OVERLOAD_EXECUTE(base_class___name__abc) \ 00054 TK_Status Execute (BStreamFileToolkit &tk) \ 00055 { \ 00056 TK_Status status = base_class___name__abc::Execute(tk); \ 00057 m_pPersIdent->AssociateKey(last_key (tk)); \ 00058 return status; \ 00059 } 00060 00061 #define OVERLOAD_WRITE_POLY(base_class__name__abc) \ 00062 TK_Status Write(BStreamFileToolkit & tk) \ 00063 { \ 00064 TK_Status status = base_class__name__abc::Write(tk); \ 00065 for (int i = 0; i < m_primitive_count; i++) \ 00066 m_pPersIdent->AssociateKey(m_keys[i]); \ 00067 return status; \ 00068 } 00069 00070 #define OVERLOAD_EXECUTE_POLY(base_class___name__abc) \ 00071 TK_Status Execute (BStreamFileToolkit & tk) \ 00072 { \ 00073 TK_Status status = base_class___name__abc::Execute(tk); \ 00074 for (int i = 0; i < m_primitive_count; i++) \ 00075 m_pPersIdent->AssociateKey(m_keys[i]); \ 00076 return status; \ 00077 } 00078 00084 class MVO_API HSharedKey 00085 { 00086 public: 00088 HSharedKey(); 00089 ~HSharedKey() 00090 { 00091 delete_vhash(m_pKeyIdentHashTable); 00092 delete_vhash(m_pIdentKeyHashTable); 00093 } 00094 00099 long AssociateKey(HC_KEY key); 00100 00105 bool DisAssociateKey(HC_KEY key); 00106 00110 void AssociateKeysInSegment(const char *seg = 0); 00111 00115 void DisAssociateKeysInSegment(const char *seg = 0); 00116 00121 HC_KEY GetKeyFromIdent(long ident); 00122 00127 long GetIdentFromKey(HC_KEY ident); 00128 00132 void SetupStreamToolkit(HStreamFileToolkit *tk); 00133 00136 void Reset(); 00137 00138 private: 00139 unsigned int m_PersCounter; 00140 vhash_t *m_pKeyIdentHashTable; 00141 vhash_t *m_pIdentKeyHashTable; 00142 }; 00143 00144 00146 class TK_PIShell : public HTK_Shell { 00147 public: 00151 TK_PIShell(HSharedKey *persIdent) : HTK_Shell() 00152 { 00153 m_pPersIdent = persIdent; 00154 } 00155 OVERLOAD_INTERPRET_INT(HTK_Shell) 00156 OVERLOAD_WRITE(HTK_Shell) 00157 OVERLOAD_EXECUTE(HTK_Shell) 00158 00164 virtual TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00165 00166 private: 00167 HSharedKey *m_pPersIdent; 00168 HC_KEY m_key; 00169 }; 00170 00172 class TK_PIOpen_Segment : public HTK_Open_Segment { 00173 public: 00177 TK_PIOpen_Segment(HSharedKey *persIdent) : HTK_Open_Segment() 00178 { 00179 m_pPersIdent = persIdent; 00180 } 00181 00182 OVERLOAD_INTERPRET_CHAR(HTK_Open_Segment) 00183 OVERLOAD_WRITE(HTK_Open_Segment) 00184 OVERLOAD_EXECUTE(HTK_Open_Segment) 00185 00191 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00192 00193 private: 00194 HSharedKey *m_pPersIdent; 00195 HC_KEY m_key; 00196 00197 }; 00198 00200 class TK_PICircle : public HTK_Circle { 00201 public: 00205 TK_PICircle(unsigned char opcode, HSharedKey *persIdent) : HTK_Circle(opcode) 00206 { 00207 m_pPersIdent = persIdent; 00208 } 00209 OVERLOAD_INTERPRET_INT(HTK_Circle) 00210 OVERLOAD_WRITE(HTK_Circle) 00211 OVERLOAD_EXECUTE(HTK_Circle) 00212 00218 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00219 00220 private: 00221 HSharedKey *m_pPersIdent; 00222 HC_KEY m_key; 00223 00224 }; 00225 00227 class TK_PIEllipse : public HTK_Ellipse { 00228 public: 00232 TK_PIEllipse(unsigned char opcode, HSharedKey *persIdent) : HTK_Ellipse(opcode) 00233 { 00234 m_pPersIdent = persIdent; 00235 } 00236 OVERLOAD_INTERPRET_INT(HTK_Ellipse) 00237 OVERLOAD_WRITE(HTK_Ellipse) 00238 OVERLOAD_EXECUTE(HTK_Ellipse) 00239 00245 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00246 00247 private: 00248 00249 HSharedKey *m_pPersIdent; 00250 HC_KEY m_key; 00251 00252 00253 }; 00254 00256 class TK_PIGrid : public HTK_Grid { 00257 public: 00261 TK_PIGrid(HSharedKey *persIdent) : HTK_Grid() 00262 { 00263 m_pPersIdent = persIdent; 00264 } 00265 OVERLOAD_INTERPRET_INT(HTK_Grid) 00266 OVERLOAD_WRITE(HTK_Grid) 00267 OVERLOAD_EXECUTE(HTK_Grid) 00268 00274 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00275 00276 private: 00277 HSharedKey *m_pPersIdent; 00278 HC_KEY m_key; 00279 00280 }; 00281 00283 class TK_PIImage : public HTK_Image { 00284 public: 00288 TK_PIImage(HSharedKey *persIdent) : HTK_Image() 00289 { 00290 m_pPersIdent = persIdent; 00291 } 00292 OVERLOAD_INTERPRET_INT(HTK_Image) 00293 OVERLOAD_WRITE(HTK_Image) 00294 OVERLOAD_EXECUTE(HTK_Image) 00295 00301 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **) const; 00302 00303 private: 00304 HSharedKey *m_pPersIdent; 00305 HC_KEY m_key; 00306 00307 00308 }; 00309 00311 class TK_PILine : public HTK_Line { 00312 public: 00316 TK_PILine(HSharedKey *persIdent) : HTK_Line() 00317 { 00318 m_pPersIdent = persIdent; 00319 } 00320 OVERLOAD_INTERPRET_INT(HTK_Line) 00321 OVERLOAD_WRITE(HTK_Line) 00322 OVERLOAD_EXECUTE(HTK_Line) 00323 00329 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00330 00331 private: 00332 HSharedKey *m_pPersIdent; 00333 HC_KEY m_key; 00334 00335 00336 }; 00337 00339 class TK_PIPolypoint : public HTK_Polypoint { 00340 public: 00344 TK_PIPolypoint(unsigned char opcode, HSharedKey *persIdent) : HTK_Polypoint(opcode) 00345 { 00346 m_pPersIdent = persIdent; 00347 } 00348 OVERLOAD_INTERPRET_INT(HTK_Polypoint) 00349 OVERLOAD_WRITE(HTK_Polypoint) 00350 OVERLOAD_EXECUTE(HTK_Polypoint) 00351 00357 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00358 00359 private: 00360 HSharedKey *m_pPersIdent; 00361 HC_KEY m_key; 00362 00363 00364 }; 00365 00367 class TK_PIPolyPolypoint : public HTK_PolyPolypoint { 00368 public: 00372 TK_PIPolyPolypoint(unsigned char opcode, HSharedKey *persIdent) : HTK_PolyPolypoint(opcode) 00373 { 00374 m_pPersIdent = persIdent; 00375 } 00376 OVERLOAD_WRITE_POLY(HTK_PolyPolypoint) 00377 OVERLOAD_EXECUTE_POLY(HTK_PolyPolypoint) 00378 00384 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00385 00386 private: 00387 HSharedKey *m_pPersIdent; 00388 00389 }; 00390 00392 class TK_PIPoint : public HTK_Point { 00393 public: 00397 TK_PIPoint(unsigned char opcode, HSharedKey *persIdent) : HTK_Point(opcode) 00398 { 00399 m_pPersIdent = persIdent; 00400 } 00401 OVERLOAD_INTERPRET_INT(HTK_Point) 00402 OVERLOAD_WRITE(HTK_Point) 00403 OVERLOAD_EXECUTE(HTK_Point) 00404 00410 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00411 00412 private: 00413 HSharedKey *m_pPersIdent; 00414 HC_KEY m_key; 00415 00416 00417 }; 00418 00420 class TK_PISpot_Light : public HTK_Spot_Light { 00421 public: 00425 TK_PISpot_Light(HSharedKey *persIdent) : HTK_Spot_Light() 00426 { 00427 m_pPersIdent = persIdent; 00428 } 00429 OVERLOAD_INTERPRET_INT(HTK_Spot_Light) 00430 OVERLOAD_WRITE(HTK_Spot_Light) 00431 OVERLOAD_EXECUTE(HTK_Spot_Light) 00432 00438 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00439 00440 private: 00441 HSharedKey *m_pPersIdent; 00442 HC_KEY m_key; 00443 00444 00445 }; 00446 00448 class TK_PIArea_Light : public HTK_Area_Light { 00449 public: 00453 TK_PIArea_Light(HSharedKey *persIdent) : HTK_Area_Light() 00454 { 00455 m_pPersIdent = persIdent; 00456 } 00457 OVERLOAD_INTERPRET_INT(HTK_Area_Light) 00458 OVERLOAD_WRITE(HTK_Area_Light) 00459 OVERLOAD_EXECUTE(HTK_Area_Light) 00460 00466 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00467 00468 private: 00469 HSharedKey *m_pPersIdent; 00470 HC_KEY m_key; 00471 00472 00473 }; 00474 00476 class TK_PIMesh : public HTK_Mesh { 00477 public: 00481 TK_PIMesh(HSharedKey *persIdent) : HTK_Mesh() 00482 { 00483 m_pPersIdent = persIdent; 00484 } 00485 OVERLOAD_INTERPRET_INT(HTK_Mesh) 00486 OVERLOAD_WRITE(HTK_Mesh) 00487 OVERLOAD_EXECUTE(HTK_Mesh) 00488 00494 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00495 00496 private: 00497 HSharedKey *m_pPersIdent; 00498 HC_KEY m_key; 00499 00500 00501 }; 00502 00504 class TK_PINURBS_Curve : public HTK_NURBS_Curve { 00505 public: 00509 TK_PINURBS_Curve(HSharedKey *persIdent) : HTK_NURBS_Curve() 00510 { 00511 m_pPersIdent = persIdent; 00512 } 00513 OVERLOAD_INTERPRET_INT(HTK_NURBS_Curve) 00514 OVERLOAD_WRITE(HTK_NURBS_Curve) 00515 OVERLOAD_EXECUTE(HTK_NURBS_Curve) 00516 00522 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00523 00524 private: 00525 HSharedKey *m_pPersIdent; 00526 HC_KEY m_key; 00527 00528 00529 }; 00530 00532 class TK_PICutting_Plane : public HTK_Cutting_Plane { 00533 public: 00537 TK_PICutting_Plane( HSharedKey *persIdent) : HTK_Cutting_Plane() 00538 { 00539 m_pPersIdent = persIdent; 00540 } 00541 OVERLOAD_INTERPRET_INT(HTK_Cutting_Plane) 00542 OVERLOAD_WRITE(HTK_Cutting_Plane) 00543 OVERLOAD_EXECUTE(HTK_Cutting_Plane) 00544 00550 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00551 00552 private: 00553 HSharedKey *m_pPersIdent; 00554 HC_KEY m_key; 00555 00556 00557 }; 00558 00560 class TK_PIText : public HTK_Text { 00561 public: 00565 TK_PIText(unsigned char opcode, HSharedKey *persIdent) : HTK_Text(opcode) 00566 { 00567 m_pPersIdent = persIdent; 00568 } 00569 OVERLOAD_INTERPRET_INT(HTK_Text) 00570 OVERLOAD_WRITE(HTK_Text) 00571 OVERLOAD_EXECUTE(HTK_Text) 00572 00578 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00579 00580 private: 00581 HSharedKey *m_pPersIdent; 00582 HC_KEY m_key; 00583 00584 00585 }; 00586 00588 class TK_PIReferenced_Segment : public HTK_Referenced_Segment { 00589 public: 00593 TK_PIReferenced_Segment(unsigned char opcode, HSharedKey *persIdent) : HTK_Referenced_Segment(opcode) 00594 { 00595 m_pPersIdent = persIdent; 00596 } 00597 OVERLOAD_INTERPRET_INT(HTK_Referenced_Segment) 00598 OVERLOAD_WRITE(HTK_Referenced_Segment) 00599 OVERLOAD_EXECUTE(HTK_Referenced_Segment) 00600 00606 TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const; 00607 00608 private: 00609 HSharedKey *m_pPersIdent; 00610 HC_KEY m_key; 00611 00612 00613 }; 00614 00615 00616 00617 #ifdef H_PACK_8 00618 #pragma pack(pop) 00619 #endif 00620 00621 #endif 00622 00623 00624 00625 00626 00627 00628 00629