0022627: Change OCCT memory management defaults
[occt.git] / src / ShapeExtend / ShapeExtend.cxx
1 // File:        ShapeExtend.cxx
2 // Created:     Wed Jun 10 16:03:56 1998
3 // Author:      data exchange team
4 //              <det@nicebox.nnov.matra-dtv.fr>
5
6
7 #include <ShapeExtend.ixx>
8 #include <Message_MsgFile.hxx>
9
10 //=======================================================================
11 //function : Init
12 //purpose  : 
13 //=======================================================================
14
15 void ShapeExtend::Init()
16 {
17   static Standard_Boolean init = Standard_False;
18   if (init) return;
19
20   init = Standard_True;
21   
22   // load Message File for Shape Healing
23   Message_MsgFile::LoadFromEnv ("CSF_SHMessage", "SHAPE");
24 }
25
26 //=======================================================================
27 //function : EncodeStatus
28 //purpose  : 
29 //=======================================================================
30
31 Standard_Integer ShapeExtend::EncodeStatus (const ShapeExtend_Status status)
32 {
33   switch ( status ) {
34   case ShapeExtend_OK   : return 0x0000;
35   case ShapeExtend_DONE1: return 0x0001;
36   case ShapeExtend_DONE2: return 0x0002;
37   case ShapeExtend_DONE3: return 0x0004;
38   case ShapeExtend_DONE4: return 0x0008;
39   case ShapeExtend_DONE5: return 0x0010;
40   case ShapeExtend_DONE6: return 0x0020;
41   case ShapeExtend_DONE7: return 0x0040;
42   case ShapeExtend_DONE8: return 0x0080;
43   case ShapeExtend_DONE : return 0x00ff;
44   case ShapeExtend_FAIL1: return 0x0100;
45   case ShapeExtend_FAIL2: return 0x0200;
46   case ShapeExtend_FAIL3: return 0x0400;
47   case ShapeExtend_FAIL4: return 0x0800;
48   case ShapeExtend_FAIL5: return 0x1000;
49   case ShapeExtend_FAIL6: return 0x2000;
50   case ShapeExtend_FAIL7: return 0x4000;
51   case ShapeExtend_FAIL8: return 0x8000;
52   case ShapeExtend_FAIL : return 0xff00;
53   }
54   return 0;
55 }
56
57 //=======================================================================
58 //function : DecodeStatus
59 //purpose  : 
60 //=======================================================================
61
62 Standard_Boolean ShapeExtend::DecodeStatus (const Standard_Integer flag, 
63                                            const ShapeExtend_Status status)
64 {
65   if ( status == ShapeExtend_OK ) return ( flag == 0 );
66   return ( flag & ShapeExtend::EncodeStatus ( status ) ? Standard_True : Standard_False );
67 }