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_i.cxx
24 // Author : Sergey RUIN
27 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
28 #include "SALOMEDS.hxx"
30 #define CREATION_MODE_NOTDEFINED 0
31 #define CREATION_MODE_SCRATCH 1
32 #define CREATION_MODE_COPY 2
34 void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName)
36 SALOMEDS::Locker lock;
38 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->ChangeCreatorName((char*)theName);
41 char* SALOMEDS_AttributeStudyProperties_i::GetUserName()
43 SALOMEDS::Locker lock;
44 std::string S = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreatorName();
45 CORBA::String_var c_s = CORBA::string_dup(S.c_str());
49 void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute,
55 SALOMEDS::Locker lock;
57 SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
59 if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
61 aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
64 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& theMinute,
67 CORBA::Long& theMonth,
70 SALOMEDS::Locker lock;
76 if (dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) {
87 void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode)
89 SALOMEDS::Locker lock;
91 SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
92 if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH);
93 else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY);
94 else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED);
97 char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode()
99 SALOMEDS::Locker lock;
100 CORBA::String_var c_s;
101 switch (dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreationMode()) {
102 case CREATION_MODE_SCRATCH: c_s = "from scratch"; break;
103 case CREATION_MODE_COPY: c_s = "copy from"; break;
109 void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified)
111 SALOMEDS::Locker lock;
112 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetModified(theModified);
115 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified()
117 SALOMEDS::Locker lock;
118 return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->IsModified();
121 CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified()
123 SALOMEDS::Locker lock;
124 return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetModified();
127 void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked)
129 SALOMEDS::Locker lock;
130 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetLocked(theLocked);
133 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked()
135 SALOMEDS::Locker lock;
136 return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->IsLocked();
139 void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
140 CORBA::Long theMinute,
143 CORBA::Long theMonth,
146 SALOMEDS::Locker lock;
148 SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
149 aProp->SetModification((char*)theName, (int)theMinute, (int)theHour,
150 (int)theDay, (int)theMonth, (int)theYear);
153 void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
154 SALOMEDS::LongSeq_out theMinutes,
155 SALOMEDS::LongSeq_out theHours,
156 SALOMEDS::LongSeq_out theDays,
157 SALOMEDS::LongSeq_out theMonths,
158 SALOMEDS::LongSeq_out theYears,
159 CORBA::Boolean theWithCreator)
161 SALOMEDS::Locker lock;
162 std::vector<std::string> aNames;
163 std::vector<int> aMinutes, aHours, aDays, aMonths, aYears;
164 SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
165 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
166 int aLength = aNames.size();
167 int aRetLength = aLength - ((theWithCreator) ? 0 : 1);
168 theNames = new SALOMEDS::StringSeq;
169 theMinutes = new SALOMEDS::LongSeq;
170 theHours = new SALOMEDS::LongSeq;
171 theDays = new SALOMEDS::LongSeq;
172 theMonths = new SALOMEDS::LongSeq;
173 theYears = new SALOMEDS::LongSeq;
174 theNames->length(aRetLength);
175 theMinutes->length(aRetLength);
176 theHours->length(aRetLength);
177 theDays->length(aRetLength);
178 theMonths->length(aRetLength);
179 theYears->length(aRetLength);
180 int a = 0, ind = ((theWithCreator) ? 1 : 2);
181 for (; ind <= aLength; a++, ind++) {
182 (*theNames)[a] = CORBA::string_dup(aNames[ind-1].c_str());
183 (*theMinutes)[a] = aMinutes[ind-1];
184 (*theHours)[a] = aHours[ind-1];
185 (*theDays)[a] = aDays[ind-1];
186 (*theMonths)[a] = aMonths[ind-1];
187 (*theYears)[a] = aYears[ind-1];
191 void SALOMEDS_AttributeStudyProperties_i::SetComment(const char* theComment)
193 SALOMEDS::Locker lock;
195 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetComment(std::string(theComment));
198 char* SALOMEDS_AttributeStudyProperties_i::GetComment()
200 SALOMEDS::Locker lock;
201 std::string C = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetComment();
202 CORBA::String_var c_s = CORBA::string_dup(C.c_str());
206 void SALOMEDS_AttributeStudyProperties_i::SetUnits(const char* theUnits)
208 SALOMEDS::Locker lock;
210 dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetUnits(std::string(theUnits));
213 char* SALOMEDS_AttributeStudyProperties_i::GetUnits()
215 SALOMEDS::Locker lock;
216 std::string U = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetUnits();
217 CORBA::String_var c_s = CORBA::string_dup(U.c_str());