1 // File : SALOMEDS_AttributeStudyProperties_i.cxx
2 // Author : Sergey RUIN
6 #include "SALOMEDS_AttributeStudyProperties_i.hxx"
7 #include "SALOMEDS.hxx"
8 #include <TColStd_HSequenceOfExtendedString.hxx>
9 #include <TColStd_HSequenceOfInteger.hxx>
10 #include <TCollection_ExtendedString.hxx>
14 #define CREATION_MODE_NOTDEFINED 0
15 #define CREATION_MODE_SCRATCH 1
16 #define CREATION_MODE_COPY 2
18 void SALOMEDS_AttributeStudyProperties_i::SetUserName(const char* theName)
20 SALOMEDS::Locker lock;
22 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName);
25 char* SALOMEDS_AttributeStudyProperties_i::GetUserName()
27 SALOMEDS::Locker lock;
28 TCollection_ExtendedString S =
29 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName();
30 CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString());
34 void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute,
40 SALOMEDS::Locker lock;
42 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
43 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
45 if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
46 TCollection_ExtendedString S;
47 aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
50 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& theMinute,
53 CORBA::Long& theMonth,
56 SALOMEDS::Locker lock;
57 Standard_Integer aMinute;
58 Standard_Integer aHour;
59 Standard_Integer aDay;
60 Standard_Integer aMonth;
61 Standard_Integer aYear;
62 if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
63 (_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) {
71 return Standard_False;
74 void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode)
76 SALOMEDS::Locker lock;
78 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
79 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
80 if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH);
81 else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY);
82 else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED);
85 char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode()
87 SALOMEDS::Locker lock;
88 CORBA::String_var c_s;
89 switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) {
90 case CREATION_MODE_SCRATCH: c_s = "from scratch"; break;
91 case CREATION_MODE_COPY: c_s = "copy from"; break;
97 void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified)
99 SALOMEDS::Locker lock;
100 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified);
103 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified()
105 SALOMEDS::Locker lock;
106 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified();
109 CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified()
111 SALOMEDS::Locker lock;
112 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified();
115 void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked)
117 SALOMEDS::Locker lock;
118 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked);
121 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked()
123 SALOMEDS::Locker lock;
124 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked();
127 void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
128 CORBA::Long theMinute,
131 CORBA::Long theMonth,
134 SALOMEDS::Locker lock;
136 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
137 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
138 aProp->SetModification((char*)theName, (int)theMinute, (int)theHour,
139 (int)theDay, (int)theMonth, (int)theYear);
142 void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
143 SALOMEDS::LongSeq_out theMinutes,
144 SALOMEDS::LongSeq_out theHours,
145 SALOMEDS::LongSeq_out theDays,
146 SALOMEDS::LongSeq_out theMonths,
147 SALOMEDS::LongSeq_out theYears,
148 CORBA::Boolean theWithCreator)
150 SALOMEDS::Locker lock;
151 Handle(TColStd_HSequenceOfExtendedString) aNames;
152 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
153 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
154 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
155 aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
156 int aLength = aNames->Length();
157 int aRetLength = aLength - ((theWithCreator) ? 0 : 1);
158 theNames = new SALOMEDS::StringSeq;
159 theMinutes = new SALOMEDS::LongSeq;
160 theHours = new SALOMEDS::LongSeq;
161 theDays = new SALOMEDS::LongSeq;
162 theMonths = new SALOMEDS::LongSeq;
163 theYears = new SALOMEDS::LongSeq;
164 theNames->length(aRetLength);
165 theMinutes->length(aRetLength);
166 theHours->length(aRetLength);
167 theDays->length(aRetLength);
168 theMonths->length(aRetLength);
169 theYears->length(aRetLength);
170 int a = 0, ind = ((theWithCreator) ? 1 : 2);
171 for (; ind <= aLength; a++, ind++) {
172 (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(ind)).ToCString());
173 (*theMinutes)[a] = aMinutes->Value(ind);
174 (*theHours)[a] = aHours->Value(ind);
175 (*theDays)[a] = aDays->Value(ind);
176 (*theMonths)[a] = aMonths->Value(ind);
177 (*theYears)[a] = aYears->Value(ind);