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)->SetFirstName((char*)theName);
25 char* SALOMEDS_AttributeStudyProperties_i::GetUserName()
27 SALOMEDS::Locker lock;
28 TCollection_ExtendedString S = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName();
29 CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString());
33 void SALOMEDS_AttributeStudyProperties_i::SetCreationDate(CORBA::Long theMinute,
39 SALOMEDS::Locker lock;
41 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
43 if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
44 aProp->SetModificationDate(theMinute, theHour, theDay, theMonth, theYear);
47 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::GetCreationDate(CORBA::Long& theMinute,
50 CORBA::Long& theMonth,
53 SALOMEDS::Locker lock;
54 Standard_Integer aMinute;
55 Standard_Integer aHour;
56 Standard_Integer aDay;
57 Standard_Integer aMonth;
58 Standard_Integer aYear;
59 if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationDate(aMinute, aHour, aDay,
69 return Standard_False;
72 void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode)
74 SALOMEDS::Locker lock;
76 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
77 if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH);
78 else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY);
79 else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED);
82 char* SALOMEDS_AttributeStudyProperties_i::GetCreationMode()
84 SALOMEDS::Locker lock;
85 CORBA::String_var c_s;
86 switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) {
87 case CREATION_MODE_SCRATCH: c_s = "from scratch"; break;
88 case CREATION_MODE_COPY: c_s = "copy from"; break;
94 void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified)
96 SALOMEDS::Locker lock;
97 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified);
100 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified()
102 SALOMEDS::Locker lock;
103 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified();
106 CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified()
108 SALOMEDS::Locker lock;
109 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified();
112 void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked)
114 SALOMEDS::Locker lock;
115 Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked);
118 CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked()
120 SALOMEDS::Locker lock;
121 return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked();
124 void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
125 CORBA::Long theMinute,
128 CORBA::Long theMonth,
131 SALOMEDS::Locker lock;
133 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
134 aProp->SetUserName((char*)theName);
135 aProp->SetModificationDate((int)theMinute, (int)theHour, (int)theDay, (int)theMonth, (int)theYear);
137 void SALOMEDS_AttributeStudyProperties_i::GetModificationsList(SALOMEDS::StringSeq_out theNames,
138 SALOMEDS::LongSeq_out theMinutes,
139 SALOMEDS::LongSeq_out theHours,
140 SALOMEDS::LongSeq_out theDays,
141 SALOMEDS::LongSeq_out theMonths,
142 SALOMEDS::LongSeq_out theYears,
143 CORBA::Boolean theWithCreator)
145 SALOMEDS::Locker lock;
146 Handle(TColStd_HSequenceOfExtendedString) aNames;
147 Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
148 Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
149 aNames = aProp->GetUserNames();
150 aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears);
151 int aLength = aNames->Length()-((theWithCreator)?0:1);
152 theNames = new SALOMEDS::StringSeq;
153 theMinutes = new SALOMEDS::LongSeq;
154 theHours = new SALOMEDS::LongSeq;
155 theDays = new SALOMEDS::LongSeq;
156 theMonths = new SALOMEDS::LongSeq;
157 theYears = new SALOMEDS::LongSeq;
158 theNames->length(aLength);
159 theMinutes->length(aLength);
160 theHours->length(aLength);
161 theDays->length(aLength);
162 theMonths->length(aLength);
163 theYears->length(aLength);
165 for(a = 0; a < aLength; a++)
167 (*theNames)[a]=CORBA::string_dup(TCollection_AsciiString(aNames->Value(a + 1 + ((theWithCreator)?0:1))).ToCString());
168 (*theMinutes)[a] = aMinutes->Value(a + 1 + ((theWithCreator)?0:1));
169 (*theHours)[a] = aHours->Value(a + 1 + ((theWithCreator)?0:1));
170 (*theDays)[a] = aDays->Value(a + 1 + ((theWithCreator)?0:1));
171 (*theMonths)[a] = aMonths->Value(a + 1 + ((theWithCreator)?0:1));
172 (*theYears)[a] = aYears->Value(a + 1 + ((theWithCreator)?0:1));