1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDS_AttributeStudyProperties.cxx
21 // Author : Sergey RUIN
24 #include "SALOMEDS_AttributeStudyProperties.hxx"
25 #include "SALOMEDS.hxx"
29 SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
30 (SALOMEDSImpl_AttributeStudyProperties* theAttr)
31 :SALOMEDS_GenericAttribute(theAttr)
34 SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
35 (SALOMEDS::AttributeStudyProperties_ptr theAttr)
36 :SALOMEDS_GenericAttribute(theAttr)
39 SALOMEDS_AttributeStudyProperties::~SALOMEDS_AttributeStudyProperties()
43 void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName)
47 SALOMEDS::Locker lock;
48 SALOMEDSImpl_AttributeStudyProperties* anImpl =
49 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
50 anImpl->ChangeCreatorName(theName);
52 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
55 std::string SALOMEDS_AttributeStudyProperties::GetUserName()
59 SALOMEDS::Locker lock;
60 aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
63 else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
65 else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
70 void SALOMEDS_AttributeStudyProperties::SetCreationDate
71 (int theMinute, int theHour, int theDay, int theMonth, int theYear)
75 SALOMEDS::Locker lock;
76 SALOMEDSImpl_AttributeStudyProperties* anImpl =
77 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
79 if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
81 anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
83 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
91 bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute,
99 SALOMEDS::Locker lock;
100 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>
101 (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
103 CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
104 ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute,
109 theMinute = (int)aMinute;
110 theHour = (int)anHour;
112 theMonth = (int)aMonth;
113 theYear = (int)anYear;
118 void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMode)
122 SALOMEDS::Locker lock;
123 if (theMode == "from scratch")
124 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(1);
125 else if (theMode == "copy from")
126 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(2);
128 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(0);
130 else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
133 std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
137 SALOMEDS::Locker lock;
138 int mode = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreationMode();
139 if (mode == 1) aMode = "from scratch";
140 if (mode == 2) aMode = "copy from";
143 aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode();
147 void SALOMEDS_AttributeStudyProperties::SetModified(int theModified)
150 SALOMEDS::Locker lock;
151 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetModified(theModified);
154 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
157 bool SALOMEDS_AttributeStudyProperties::IsModified()
161 SALOMEDS::Locker lock;
162 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsModified();
165 ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
169 int SALOMEDS_AttributeStudyProperties::GetModified()
173 SALOMEDS::Locker lock;
174 isModified = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetModified();
177 isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
181 void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked)
184 SALOMEDS::Locker lock;
185 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetLocked(theLocked);
188 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
191 bool SALOMEDS_AttributeStudyProperties::IsLocked()
195 SALOMEDS::Locker lock;
196 ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsLocked();
199 ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
203 void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theName,
212 SALOMEDS::Locker lock;
213 SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
214 anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear);
216 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
224 void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vector<std::string>& theNames,
225 std::vector<int>& theMinutes,
226 std::vector<int>& theHours,
227 std::vector<int>& theDays,
228 std::vector<int>& theMonths,
229 std::vector<int>& theYears,
235 SALOMEDS::Locker lock;
236 vector<string> aNames;
237 vector<int> aMinutes, aHours, aDays, aMonths, aYears;
238 SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
239 anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
240 aLength = aNames.size();
241 i = ((theWithCreator) ? 1 : 2);
242 for (; i <= aLength; i++) {
243 theNames.push_back(aNames[i-1]);
244 theMinutes.push_back(aMinutes[i-1]);
245 theHours.push_back(aHours[i-1]);
246 theDays.push_back(aDays[i-1]);
247 theMonths.push_back(aMonths[i-1]);
248 theYears.push_back(aYears[i-1]);
251 SALOMEDS::StringSeq_var aNames;
252 SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
253 SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(),
260 aLength = aNames->length();
261 for (i = 0; i<aLength; i++) {
262 theNames.push_back(aNames[i].in());
263 theMinutes.push_back(aMinutes[i]);
264 theHours.push_back(aHours[i]);
265 theDays.push_back(aDays[i]);
266 theMonths.push_back(aMonths[i]);
267 theYears.push_back(aYears[i]);