1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2019, Nefelus Inc
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 //   list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 //   this list of conditions and the following disclaimer in the documentation
15 //   and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 //   contributors may be used to endorse or promote products derived from
19 //   this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32 
33 #pragma once
34 
35 #include "odb.h"
36 
37 namespace odb {
38 
39 ///
40 /// This file declares the non-persistant database objects and misc.
41 /// type-definitions.
42 ///
43 
44 ///
45 /// The orientation define the rotation and axis mirroring for the
46 /// placement of various database objects. The values conform the orient
47 /// definitions defined in the LEF/DEF formats.
48 ///
49 class dbOrientType
50 {
51  public:
52   enum Value
53   {
54     R0,    /** rotate object 0 degrees */
55     R90,   /** rotate object 90 degrees */
56     R180,  /** rotate object 180 degrees */
57     R270,  /** rotate object 270 degrees */
58     MY,    /** mirror about the "Y" axis */
59     MYR90, /** mirror about the "Y" axis and rotate 90 degrees */
60     MX,    /** mirror about the "X" axis */
61     MXR90  /** mirror about the "X" axis and rotate 90 degrees */
62   };
63 
64   ///
65   /// Create a dbOrientType instance with an explicit orientation..
66   /// The explicit orientation must be a string of one of the
67   ///  following values: "R0", "R90", "R180", "270", "MY", "MX", "MYR90",
68   ///  or "MXR90".
69   ///
70   dbOrientType(const char* orient);
71 
72   ///
73   /// Create a dbOrientType instance with an explicit orientation..
74   ///
75   dbOrientType(Value orient);
76 
77   ///
78   /// Create a dbOrientType instance with orientation "R0".
79   ///
80   dbOrientType();
81 
82   ///
83   /// Copy constructor.
84   ///
85   dbOrientType(const dbOrientType& orient);
86 
87   ///
88   /// Returns the orientation
89   ///
getValue()90   Value getValue() const { return _value; }
91 
92   ///
93   /// Returns the orientation as a string
94   ///
95   const char* getString() const;
96 
97   ///
98   /// Cast operator
99   ///
Value()100   operator Value() const { return _value; }
101 
102   ///
103   /// Returns the orientation after flipping about the x-axis
104   ///
105   dbOrientType flipX() const;
106 
107   ///
108   /// Returns the orientation after flipping about the y-axis
109   ///
110   dbOrientType flipY() const;
111 
112  private:
113   Value _value;
114 };
115 
116 ///
117 /// Electrical signals are classified according to the role of the signal.
118 ///
119 class dbSigType
120 {
121  public:
122   enum Value
123   {
124     SIGNAL, /** */
125     POWER,  /** */
126     GROUND, /** */
127     CLOCK,  /** */
128     ANALOG, /** */
129     RESET,  /** */
130     SCAN,   /** */
131     TIEOFF  /** */
132   };
133 
134   ///
135   /// Create a dbSigType instance with an explicit signal value.
136   /// The explicit signal value must be a string of one of the
137   ///  following values: "signal", "power", "ground", "clock"
138   ///
139   dbSigType(const char* value);
140 
141   ///
142   /// Create a dbSigType instance with an explicit signal value..
143   ///
144   dbSigType(Value value);
145 
146   ///
147   /// Create a dbSigType instance with value "signal".
148   ///
149   dbSigType();
150 
151   ///
152   /// Copy constructor.
153   ///
154   dbSigType(const dbSigType& value);
155 
156   ///
157   /// Returns the signal-value
158   ///
getValue()159   Value getValue() const { return _value; }
160 
161   ///
162   /// Returns the signal-value as a string.
163   ///
164   const char* getString() const;
165 
166   ///
167   ///  True Iff value corresponds to POWER or GROUND
168   ///
169   bool isSupply() const;
170 
171   ///
172   /// Cast operator
173   ///
Value()174   operator Value() const { return _value; }
175 
176  private:
177   Value _value;
178 };
179 
180 ///
181 /// Specifies the functional electical behavior of a terminal.
182 ///
183 class dbIoType
184 {
185  public:
186   enum Value
187   {
188     INPUT,
189     OUTPUT,
190     INOUT,
191     FEEDTHRU
192   };
193 
194   ///
195   /// Create a dbIoType instance with an explicit io-direction..
196   /// The explicit io-direction must be a string of one of the
197   ///  following values: "input", "output", "inout"
198   ///
199   dbIoType(const char* value);
200 
201   ///
202   /// Create a dbIoType instance with an explicit IO direction..
203   ///
204   dbIoType(Value value);
205 
206   ///
207   /// Create a dbIoType instance with value "input".
208   ///
209   dbIoType();
210 
211   ///
212   /// Copy constructor.
213   ///
214   dbIoType(const dbIoType& value);
215 
216   ///
217   /// Returns the direction of IO of an element.
218   ///
getValue()219   Value getValue() const { return _value; }
220 
221   ///
222   /// Returns the direction of IO of an element as a string.
223   ///
224   const char* getString() const;
225 
226   ///
227   /// Cast operator
228   ///
Value()229   operator Value() const { return _value; }
230 
231  private:
232   Value _value;
233 };
234 
235 ///
236 /// Specifies the placement status of an element.
237 ///
238 class dbPlacementStatus
239 {
240  public:
241   enum Value
242   {
243     NONE,      /** element has not been placed */
244     UNPLACED,  /** element has an arbitrary placement */
245     SUGGESTED, /** element has a suggested placement */
246     PLACED,    /** element has been placed */
247     LOCKED,    /** element cannot be moved */
248     FIRM,      /** element cannot be moved by a placer*/
249     COVER      /** cover element cannot be moved */
250   };
251 
252   ///
253   /// Create a dbPlacementStatus instance with an explicit placement status..
254   /// The explicit status must be a string of one of the
255   ///  following values: "none", "unplaced", "suggested", "placed",
256   ///  "locked", "firm", "cover".
257   ///
258   dbPlacementStatus(const char* value);
259 
260   ///
261   /// Create a dbPlacementStatus instance with an explicit status.
262   ///
263   dbPlacementStatus(Value value);
264 
265   ///
266   /// Create a dbPlacementStatus instance with status = "none".
267   ///
268   dbPlacementStatus();
269 
270   ///
271   /// Copy constructor.
272   ///
273   dbPlacementStatus(const dbPlacementStatus& value);
274 
275   ///
276   /// Returns the placement status.
277   ///
getValue()278   Value getValue() const { return _value; }
279 
280   ///
281   /// Returns the placement status as a string.
282   ///
283   const char* getString() const;
284 
285   ///
286   /// Cast operator
287   ///
Value()288   operator Value() const { return _value; }
289 
290   ///
291   ///  True Iff value corresponds to a PLACED, LOCKED, FIRM, or COVER
292   ///
293   bool isPlaced() const;
294 
295   ///
296   ///  True Iff value corresponds to LOCKED, FIRM, or COVER
297   ///
298   bool isFixed() const;
299 
300  private:
301   Value _value;
302 };
303 
304 ///
305 /// Defines the value of cell a master represents.
306 ///
307 class dbMasterType
308 {
309  public:
310   enum Value
311   {
312     NONE,              /** */
313     COVER,             /** */
314     COVER_BUMP,        /** */
315     RING,              /** */
316     BLOCK,             /** */
317     BLOCK_BLACKBOX,    /** */
318     BLOCK_SOFT,        /** */
319     PAD,               /** */
320     PAD_INPUT,         /** */
321     PAD_OUTPUT,        /** */
322     PAD_INOUT,         /** */
323     PAD_POWER,         /** */
324     PAD_SPACER,        /** */
325     PAD_AREAIO,        /** */
326     CORE,              /** */
327     CORE_FEEDTHRU,     /** */
328     CORE_TIEHIGH,      /** */
329     CORE_TIELOW,       /** */
330     CORE_SPACER,       /** */
331     CORE_ANTENNACELL,  /** */
332     CORE_WELLTAP,      /** */
333     ENDCAP,            /** */
334     ENDCAP_PRE,        /** */
335     ENDCAP_POST,       /** */
336     ENDCAP_TOPLEFT,    /** */
337     ENDCAP_TOPRIGHT,   /** */
338     ENDCAP_BOTTOMLEFT, /** */
339     ENDCAP_BOTTOMRIGHT /** */
340   };
341 
342   ///
343   /// Create a dbMasterType instance with an explicit placement status..
344   /// The explicit status must be a string of one of the
345   ///  following values: "none", "cover", "ring", "block",
346   ///  "block blackbox", "block soft",
347   ///  "pad", "pad input", "pad output", "pad inout",
348   ///  "pad power", "pad spacer", "pad areaio",
349   ///  "core", "core feedthru", "core tielow",
350   ///  "core tiehigh", "core antennacell", "core welltap",
351   ///  "endcap", "endcap pre", "endcap post",
352   ///  "endcap topright", "endcap topleft",
353   ///  "endcap bottomright", "endcap bottomleft"
354   ///
355   dbMasterType(const char* value);
356 
357   ///
358   /// Create a dbMasterType instance with an explicit value.
359   ///
360   dbMasterType(Value value);
361 
362   ///
363   /// Create a dbMasterType instance with value = "none".
364   ///
365   dbMasterType();
366 
367   ///
368   /// Copy constructor.
369   ///
370   dbMasterType(const dbMasterType& value);
371 
372   ///
373   /// Returns the master-value.
374   ///
getValue()375   Value getValue() const { return _value; }
376 
377   ///
378   /// Returns the master-value as a string.
379   ///
380   const char* getString() const;
381 
382   ///
383   /// Cast operator
384   ///
Value()385   operator Value() const { return _value; }
386 
387   ///
388   /// Is the type BLOCK or any of its subtypes
389   ///
390   bool isBlock() const;
391 
392   ///
393   /// Is the type CORE or any of its subtypes
394   ///
395   bool isCore() const;
396 
397   ///
398   /// Is the type PAD or any of its subtypes
399   ///
400   bool isPad() const;
401 
402   ///
403   /// Is the type ENDCAP or any of its subtypes
404   ///
405   bool isEndCap() const;
406 
407  private:
408   Value _value;
409 };
410 
411 ///
412 /// Defines the layer type
413 ///
414 class dbTechLayerType
415 {
416  public:
417   enum Value
418   {
419     ROUTING,     /** */
420     CUT,         /** */
421     MASTERSLICE, /** */
422     OVERLAP,     /** */
423     IMPLANT,     /** */
424     NONE         /** */
425   };
426 
427   ///
428   /// Create a dbTechLayerType instance with an explicit placement status..
429   /// The explicit status must be a string of one of the
430   ///  following values: "routing", "cut", "masterslice", "overlap"
431   ///
432   dbTechLayerType(const char* value);
433 
434   ///
435   /// Create a dbTechLayerType instance with an explicit value.
436   ///
437   dbTechLayerType(Value value);
438 
439   ///
440   /// Create a dbTechLayerType instance with value = "none".
441   ///
442   dbTechLayerType();
443 
444   ///
445   /// Copy constructor.
446   ///
447   dbTechLayerType(const dbTechLayerType& value);
448 
449   ///
450   /// Returns the layer-value.
451   ///
getValue()452   Value getValue() const { return _value; }
453 
454   ///
455   /// Returns the layer-value as a string.
456   ///
457   const char* getString() const;
458 
459   ///
460   /// Cast operator
461   ///
Value()462   operator Value() const { return _value; }
463 
464  private:
465   Value _value;
466 };
467 
468 ///
469 /// Defines the type of cell a master represents.
470 ///
471 class dbTechLayerDir
472 {
473  public:
474   enum Value
475   {
476     NONE,       /** */
477     HORIZONTAL, /** */
478     VERTICAL    /** */
479   };
480 
481   ///
482   /// Create a dbTechLayerDir instance with an explicit placement status..
483   /// The explicit status must be a string of one of the
484   ///  following values: "none", "horizontal", "vertical"
485   ///
486   dbTechLayerDir(const char* direction);
487 
488   ///
489   /// Create a dbTechLayerDir instance with an explicit direction.
490   ///
491   dbTechLayerDir(Value value);
492 
493   ///
494   /// Create a dbTechLayerDir instance with direction = "none".
495   ///
496   dbTechLayerDir();
497 
498   ///
499   /// Copy constructor.
500   ///
501   dbTechLayerDir(const dbTechLayerDir& value);
502 
503   ///
504   /// Returns the layer-direction.
505   ///
getValue()506   Value getValue() const { return _value; }
507 
508   ///
509   /// Returns the layer-direction as a string.
510   ///
511   const char* getString() const;
512 
513   ///
514   /// Cast operator
515   ///
Value()516   operator Value() const { return _value; }
517 
518  private:
519   Value _value;
520 };
521 
522 ///
523 /// Defines the type of min step rule
524 ///
525 class dbTechLayerMinStepType
526 {
527  public:
528   enum Value
529   {
530     INSIDE_CORNER,
531     OUTSIDE_CORNER,
532     STEP
533   };
534 
535   ///
536   /// Create a dbTechLayerMinStepType instance with an explicit type.
537   /// The explicit type must be a string of one of the
538   ///  following values: "INSIDECORNER", "OUTSIDECORNER", "STEP"
539   ///
540   dbTechLayerMinStepType(const char* type);
541 
542   ///
543   /// Create a dbTechLayerMinStepType instance with an explicit type.
544   ///
545   dbTechLayerMinStepType(Value value);
546 
547   ///
548   /// Create a dbTechLayerMinStepType instance with value = "OUTSIDE_CORNER".
549   ///
550   dbTechLayerMinStepType();
551 
552   ///
553   /// Copy constructor.
554   ///
555   dbTechLayerMinStepType(const dbTechLayerMinStepType& value);
556 
557   ///
558   /// Returns the layer-direction.
559   ///
getValue()560   Value getValue() const { return _value; }
561 
562   ///
563   /// Returns the layer-direction as a string.
564   ///
565   const char* getString() const;
566 
567   ///
568   /// Cast operator
569   ///
Value()570   operator Value() const { return _value; }
571 
572  private:
573   Value _value;
574 };
575 
576 ///
577 /// Defines the type of cell a master represents.
578 ///
579 class dbRowDir
580 {
581  public:
582   enum Value
583   {
584     HORIZONTAL, /** */
585     VERTICAL    /** */
586   };
587 
588   ///
589   /// Create a dbTechLayerDir instance with an explicit placement status..
590   /// The explicit status must be a string of one of the
591   ///  following values: "horizontal" or "vertical"
592   ///
593   dbRowDir(const char* direction);
594 
595   ///
596   /// Create a dbTechLayerDir instance with an explicit direction.
597   ///
598   dbRowDir(Value value);
599 
600   ///
601   /// Create a dbTechLayerDir instance with direction = "none".
602   ///
603   dbRowDir();
604 
605   ///
606   /// Copy constructor.
607   ///
608   dbRowDir(const dbRowDir& value);
609 
610   ///
611   /// Returns the layer-direction.
612   ///
getValue()613   Value getValue() const { return _value; }
614 
615   ///
616   /// Returns the layer-direction as a string.
617   ///
618   const char* getString() const;
619 
620   ///
621   /// Cast operator
622   ///
Value()623   operator Value() const { return _value; }
624 
625  private:
626   Value _value;
627 };
628 
629 ///
630 /// Defines the type of objects which own a dbBox.
631 ///
632 class dbBoxOwner
633 {
634  public:
635   enum Value
636   {
637     UNKNOWN,
638     BLOCK,
639     INST,
640     BTERM,
641     VIA,
642     OBSTRUCTION,
643     SWIRE,
644     BLOCKAGE,
645     MASTER,
646     MPIN,
647     TECH_VIA,
648     REGION,
649     BPIN
650   };
651 
652   ///
653   /// Create a dbBoxOwner instance with an explicit value.
654   ///
655   dbBoxOwner(const char* value);
656 
657   ///
658   /// Create a dbBoxOwner instance with an explicit value.
659   ///
660   dbBoxOwner(Value value);
661 
662   ///
663   /// Create a dbBoxOwner instance with value = UNKNOWN.
664   ///
665   dbBoxOwner();
666 
667   ///
668   /// Copy constructor.
669   ///
670   dbBoxOwner(const dbBoxOwner& value);
671 
672   ///
673   /// Returns the owner-value.
674   ///
getValue()675   Value getValue() const { return _value; }
676 
677   ///
678   /// Returns the owner-value as a string.
679   ///
680   const char* getString() const;
681 
682   ///
683   /// Cast operator
684   ///
Value()685   operator Value() const { return _value; }
686 
687  private:
688   Value _value;
689 };
690 
691 ///
692 /// Defines the type of objects which own a dbBox.
693 ///
694 class dbPolygonOwner
695 {
696  public:
697   enum Value
698   {
699     UNKNOWN,
700     BPIN,
701     OBSTRUCTION,
702     SWIRE,
703   };
704 
705   ///
706   /// Create a dbBoxOwner instance with an explicit value.
707   ///
708   dbPolygonOwner(Value value);
709 
710   ///
711   /// Create a dbBoxOwner instance with value = UNKNOWN.
712   ///
713   dbPolygonOwner();
714 
715   ///
716   /// Copy constructor.
717   ///
718   dbPolygonOwner(const dbBoxOwner& value);
719 
720   ///
721   /// Returns the owner-value.
722   ///
getValue()723   Value getValue() const { return _value; }
724 
725   ///
726   /// Returns the value as a string.
727   ///
728   const char* getString() const;
729 
730   ///
731   /// Cast operator
732   ///
Value()733   operator Value() const { return _value; }
734 
735  private:
736   Value _value;
737 };
738 
739 ///
740 /// Defines the type of wires.
741 ///
742 class dbWireType
743 {
744  public:
745   enum Value
746   {
747     NONE,
748     COVER,
749     FIXED,
750     ROUTED,
751     SHIELD,
752     NOSHIELD
753   };
754 
755   ///
756   ///  Create a wire type of one of the following
757   ///  values "cover", "fixed", "routed"
758   ///
759   dbWireType(const char* value);
760 
761   ///
762   /// Create a dbBoxOwner instance with an explicit value.
763   ///
764   dbWireType(Value value);
765 
766   ///
767   /// Create a dbWireType instance with value = NONE
768   ///
769   dbWireType();
770 
771   ///
772   /// Copy constructor.
773   ///
774   dbWireType(const dbWireType& value);
775 
776   ///
777   /// Returns the type-value.
778   ///
getValue()779   Value getValue() const { return _value; }
780 
781   ///
782   /// Returns the owner-value as a string.
783   ///
784   const char* getString() const;
785 
786   ///
787   /// Cast operator
788   ///
Value()789   operator Value() const { return _value; }
790 
791  private:
792   Value _value;
793 };
794 
795 ///
796 /// Defines the type of shapes.
797 ///
798 class dbWireShapeType
799 {
800  public:
801   enum Value
802   {
803     NONE,
804     RING,
805     PADRING,
806     BLOCKRING,
807     STRIPE,
808     FOLLOWPIN,
809     IOWIRE,
810     COREWIRE,
811     BLOCKWIRE,
812     BLOCKAGEWIRE,
813     FILLWIRE,
814     DRCFILL
815   };
816 
817   ///
818   ///  Create a wire type of one of the following
819   ///  values "ring", "padring", "blockring", "stripe",
820   ///  "followpin", "iowire", "corewire", "blockwire", "blockagewire",
821   ///  "fillwire", "drcfill"
822   ///
823   dbWireShapeType(const char* value);
824 
825   ///
826   /// Create a dbBoxOwner instance with an explicit value.
827   ///
828   dbWireShapeType(Value value);
829 
830   ///
831   /// Create a dbWireType instance with value = RING
832   ///
833   dbWireShapeType();
834 
835   ///
836   /// Copy constructor.
837   ///
838   dbWireShapeType(const dbWireShapeType& value);
839 
840   ///
841   /// Returns the type-value.
842   ///
getValue()843   Value getValue() const { return _value; }
844 
845   ///
846   /// Returns the owner-value as a string.
847   ///
848   const char* getString() const;
849 
850   ///
851   /// Cast operator
852   ///
Value()853   operator Value() const { return _value; }
854 
855  private:
856   Value _value;
857 };
858 
859 ///
860 /// Defines the class of sites.
861 ///
862 class dbSiteClass
863 {
864  public:
865   enum Value
866   {
867     NONE,
868     PAD,
869     CORE
870   };
871 
872   ///
873   ///  Create a wire type of one of the following
874   ///  values "pad", "core"
875   ///
876   dbSiteClass(const char* value);
877 
878   ///
879   /// Create a dbSiteClass instance with an explicit value.
880   ///
881   dbSiteClass(Value value);
882 
883   ///
884   /// Create a dbSiteClass instance with value = NONE
885   ///
886   dbSiteClass();
887 
888   ///
889   /// Copy constructor.
890   ///
891   dbSiteClass(const dbSiteClass& value);
892 
893   ///
894   /// Returns the type-value.
895   ///
getValue()896   Value getValue() const { return _value; }
897 
898   ///
899   /// Returns the owner-value as a string.
900   ///
901   const char* getString() const;
902 
903   ///
904   /// Cast operator
905   ///
Value()906   operator Value() const { return _value; }
907 
908  private:
909   Value _value;
910 };
911 
912 //
913 //  For LEF Constructs comprising the values "ON" and "OFF"
914 //  These may be output by the LEF parser as a string or an int.
915 //
916 class dbOnOffType
917 {
918  public:
919   enum Value
920   {
921     OFF = 0,
922     ON
923   };
924 
925   ///
926   /// Construction may take a string ("ON", "OFF"), an int (0 vs not 0),
927   /// a bool, a type value, or default ("OFF")
928   ///
929   dbOnOffType(const char* instr);
930   dbOnOffType(int innum);
931   dbOnOffType(bool insw);
932   dbOnOffType(Value inval);
933   dbOnOffType();
934 
935   ///
936   /// Returns the orientation as type, string, int (0,1), bool
937   ///
getValue()938   Value getValue() const { return _value; }
939   const char* getString() const;
940   int getAsInt() const;
941   bool isSet() const;
942 
943   ///
944   /// Cast operator
945   ///
Value()946   operator Value() const { return _value; }
947 
948  private:
949   Value _value;
950 };
951 
952 //
953 //  For CLEARANCEMEASURE LEF construct
954 //
955 class dbClMeasureType
956 {
957  public:
958   enum Value
959   {
960     EUCLIDEAN = 0,
961     MAXXY
962   };
963 
964   ///
965   /// Construction may take a string, a type value, or default ("EUCLIDEAN")
966   ///
967   dbClMeasureType(const char* instr);
dbClMeasureType(Value inval)968   dbClMeasureType(Value inval) { _value = inval; }
dbClMeasureType()969   dbClMeasureType() { _value = EUCLIDEAN; }
970 
971   ///
972   /// Returns the orientation as type or string
973   ///
getValue()974   Value getValue() const { return _value; }
975   const char* getString() const;
976 
977   ///
978   /// Cast operator
979   ///
Value()980   operator Value() const { return _value; }
981 
982  private:
983   Value _value;
984 };
985 
986 //
987 // For DB journal entries, need to record actions (add/delete objects) and
988 // owner information
989 //
990 class dbJournalEntryType
991 {
992  public:
993   enum Value
994   {
995     NONE = 0,
996     OWNER,
997     ADD,
998     DESTROY
999   };
1000 
1001   ///
1002   /// Construction may take a type value, or default ("NONE")
1003   ///
dbJournalEntryType(Value inval)1004   dbJournalEntryType(Value inval) { _value = inval; }
dbJournalEntryType()1005   dbJournalEntryType() { _value = NONE; }
1006 
1007   ///
1008   /// Returns as type or string
1009   ///
getValue()1010   Value getValue() const { return _value; }
1011   const char* getString() const;
1012 
1013   ///
1014   /// Cast operator
1015   ///
Value()1016   operator Value() const { return _value; }
1017 
1018  private:
1019   Value _value;
1020 };
1021 
1022 //
1023 //  Class to denote the four directions, in CW order
1024 //
1025 class dbDirection
1026 {
1027  public:
1028   enum Value
1029   {
1030     NONE = 0,
1031     NORTH,
1032     EAST,
1033     SOUTH,
1034     WEST
1035   };
1036 
1037   ///
1038   /// Construction may take a type value, or default ("NONE")
1039   ///
dbDirection(Value inval)1040   dbDirection(Value inval) { _value = inval; }
dbDirection()1041   dbDirection() { _value = NONE; }
1042 
1043   ///
1044   /// Returns as type or string
1045   ///
getValue()1046   Value getValue() const { return _value; }
1047   const char* getString() const;
1048 
1049   ///
1050   /// Cast operator
1051   ///
Value()1052   operator Value() const { return _value; }
1053 
1054  private:
1055   Value _value;
1056 };
1057 
1058 //
1059 //  Class to denote a region type
1060 //
1061 class dbRegionType
1062 {
1063  public:
1064   enum Value
1065   {
1066     INCLUSIVE,
1067     EXCLUSIVE,  // corrsponds to DEF FENCE type.
1068     SUGGESTED   // corrsponds to DEF GUIDE type.
1069   };
1070 
dbRegionType(Value inval)1071   dbRegionType(Value inval) { _value = inval; }
dbRegionType()1072   dbRegionType() { _value = INCLUSIVE; }
getValue()1073   Value getValue() const { return _value; }
1074   const char* getString() const;
Value()1075   operator Value() const { return _value; }
1076 
1077  private:
1078   Value _value;
1079 };
1080 
1081 //
1082 //  DEF Source Type
1083 //
1084 class dbSourceType
1085 {
1086  public:
1087   enum Value
1088   {
1089     NONE,
1090     NETLIST,
1091     DIST,
1092     USER,
1093     TIMING,
1094     TEST
1095   };
1096 
1097   dbSourceType(const char* value);
dbSourceType(Value inval)1098   dbSourceType(Value inval) { _value = inval; }
dbSourceType()1099   dbSourceType() { _value = NONE; }
getValue()1100   Value getValue() const { return _value; }
1101   const char* getString() const;
Value()1102   operator Value() const { return _value; }
1103 
1104  private:
1105   Value _value;
1106 };
1107 
1108 const uint64 MAX_UINT64 = 0xffffffffffffffffLL;
1109 const uint64 MIN_UINT64 = 0;
1110 const uint MAX_UINT = 0xffffffff;
1111 const uint MIN_UINT = 0;
1112 
1113 const int64 MAX_INT64 = 0x7fffffffffffffffLL;
1114 const int64 MIN_INT64 = 0x8000000000000000LL;
1115 const int MAX_INT = 0x7fffffff;
1116 const int MIN_INT = 0x80000000;
1117 
1118 //
1119 // Adding this to the inheritance list of your class causes your class (and
1120 // its descendants) to be non-copy.
1121 //
1122 class Ads_NoCopy
1123 {
1124  public:
Ads_NoCopy()1125   Ads_NoCopy() {}
1126   Ads_NoCopy(const Ads_NoCopy& q);
1127   Ads_NoCopy& operator=(const Ads_NoCopy& q);
1128 };
1129 
1130 }  // namespace odb
1131