1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SALOMEDS_AttributeStudyProperties.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeStudyProperties.hxx"
28 #include "SALOMEDS.hxx"
30 SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
31 (SALOMEDSImpl_AttributeStudyProperties* theAttr)
32 :SALOMEDS_GenericAttribute(theAttr)
35 SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
36 (SALOMEDS::AttributeStudyProperties_ptr theAttr)
37 :SALOMEDS_GenericAttribute(theAttr)
40 SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties()
44 void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName)
48 SALOMEDS::Locker lock;
49 SALOMEDSImpl_AttributeStudyProperties* anImpl =
50 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
51 anImpl->ChangeCreatorName(theName);
53 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str());
56 std::string SALOMEDS_AttributeStudyProperties::GetUserName()
60 SALOMEDS::Locker lock;
61 aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
64 else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName();
66 else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA();
71 void SALOMEDS_AttributeStudyProperties::SetCreationDate
72 (int theMinute, int theHour, int theDay, int theMonth, int theYear)
76 SALOMEDS::Locker lock;
77 SALOMEDSImpl_AttributeStudyProperties* anImpl =
78 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
80 if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
82 anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
84 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute,
92 bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
100 SALOMEDS::Locker lock;
101 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>
102 (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
104 CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
105 ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute,
110 theMinute = (int)aMinute;
111 theHour = (int)anHour;
113 theMonth = (int)aMonth;
114 theYear = (int)anYear;
119 void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode)
123 SALOMEDS::Locker lock;
124 if (theMode == "from scratch")
125 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(1);
126 else if (theMode == "copy from")
127 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(2);
129 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(0);
131 else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str());
134 std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
138 SALOMEDS::Locker lock;
139 int mode = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreationMode();
140 if (mode == 1) aMode = "from scratch";
141 if (mode == 2) aMode = "copy from";
144 aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode();
148 void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
151 SALOMEDS::Locker lock;
152 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetModified(theModified);
155 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified);
158 bool SALOMEDS_AttributeStudyProperties::IsModified()
162 SALOMEDS::Locker lock;
163 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsModified();
166 ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified();
170 int SALOMEDS_AttributeStudyProperties::GetModified()
174 SALOMEDS::Locker lock;
175 isModified = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetModified();
178 isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified();
182 void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
185 SALOMEDS::Locker lock;
186 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetLocked(theLocked);
189 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked);
192 bool SALOMEDS_AttributeStudyProperties::IsLocked()
196 SALOMEDS::Locker lock;
197 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsLocked();
200 ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked();
204 void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theName,
213 SALOMEDS::Locker lock;
214 SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
215 anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear);
217 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(),
225 void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector<std::string>& theNames,
226 std::vector<int>& theMinutes,
227 std::vector<int>& theHours,
228 std::vector<int>& theDays,
229 std::vector<int>& theMonths,
230 std::vector<int>& theYears,
236 SALOMEDS::Locker lock;
237 std::vector<std::string> aNames;
238 std::vector<int> aMinutes, aHours, aDays, aMonths, aYears;
239 SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
240 anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
241 aLength = aNames.size();
242 i = ((theWithCreator) ? 1 : 2);
243 for (; i <= aLength; i++) {
244 theNames.push_back(aNames[i-1]);
245 theMinutes.push_back(aMinutes[i-1]);
246 theHours.push_back(aHours[i-1]);
247 theDays.push_back(aDays[i-1]);
248 theMonths.push_back(aMonths[i-1]);
249 theYears.push_back(aYears[i-1]);
252 SALOMEDS::StringSeq_var aNames;
253 SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
254 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(),
261 aLength = aNames->length();
262 for (i = 0; i<aLength; i++) {
263 theNames.push_back(aNames[i].in());
264 theMinutes.push_back(aMinutes[i]);
265 theHours.push_back(aHours[i]);
266 theDays.push_back(aDays[i]);
267 theMonths.push_back(aMonths[i]);
268 theYears.push_back(aYears[i]);
274 void SALOMEDS_AttributeStudyProperties::SetComment(const std::string& theComment)
278 SALOMEDS::Locker lock;
279 SALOMEDSImpl_AttributeStudyProperties* anImpl =
280 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
281 anImpl->SetComment(theComment);
283 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetComment(theComment.c_str());
286 std::string SALOMEDS_AttributeStudyProperties::GetComment()
288 std::string aComment;
290 SALOMEDS::Locker lock;
291 aComment = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetComment();
294 aComment = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetComment();
299 void SALOMEDS_AttributeStudyProperties::SetUnits(const std::string& theUnits)
303 SALOMEDS::Locker lock;
304 SALOMEDSImpl_AttributeStudyProperties* anImpl =
305 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
306 anImpl->SetUnits(theUnits);
308 ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUnits(theUnits.c_str());
311 std::string SALOMEDS_AttributeStudyProperties::GetUnits()
315 SALOMEDS::Locker lock;
316 anUnits = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetUnits();
319 anUnits = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUnits();