1 // File : SALOMEDS_AttributeStudyProperties.cxx
2 // Author : Sergey RUIN
5 #include "SALOMEDS_AttributeStudyProperties.hxx"
8 #include <TCollection_AsciiString.hxx>
9 #include <TCollection_ExtendedString.hxx>
10 #include <TColStd_HSequenceOfExtendedString.hxx>
11 #include <TColStd_HSequenceOfInteger.hxx>
13 SALOMEDS_AttributeStudyProperties
14 ::SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr)
15 :SALOMEDS_GenericAttribute(theAttr)
18 SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr)
19 :SALOMEDS_GenericAttribute(theAttr)
22 SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties()
26 void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName)
28 if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName((char*)theName.c_str());
29 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
32 std::string SALOMEDS_AttributeStudyProperties::GetUserName()
36 TCollection_AsciiString N = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName();
37 aName = N.ToCString();
40 else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
42 else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
47 void SALOMEDS_AttributeStudyProperties::SetCreationDate(int theMinute, int theHour, int theDay, int theMonth, int theYear)
50 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute,
56 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
63 bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
71 ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationDate(theMinute,
77 CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
78 ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute,
83 theMinute = (int)aMinute; theHour = (int)anHour; theDay = (int)aDay; theMonth = (int)aMonth; theYear = (int)anYear;
88 void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode)
91 if(theMode == "from scratch")
92 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1);
93 else if(theMode == "copy from")
94 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2);
96 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0);
98 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
101 std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
105 int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode();
106 if(mode == 1) aMode = "from scratch";
107 if(mode == 2) aMode = "copy from";
109 else aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode();
113 void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
115 if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified);
116 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
119 bool SALOMEDS_AttributeStudyProperties::IsModified()
122 if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified();
123 else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
127 int SALOMEDS_AttributeStudyProperties::GetModified()
130 if(_isLocal) isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified();
131 else isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
135 void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
137 if(_isLocal) Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked);
138 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
141 bool SALOMEDS_AttributeStudyProperties::IsLocked()
144 if(_isLocal) ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked();
145 else ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
149 void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theName,
157 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetUserName((char*)theName.c_str());
158 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModificationDate(theMinute,
164 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
172 void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector<std::string>& theNames,
173 std::vector<int>& theMinutes,
174 std::vector<int>& theHours,
175 std::vector<int>& theDays,
176 std::vector<int>& theMonths,
177 std::vector<int>& theYears,
184 Handle(TColStd_HSequenceOfExtendedString) aNames;
185 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
186 aNames = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetUserNames();
187 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModificationDates(aMinutes,
192 aLength = aNames->Length()-((theWithCreator)?0:1);
193 for(i = 0; i < aLength; i++)
195 theNames.push_back(TCollection_AsciiString(aNames->Value(i + 1 + ((theWithCreator)?0:1))).ToCString());
196 theMinutes.push_back(aMinutes->Value(i + 1 + ((theWithCreator)?0:1)));
197 theHours.push_back(aHours->Value(i + 1 + ((theWithCreator)?0:1)));
198 theDays.push_back(aDays->Value(i + 1 + ((theWithCreator)?0:1)));
199 theMonths.push_back(aMonths->Value(i + 1 + ((theWithCreator)?0:1)));
200 theYears.push_back(aYears->Value(i + 1 + ((theWithCreator)?0:1)));
204 SALOMEDS::StringSeq_var aNames;
205 SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
206 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(),
213 aLength = aNames->length();
214 for(i = 0; i<aLength; i++) {
215 theNames.push_back(aNames[i].in());
216 theMinutes.push_back(aMinutes[i]);
217 theHours.push_back(aHours[i]);
218 theDays.push_back(aDays[i]);
219 theMonths.push_back(aMonths[i]);
220 theYears.push_back(aYears[i]);