Salome HOME
ENV: Windows porting.
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_AttributeFlags.cxx
1 //  File   : SALOMEDS_AttributeFlags.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5 #include "SALOMEDS_AttributeFlags.hxx"
6
7 #include <TCollection_AsciiString.hxx>
8 #include <TCollection_ExtendedString.hxx>
9
10 SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr)
11 :SALOMEDS_GenericAttribute(theAttr)
12 {}
13
14 SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr)
15 :SALOMEDS_GenericAttribute(theAttr)
16 {}
17
18 SALOMEDS_AttributeFlags::~SALOMEDS_AttributeFlags()
19 {}
20
21 int SALOMEDS_AttributeFlags::GetFlags()
22 {
23   int aValue;
24   if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get();
25   else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags();
26   return aValue;
27 }
28
29 void SALOMEDS_AttributeFlags::SetFlags(int theFlags)
30 {
31   if(_isLocal) Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags);
32   else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags);
33 }
34
35 bool SALOMEDS_AttributeFlags::Get(int theFlag)
36 {
37   return (GetFlags() & theFlag) ? true : false;
38 }
39  
40 void SALOMEDS_AttributeFlags::Set(int theFlag, bool theValue)
41 {
42   if(_isLocal)  {
43     Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl);
44     if ( theValue )
45       anAttr->Set( anAttr->Get() | theFlag );
46     else
47       anAttr->Set( anAttr->Get() & ~theFlag );    
48   }
49   else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->Set(theFlag, theValue);
50 }