Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeFlags_i.cxx
1 //  File   : SALOMEDS_AttributeFlags_i.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6 #include "SALOMEDS_AttributeFlags_i.hxx"
7 #include "SALOMEDS.hxx"  
8
9 using namespace std;
10
11 /*
12   Class       : SALOMEDS_AttributeFlags_i
13   Description : This class is intended for storing different object attributes that
14                 have only two states (0 and 1).
15                 
16                 Avalable attributes:
17                 
18                 IS_VISIBLE - is equal to 1 if object is visible in 3D view (0 - overwise).
19                              This attribute is valid for active view only.
20 */
21
22
23 //=======================================================================
24 // function : SALOMEDS_AttributeFlags_i::GetFlags
25 // purpose  : Get all flags as integer value
26 //=======================================================================
27 CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
28 {
29   SALOMEDS::Locker lock;
30   return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get();
31 }
32
33 //=======================================================================
34 // function : SALOMEDS_AttributeFlags_i::SetFlags
35 // purpose  : Set all flags as integer value
36 //=======================================================================
37 void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
38 {
39   SALOMEDS::Locker lock;
40   Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags );
41 }
42
43 //=======================================================================
44 // function : SALOMEDS_AttributeFlags_i::Get
45 // purpose  : Get specified flag
46 //=======================================================================
47 CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
48 {
49   SALOMEDS::Locker lock;
50   return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false;
51 }
52
53 //=======================================================================
54 // function : SALOMEDS_AttributeFlags_i::Set
55 // purpose  : Set/Unset specified flag
56 //=======================================================================
57 void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
58 {
59   SALOMEDS::Locker lock;
60   Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl);
61   if ( theValue )
62     anAttr->Set( anAttr->Get() | theFlag );
63   else
64     anAttr->Set( anAttr->Get() & ~theFlag );
65 }
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83