Alphabetical Class Index  Class Hierarchy   File Members   Compound Members   File List  

HSharedKey.h
1 //
2 // Copyright (c) 2000 by Tech Soft 3D, LLC.
3 // The information contained herein is confidential and proprietary to
4 // Tech Soft 3D, LLC., and considered a trade secret as defined under
5 // civil and criminal statutes. Tech Soft 3D shall pursue its civil
6 // and criminal remedies in the event of unauthorized use or misappropriation
7 // of its trade secrets. Use of this information by anyone other than
8 // authorized employees of Tech Soft 3D, LLC. is granted only under a
9 // written non-disclosure agreement, expressly prescribing the scope and
10 // manner of such use.
11 //
12 // $Id: 859d3f6a712a8e04b4a57527ccb86576521c4de2 $
13 //
14 #ifndef _HSharedKey_H
15 #define _HSharedKey_H
16 
17 #ifdef H_PACK_8
18 #pragma pack(push)
19 #pragma pack(8)
20 #endif
21 
22 #include "HTools.h"
23 
24 #include "vhash.h"
25 #include "HStream.h"
26 #include "HOpcodeShell.h"
27 #include "HPolyPoly.h"
28 
29 
30 #define OVERLOAD_INTERPRET_INT(base_class__name__abc) \
31  TK_Status Interpret (BStreamFileToolkit & tk, HC_KEY key, int variant=0) \
32  { \
33  TK_Status status = base_class__name__abc::Interpret(tk,key,variant); \
34  m_key = key; \
35  return (status); \
36  }
37 #define OVERLOAD_INTERPRET_CHAR(base_class__name__abc) \
38  TK_Status Interpret (BStreamFileToolkit & tk, HC_KEY key, char const * name) \
39  { \
40  TK_Status status = base_class__name__abc::Interpret(tk,key,name); \
41  m_key = key; \
42  return (status); \
43  }
44 
45 #define OVERLOAD_WRITE(base_class__name__abc) \
46  TK_Status Write(BStreamFileToolkit & tk) alter \
47  { \
48  TK_Status status = base_class__name__abc::Write(tk); \
49  m_pPersIdent->AssociateKey(m_key); \
50  return (status); \
51  }
52 
53 #define OVERLOAD_EXECUTE(base_class___name__abc) \
54  TK_Status Execute (BStreamFileToolkit &tk) \
55  { \
56  TK_Status status = base_class___name__abc::Execute(tk); \
57  m_pPersIdent->AssociateKey(last_key (tk)); \
58  return (status); \
59  }
60 
61 #define OVERLOAD_WRITE_POLY(base_class__name__abc) \
62  TK_Status Write(BStreamFileToolkit & tk) alter \
63  { \
64  TK_Status status = base_class__name__abc::Write(tk); \
65  for( int i = 0; i < m_primitive_count; i++ ) \
66  m_pPersIdent->AssociateKey(m_keys[i]); \
67  return (status); \
68  }
69 
70 #define OVERLOAD_EXECUTE_POLY(base_class___name__abc) \
71  TK_Status Execute (BStreamFileToolkit &tk) \
72  { \
73  TK_Status status = base_class___name__abc::Execute(tk); \
74  for( int i = 0; i < m_primitive_count; i++ ) \
75  m_pPersIdent->AssociateKey(m_keys[i]); \
76  return (status); \
77  }
78 
84 class MVO_API HSharedKey
85 {
86 public:
88  HSharedKey();
89  ~HSharedKey()
90  {
91  delete_vhash(m_pKeyIdentHashTable);
92  delete_vhash(m_pIdentKeyHashTable);
93  }
94 
99  long AssociateKey(HC_KEY key);
100 
105  bool DisAssociateKey(HC_KEY key);
106 
110  void AssociateKeysInSegment(const char *seg = 0);
111 
115  void DisAssociateKeysInSegment(const char *seg = 0);
116 
121  HC_KEY GetKeyFromIdent(long ident);
122 
127  long GetIdentFromKey(HC_KEY ident);
128 
132  void SetupStreamToolkit(HStreamFileToolkit *tk);
133 
136  void Reset();
137 
138 private:
139  unsigned int m_PersCounter;
140  vhash_t *m_pKeyIdentHashTable;
141  vhash_t *m_pIdentKeyHashTable;
142 };
143 
144 
146 class TK_PIShell : public HTK_Shell {
147 public:
151  TK_PIShell(HSharedKey *persIdent) : HTK_Shell()
152  {
153  m_pPersIdent = persIdent;
154  }
155  OVERLOAD_INTERPRET_INT(HTK_Shell)
156  OVERLOAD_WRITE(HTK_Shell)
157  OVERLOAD_EXECUTE(HTK_Shell)
158 
164  virtual TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
165 
166 private:
167  HSharedKey *m_pPersIdent;
168  HC_KEY m_key;
169 };
170 
172 class TK_PIOpen_Segment : public HTK_Open_Segment {
173 public:
177  TK_PIOpen_Segment(HSharedKey *persIdent) : HTK_Open_Segment()
178  {
179  m_pPersIdent = persIdent;
180  }
181 
182  OVERLOAD_INTERPRET_CHAR(HTK_Open_Segment)
183  OVERLOAD_WRITE(HTK_Open_Segment)
184  OVERLOAD_EXECUTE(HTK_Open_Segment)
185 
191  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
192 
193 private:
194  HSharedKey *m_pPersIdent;
195  HC_KEY m_key;
196 
197 };
198 
200 class TK_PICircle : public HTK_Circle {
201 public:
205  TK_PICircle(unsigned char opcode, HSharedKey *persIdent) : HTK_Circle(opcode)
206  {
207  m_pPersIdent = persIdent;
208  }
209  OVERLOAD_INTERPRET_INT(HTK_Circle)
210  OVERLOAD_WRITE(HTK_Circle)
211  OVERLOAD_EXECUTE(HTK_Circle)
212 
218  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
219 
220 private:
221  HSharedKey *m_pPersIdent;
222  HC_KEY m_key;
223 
224 };
225 
227 class TK_PIEllipse : public HTK_Ellipse {
228 public:
232  TK_PIEllipse(unsigned char opcode, HSharedKey *persIdent) : HTK_Ellipse(opcode)
233  {
234  m_pPersIdent = persIdent;
235  }
236  OVERLOAD_INTERPRET_INT(HTK_Ellipse)
237  OVERLOAD_WRITE(HTK_Ellipse)
238  OVERLOAD_EXECUTE(HTK_Ellipse)
239 
245  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
246 
247 private:
248 
249  HSharedKey *m_pPersIdent;
250  HC_KEY m_key;
251 
252 
253 };
254 
256 class TK_PIGrid : public HTK_Grid {
257 public:
261  TK_PIGrid(HSharedKey *persIdent) : HTK_Grid()
262  {
263  m_pPersIdent = persIdent;
264  }
265  OVERLOAD_INTERPRET_INT(HTK_Grid)
266  OVERLOAD_WRITE(HTK_Grid)
267  OVERLOAD_EXECUTE(HTK_Grid)
268 
274  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
275 
276 private:
277  HSharedKey *m_pPersIdent;
278  HC_KEY m_key;
279 
280 };
281 
283 class TK_PIImage : public HTK_Image {
284 public:
288  TK_PIImage(HSharedKey *persIdent) : HTK_Image()
289  {
290  m_pPersIdent = persIdent;
291  }
292  OVERLOAD_INTERPRET_INT(HTK_Image)
293  OVERLOAD_WRITE(HTK_Image)
294  OVERLOAD_EXECUTE(HTK_Image)
295 
301  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **) const;
302 
303 private:
304  HSharedKey *m_pPersIdent;
305  HC_KEY m_key;
306 
307 
308 };
309 
311 class TK_PILine : public HTK_Line {
312 public:
316  TK_PILine(HSharedKey *persIdent) : HTK_Line()
317  {
318  m_pPersIdent = persIdent;
319  }
320  OVERLOAD_INTERPRET_INT(HTK_Line)
321  OVERLOAD_WRITE(HTK_Line)
322  OVERLOAD_EXECUTE(HTK_Line)
323 
329  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
330 
331 private:
332  HSharedKey *m_pPersIdent;
333  HC_KEY m_key;
334 
335 
336 };
337 
339 class TK_PIPolypoint : public HTK_Polypoint {
340 public:
344  TK_PIPolypoint(unsigned char opcode, HSharedKey *persIdent) : HTK_Polypoint(opcode)
345  {
346  m_pPersIdent = persIdent;
347  }
348  OVERLOAD_INTERPRET_INT(HTK_Polypoint)
349  OVERLOAD_WRITE(HTK_Polypoint)
350  OVERLOAD_EXECUTE(HTK_Polypoint)
351 
357  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
358 
359 private:
360  HSharedKey *m_pPersIdent;
361  HC_KEY m_key;
362 
363 
364 };
365 
367 class TK_PIPolyPolypoint : public HTK_PolyPolypoint {
368 public:
372  TK_PIPolyPolypoint(unsigned char opcode, HSharedKey *persIdent) : HTK_PolyPolypoint(opcode)
373  {
374  m_pPersIdent = persIdent;
375  }
376  OVERLOAD_WRITE_POLY(HTK_PolyPolypoint)
377  OVERLOAD_EXECUTE_POLY(HTK_PolyPolypoint)
378 
384  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
385 
386 private:
387  HSharedKey *m_pPersIdent;
388 
389 };
390 
392 class TK_PIPoint : public HTK_Point {
393 public:
397  TK_PIPoint(unsigned char opcode, HSharedKey *persIdent) : HTK_Point(opcode)
398  {
399  m_pPersIdent = persIdent;
400  }
401  OVERLOAD_INTERPRET_INT(HTK_Point)
402  OVERLOAD_WRITE(HTK_Point)
403  OVERLOAD_EXECUTE(HTK_Point)
404 
410  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
411 
412 private:
413  HSharedKey *m_pPersIdent;
414  HC_KEY m_key;
415 
416 
417 };
418 
420 class TK_PISpot_Light : public HTK_Spot_Light {
421 public:
425  TK_PISpot_Light(HSharedKey *persIdent) : HTK_Spot_Light()
426  {
427  m_pPersIdent = persIdent;
428  }
429  OVERLOAD_INTERPRET_INT(HTK_Spot_Light)
430  OVERLOAD_WRITE(HTK_Spot_Light)
431  OVERLOAD_EXECUTE(HTK_Spot_Light)
432 
438  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
439 
440 private:
441  HSharedKey *m_pPersIdent;
442  HC_KEY m_key;
443 
444 
445 };
446 
448 class TK_PIArea_Light : public HTK_Area_Light {
449 public:
453  TK_PIArea_Light(HSharedKey *persIdent) : HTK_Area_Light()
454  {
455  m_pPersIdent = persIdent;
456  }
457  OVERLOAD_INTERPRET_INT(HTK_Area_Light)
458  OVERLOAD_WRITE(HTK_Area_Light)
459  OVERLOAD_EXECUTE(HTK_Area_Light)
460 
466  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
467 
468 private:
469  HSharedKey *m_pPersIdent;
470  HC_KEY m_key;
471 
472 
473 };
474 
476 class TK_PIMesh : public HTK_Mesh {
477 public:
481  TK_PIMesh(HSharedKey *persIdent) : HTK_Mesh()
482  {
483  m_pPersIdent = persIdent;
484  }
485  OVERLOAD_INTERPRET_INT(HTK_Mesh)
486  OVERLOAD_WRITE(HTK_Mesh)
487  OVERLOAD_EXECUTE(HTK_Mesh)
488 
494  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
495 
496 private:
497  HSharedKey *m_pPersIdent;
498  HC_KEY m_key;
499 
500 
501 };
502 
504 class TK_PINURBS_Curve : public HTK_NURBS_Curve {
505 public:
509  TK_PINURBS_Curve(HSharedKey *persIdent) : HTK_NURBS_Curve()
510  {
511  m_pPersIdent = persIdent;
512  }
513  OVERLOAD_INTERPRET_INT(HTK_NURBS_Curve)
514  OVERLOAD_WRITE(HTK_NURBS_Curve)
515  OVERLOAD_EXECUTE(HTK_NURBS_Curve)
516 
522  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
523 
524 private:
525  HSharedKey *m_pPersIdent;
526  HC_KEY m_key;
527 
528 
529 };
530 
532 class TK_PICutting_Plane : public HTK_Cutting_Plane {
533 public:
537  TK_PICutting_Plane( HSharedKey *persIdent) : HTK_Cutting_Plane()
538  {
539  m_pPersIdent = persIdent;
540  }
541  OVERLOAD_INTERPRET_INT(HTK_Cutting_Plane)
542  OVERLOAD_WRITE(HTK_Cutting_Plane)
543  OVERLOAD_EXECUTE(HTK_Cutting_Plane)
544 
550  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
551 
552 private:
553  HSharedKey *m_pPersIdent;
554  HC_KEY m_key;
555 
556 
557 };
558 
560 class TK_PIText : public HTK_Text {
561 public:
565  TK_PIText(unsigned char opcode, HSharedKey *persIdent) : HTK_Text(opcode)
566  {
567  m_pPersIdent = persIdent;
568  }
569  OVERLOAD_INTERPRET_INT(HTK_Text)
570  OVERLOAD_WRITE(HTK_Text)
571  OVERLOAD_EXECUTE(HTK_Text)
572 
578  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
579 
580 private:
581  HSharedKey *m_pPersIdent;
582  HC_KEY m_key;
583 
584 
585 };
586 
588 class TK_PIReferenced_Segment : public HTK_Referenced_Segment {
589 public:
593  TK_PIReferenced_Segment(unsigned char opcode, HSharedKey *persIdent) : HTK_Referenced_Segment(opcode)
594  {
595  m_pPersIdent = persIdent;
596  }
597  OVERLOAD_INTERPRET_INT(HTK_Referenced_Segment)
598  OVERLOAD_WRITE(HTK_Referenced_Segment)
599  OVERLOAD_EXECUTE(HTK_Referenced_Segment)
600 
606  TK_Status Clone (BStreamFileToolkit & tk, BBaseOpcodeHandler **handler) const;
607 
608 private:
609  HSharedKey *m_pPersIdent;
610  HC_KEY m_key;
611 
612 
613 };
614 
615 
616 
617 #ifdef H_PACK_8
618 #pragma pack(pop)
619 #endif
620 
621 #endif
622 
623 
624 
625 
626 
627 
628 
629 
TK_PIReferenced_Segment(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:593
Definition: HSharedKey.h:560
TK_PIImage(HSharedKey *persIdent)
Definition: HSharedKey.h:288
TK_PIText(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:565
Definition: HSharedKey.h:367
Definition: HSharedKey.h:200
TK_PICutting_Plane(HSharedKey *persIdent)
Definition: HSharedKey.h:537
TK_PIMesh(HSharedKey *persIdent)
Definition: HSharedKey.h:481
Definition: HSharedKey.h:172
Definition: HSharedKey.h:504
Definition: HSharedKey.h:420
#define HC_KEY
Definition: HSharedKey.h:392
Definition: HSharedKey.h:283
Definition: HSharedKey.h:532
TK_PIPoint(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:397
TK_PIEllipse(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:232
TK_PICircle(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:205
Definition: HSharedKey.h:311
Definition: HSharedKey.h:256
Definition: HSharedKey.h:339
TK_PILine(HSharedKey *persIdent)
Definition: HSharedKey.h:316
TK_PIOpen_Segment(HSharedKey *persIdent)
Definition: HSharedKey.h:177
TK_PIShell(HSharedKey *persIdent)
Definition: HSharedKey.h:151
TK_PISpot_Light(HSharedKey *persIdent)
Definition: HSharedKey.h:425
Definition: HSharedKey.h:448
TK_PIGrid(HSharedKey *persIdent)
Definition: HSharedKey.h:261
TK_PIPolypoint(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:344
Definition: HSharedKey.h:227
Definition: HSharedKey.h:146
virtual TK_Status Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const
Definition: HSharedKey.h:476
TK_PIArea_Light(HSharedKey *persIdent)
Definition: HSharedKey.h:453
TK_PINURBS_Curve(HSharedKey *persIdent)
Definition: HSharedKey.h:509
TK_PIPolyPolypoint(unsigned char opcode, HSharedKey *persIdent)
Definition: HSharedKey.h:372
Definition: HSharedKey.h:588
Definition: HSharedKey.h:84