0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / TopAbs / TopAbs.cxx
1 // Created on: 1991-04-23
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 // Modified by model, Thu Jun 25 10:40:27 1992
18
19 #include <TopAbs.hxx>
20
21 //=======================================================================
22 //function : TopAbs_Compose
23 //purpose  : Compose two orientations
24 //=======================================================================
25 TopAbs_Orientation TopAbs::Compose(const TopAbs_Orientation O1,
26                                    const TopAbs_Orientation O2)
27 {
28   // see the composition table in the file TopAbs.cdl
29   static const TopAbs_Orientation TopAbs_Table_Compose[4][4] =
30   {
31     { TopAbs_FORWARD,  TopAbs_REVERSED, TopAbs_INTERNAL, TopAbs_EXTERNAL },
32     { TopAbs_REVERSED, TopAbs_FORWARD,  TopAbs_INTERNAL, TopAbs_EXTERNAL },
33     { TopAbs_INTERNAL, TopAbs_INTERNAL, TopAbs_INTERNAL, TopAbs_INTERNAL },
34     { TopAbs_EXTERNAL, TopAbs_EXTERNAL, TopAbs_EXTERNAL, TopAbs_EXTERNAL }
35   };
36   return TopAbs_Table_Compose[(Standard_Integer)O2][(Standard_Integer)O1];
37 }
38
39 //=======================================================================
40 //function : TopAbs::Reverse
41 //purpose  : reverse an Orientation
42 //=======================================================================
43
44 TopAbs_Orientation TopAbs::Reverse(const TopAbs_Orientation Ori)
45 {
46   static const TopAbs_Orientation TopAbs_Table_Reverse[4] =
47   {
48     TopAbs_REVERSED, TopAbs_FORWARD, TopAbs_INTERNAL, TopAbs_EXTERNAL
49   };
50   return TopAbs_Table_Reverse[(Standard_Integer)Ori];
51 }
52
53 //=======================================================================
54 //function : TopAbs::Complement
55 //purpose  : complement an Orientation
56 //=======================================================================
57
58 TopAbs_Orientation TopAbs::Complement(const TopAbs_Orientation Ori)
59 {
60   static const TopAbs_Orientation TopAbs_Table_Complement[4] =
61   {
62     TopAbs_REVERSED, TopAbs_FORWARD, TopAbs_EXTERNAL, TopAbs_INTERNAL
63   };
64   return TopAbs_Table_Complement[(Standard_Integer)Ori];
65 }
66
67 //=======================================================================
68 //function : TopAbs_Print
69 //purpose  : print the name of a ShapeEnum on a stream.
70 //=======================================================================
71
72 Standard_OStream& TopAbs::Print(const TopAbs_ShapeEnum se,
73                                        Standard_OStream& s)
74 {
75   static const Standard_CString TopAbs_Table_PrintShapeEnum[9] =
76   {
77     "COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX","SHAPE"
78   };
79   return (s << TopAbs_Table_PrintShapeEnum[(Standard_Integer)se]);
80 }
81
82 //=======================================================================
83 //function : TopAbs_Print
84 //purpose  : print the name of an Orientation on a stream
85 //=======================================================================
86
87 Standard_OStream& TopAbs::Print(const TopAbs_Orientation ori,
88                                        Standard_OStream& s)
89 {
90   static const Standard_CString TopAbs_Table_PrintOrientation[4] =
91   {
92     "FORWARD","REVERSED","INTERNAL","EXTERNAL"
93   };
94   return (s << TopAbs_Table_PrintOrientation[(Standard_Integer)ori]);
95 }
96
97 //=======================================================================
98 //function : TopAbs_Print
99 //purpose  : print the name of a State on a stream.
100 //=======================================================================
101
102 Standard_OStream& TopAbs::Print(const TopAbs_State st,
103                                 Standard_OStream& s)
104 {
105   static const Standard_CString TopAbs_Table_PrintState[4] =
106   {
107     "ON","IN","OUT","UNKNOWN"
108   };
109   return (s << TopAbs_Table_PrintState[(Standard_Integer)st]);
110 }