1 // Created on: 1997-07-30
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <DDataStd.hxx>
19 #include <Standard_PCharacter.hxx>
22 #include <Draw_Interpretor.hxx>
23 #include <Draw_Appli.hxx>
24 #include <DrawTrSurf.hxx>
28 #include <TDF_Data.hxx>
29 #include <TDF_Label.hxx>
30 #include <TDF_Tool.hxx>
31 #include <TDF_AttributeSequence.hxx>
32 #include <TDF_AttributeList.hxx>
33 #include <TDF_ListIteratorOfAttributeList.hxx>
38 #include <TopoDS_Vertex.hxx>
39 #include <TopoDS_Edge.hxx>
40 #include <TopoDS_Wire.hxx>
41 #include <TopoDS_Face.hxx>
42 #include <TopoDS_Shell.hxx>
43 #include <TopoDS_Solid.hxx>
44 #include <TopoDS_Shape.hxx>
50 #include <TCollection_AsciiString.hxx>
51 #include <TColStd_HArray1OfReal.hxx>
54 #include <TDataStd.hxx>
55 #include <TDataStd_Comment.hxx>
56 #include <TDataStd_Name.hxx>
57 #include <TDataStd_Integer.hxx>
58 #include <TDataStd_Real.hxx>
59 #include <TDF_Reference.hxx>
60 #include <TDataStd_UAttribute.hxx>
61 #include <TDataStd_IntegerArray.hxx>
62 #include <TDataStd_BooleanArray.hxx>
63 #include <TDataStd_RealArray.hxx>
64 #include <TDataStd_BooleanList.hxx>
65 #include <TDataStd_IntegerList.hxx>
66 #include <TDataStd_RealList.hxx>
67 #include <TDataStd_Variable.hxx>
68 #include <TDataStd_ExtStringArray.hxx>
69 #include <TDF_ChildIterator.hxx>
70 #include <TDF_Tool.hxx>
72 #include <TDataStd_NamedData.hxx>
73 #include <TColStd_DataMapOfStringInteger.hxx>
74 #include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
75 #include <TDataStd_DataMapOfStringReal.hxx>
76 #include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
77 #include <TDataStd_DataMapOfStringByte.hxx>
78 #include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
79 #include <TDataStd_DataMapOfStringString.hxx>
80 #include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
81 #include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
82 #include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
83 #include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
84 #include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
85 #include <TColStd_HArray1OfInteger.hxx>
86 #include <TColStd_HArray1OfReal.hxx>
87 #include <TDataStd_AsciiString.hxx>
88 #include <TDataStd_IntPackedMap.hxx>
89 #include <TColStd_HPackedMapOfInteger.hxx>
90 #include <TColStd_PackedMapOfInteger.hxx>
91 #include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
92 #include <TDataStd_ByteArray.hxx>
93 #include <TDataStd_ListIteratorOfListOfByte.hxx>
94 #include <TColStd_ListIteratorOfListOfInteger.hxx>
95 #include <TColStd_ListIteratorOfListOfReal.hxx>
96 #include <TDataStd_ReferenceArray.hxx>
97 #include <TDataStd_ExtStringList.hxx>
98 #include <TDataStd_ReferenceList.hxx>
99 #include <TDF_ListIteratorOfLabelList.hxx>
100 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
102 //=======================================================================
103 //function : DDataStd_SetInteger
104 //purpose : SetInteger (DF, entry, value)
105 //=======================================================================
107 static Standard_Integer DDataStd_SetInteger (Draw_Interpretor& di,
113 if (!DDF::GetDF(arg[1],DF)) return 1;
115 DDF::AddLabel(DF, arg[2], L);
116 TDataStd_Integer::Set(L,Draw::Atoi(arg[3]));
119 di << "DDataStd_SetInteger : Error\n";
123 //=======================================================================
124 //function : DDataStd_SetReal
125 //purpose : SetReal (DF, entry, value)
126 //=======================================================================
128 static Standard_Integer DDataStd_SetReal (Draw_Interpretor& di,
134 if (!DDF::GetDF(arg[1],DF)) return 1;
136 DDF::AddLabel(DF, arg[2], L);
137 TDataStd_Real::Set(L,Draw::Atof(arg[3]));
140 di << "DDataStd_SetReal : Error\n";
146 //=======================================================================
147 //function : DDataStd_SetReference
148 //purpose : SetReference (DF, entry, reference)
149 //=======================================================================
151 static Standard_Integer DDataStd_SetReference (Draw_Interpretor& di,
157 if (!DDF::GetDF(arg[1],DF)) return 1;
159 DDF::AddLabel(DF, arg[2], L);
161 if (!DDF::FindLabel(DF,arg[3],LREF)) return 1;
162 TDF_Reference::Set(L,LREF);
165 di << "DDataStd_SetReference : Error\n";
170 //=======================================================================
171 //function : DDataStd_SetComment
172 //purpose : SetComment (DF, entry, Comment)
173 //=======================================================================
175 static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
181 if (!DDF::GetDF(arg[1],DF)) return 1;
183 DDF::AddLabel(DF, arg[2], L);
184 TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));
187 di << "DDataStd_SetComment : Error\n";
193 //=======================================================================
194 //function : DDataStd_GetInteger
195 //purpose : GetReal (DF, entry, [drawname])
196 //=======================================================================
198 static Standard_Integer DDataStd_GetInteger (Draw_Interpretor& di,
202 if (nb == 3 || nb == 4) {
204 if (!DDF::GetDF(arg[1],DF)) return 1;
205 Handle(TDataStd_Integer) A;
206 if (!DDF::Find(DF,arg[2],TDataStd_Integer::GetID(),A)) return 1;
207 if (nb == 4) Draw::Set(arg[3],A->Get());
208 else Draw::Set(arg[2],A->Get());
212 di << "DDataStd_GetInteger : Error\n";
216 //=======================================================================
217 //function : DDataStd_GetReal
218 //purpose : GetReal (DF, entry, [drawname])
219 //=======================================================================
221 static Standard_Integer DDataStd_GetReal (Draw_Interpretor& di,
225 if (nb == 3 || nb == 4) {
227 if (!DDF::GetDF(arg[1],DF)) return 1;
228 Handle(TDataStd_Real) A;
229 if (!DDF::Find(DF,arg[2],TDataStd_Real::GetID(),A)) return 1;
230 if (nb == 4) Draw::Set(arg[3],A->Get());
231 else Draw::Set(arg[2],A->Get());
235 di << "DDataStd_GetReal : Error\n";
240 //=======================================================================
241 //function : DDataStd_GetReference
242 //purpose : GetShape (DF, entry)
243 //=======================================================================
245 static Standard_Integer DDataStd_GetReference (Draw_Interpretor& di,
251 if (!DDF::GetDF(arg[1],DF)) return 1;
252 Handle(TDF_Reference) REF;
253 if (!DDF::Find(DF,arg[2],TDF_Reference::GetID(),REF)) return 1;
254 TCollection_AsciiString entry; TDF_Tool::Entry(REF->Get(),entry);
255 di << entry.ToCString();
258 di << "DDataStd_GetReference : Error\n";
262 //=======================================================================
263 //function : DDataStd_GetComment
264 //purpose : GetShape (DF, entry)
265 //=======================================================================
267 static Standard_Integer DDataStd_GetComment (Draw_Interpretor& di,
273 if (!DDF::GetDF(arg[1],DF)) return 1;
274 Handle(TDataStd_Comment) A;
275 if (!DDF::Find(DF,arg[2],TDataStd_Comment::GetID(),A)) return 1;
276 TCollection_AsciiString s(A->Get(),'?');
277 di << A->Get().ToExtString();
280 di << "DDataStd_GetComment : Error\n";
286 //=======================================================================
288 //purpose : Self (document,label)
289 //=======================================================================
291 static Standard_Integer DDataStd_Self (Draw_Interpretor& di,
295 TCollection_AsciiString s;
298 if (!DDF::GetDF(arg[1],DF)) return 1;
300 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
301 // TDataStd::MakeSelfContained(L,removed);
302 // if (removed.IsEmpty()) cout << "noone attriburte removed" << endl;
303 // for (TDF_ListIteratorOfAttributeList it(removed);it.More();it.Next()) {
304 // TDF_Tool::Entry(it.Value()->Label(),s); cout << s << " ";
309 di << "Self : Error\n";
315 //=======================================================================
316 //function : SetUObject (DF, entry, ObjectID)
317 //=======================================================================
318 // static Standard_Integer DDataStd_SetUObject (Draw_Interpretor&,
319 // Standard_Integer nb,
323 // Handle(TDF_Data) DF;
324 // if (!DDF::GetDF(arg[1],DF)) return 1;
326 // DDF::AddLabel(DF, arg[2], label);
328 // Standard_GUID guid(arg[3]); //"00000000-0000-0000-1111-000000000000");
329 // TDataStd_UObject::Set(label, guid);
333 // cout << "Wrong arguments" << endl;
337 //=======================================================================
338 //function : SetUAttribute (DF, entry, LocalID)
339 //=======================================================================
340 static Standard_Integer DDataStd_SetUAttribute (Draw_Interpretor& di,
346 if (!DDF::GetDF(arg[1],DF)) return 1;
348 DDF::AddLabel(DF, arg[2], label);
350 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
351 TDataStd_UAttribute::Set(label, guid);
355 di << "Wrong arguments" << "\n";
359 //=======================================================================
360 //function : GetUAttribute (DF, entry, LoaclID)
361 //=======================================================================
362 static Standard_Integer DDataStd_GetUAttribute (Draw_Interpretor& di,
368 if (!DDF::GetDF(arg[1],DF)) return 1;
370 if( !DDF::FindLabel(DF, arg[2], label) ) {
371 di << "No label for entry" << "\n";
374 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
376 Handle(TDataStd_UAttribute) UA;
377 if( !label.FindAttribute(guid, UA) ) {
378 di << "No UAttribute Attribute on label" << "\n";
381 char *aStrGUID = new char[37];
382 UA->ID().ToCString(aStrGUID);
388 di << "Wrong arguments" << "\n";
393 //=======================================================================
394 //function : CheckUObject (DF, entry, ObjectID)
395 //=======================================================================
396 // static Standard_Integer DDataStd_CheckUObject (Draw_Interpretor&,
397 // Standard_Integer nb,
401 // Handle(TDF_Data) DF;
402 // if (!DDF::GetDF(arg[1],DF)) return 1;
404 // if( !DDF::FindLabel(DF, arg[2], label) ) {
405 // cout << "No label for entry" << endl;
408 // Handle(TDataStd_Object) O;
409 // Handle(TDataStd_UObject) UO;
410 // Standard_GUID guidUO(arg[3]);
412 // if( !label.FindAttribute( TDataStd_Object::GetID(), O) ) {
413 // cout << "No Object Attribute on label" << endl;
416 // cout << "UObject is found with ObjectID = ";
417 // O->Find(label, guidUO, UO);
418 // UO->ObjectID().ShallowDump(cout);
424 // cout << "Wrong arguments" << endl;
429 //=======================================================================
430 //function : SetIntArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
431 //=======================================================================
432 static Standard_Integer DDataStd_SetIntArray (Draw_Interpretor& di,
437 if (!DDF::GetDF(arg[1],DF)) return 1;
439 DDF::AddLabel(DF, arg[2], label);
440 Standard_Integer isDelta = Draw::Atoi(arg[3]);
441 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
442 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
443 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
447 for(Standard_Integer i = From; i<=To; i++) {
448 A->SetValue(i, Draw::Atoi(arg[j]) );
456 //=======================================================================
457 //function : SetIntArrayValue (DF, entry, index, value)
458 //=======================================================================
459 static Standard_Integer DDataStd_SetIntArrayValue (Draw_Interpretor&,
465 if (!DDF::GetDF(arg[1], DF))
470 if (!DDF::AddLabel(DF, arg[2], label))
473 // Get index and value.
474 Standard_Integer index = Draw::Atoi(arg[3]);
475 Standard_Integer value = Draw::Atoi(arg[4]);
478 Handle(TDataStd_IntegerArray) arr;
479 if (label.FindAttribute(TDataStd_IntegerArray::GetID(), arr))
481 arr->SetValue(index, value);
488 //=======================================================================
489 //function : GetIntArray (DF, entry )
490 //=======================================================================
491 static Standard_Integer DDataStd_GetIntArray (Draw_Interpretor& di,
498 if (!DDF::GetDF(arg[1],DF)) return 1;
500 if( !DDF::FindLabel(DF, arg[2], label) ) {
501 di << "No label for entry" << "\n";
505 Handle(TDataStd_IntegerArray) A;
506 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
507 di << "There is no TDataStd_IntegerArray under label" << "\n";
511 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
512 //cout << A->Value(i) << endl;
521 //=======================================================================
522 //function : GetIntArrayValue (DF, entry, index)
523 //=======================================================================
524 static Standard_Integer DDataStd_GetIntArrayValue (Draw_Interpretor& di,
529 if (!DDF::GetDF(arg[1],DF))
533 if (!DDF::FindLabel(DF, arg[2], label)) {
534 di << "No label for entry" << "\n";
538 Handle(TDataStd_IntegerArray) A;
539 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
540 di << "There is no TDataStd_IntegerArray under label" << "\n";
544 Standard_Integer index = Draw::Atoi(arg[3]);
545 if (index < A->Lower() || index > A->Upper()) {
546 di << "Index is out of range\n";
549 di << A->Value(index) << "\n";
555 //=======================================================================
556 //function : ChangeIntArray (DF, entry, indx, val )
557 //=======================================================================
558 static Standard_Integer DDataStd_ChangeIntArray (Draw_Interpretor& di,
565 if (!DDF::GetDF(arg[1],DF)) return 1;
567 if( !DDF::FindLabel(DF, arg[2], label) ) {
568 di << "No label for entry" << "\n";
572 Handle(TDataStd_IntegerArray) A;
573 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
574 di << "There is no TDataStd_IntegerArray at label" << "\n";
577 Standard_Integer indx = Draw::Atoi(arg[3]);
578 Standard_Integer val = Draw::Atoi(arg[4]);
579 Standard_Integer low = A->Lower(), up = A->Upper();
580 if(low <= indx && indx <= up)
581 A->SetValue(indx, val);
583 Handle(TColStd_HArray1OfInteger) Arr = A->Array();
584 Handle(TColStd_HArray1OfInteger) arr;
588 arr = new TColStd_HArray1OfInteger(low, up);
589 for(i=low; i<= Arr->Upper(); i++)
590 arr->SetValue(i, Arr->Value(i));
591 for(i=Arr->Upper()+1; i<= up; i++) {
593 arr->SetValue(i, val);
597 } else if(indx < up) {//clip array : indx to be negative
599 arr = new TColStd_HArray1OfInteger(low, up);
600 for(i=low; i< up; i++)
601 arr->SetValue(i, Arr->Value(i));
602 arr->SetValue(up, val);
608 di << "DDataStd_ChangeIntArray: Error\n";
612 //=======================================================================
613 //function : SetIntArrayT (DF, entry , isDelta, From, To) - for testing
615 //=======================================================================
616 static Standard_Integer DDataStd_SetIntArrayTest (Draw_Interpretor& di,
623 if (!DDF::GetDF(arg[1],DF)) return 1;
625 DDF::AddLabel(DF, arg[2], label);
626 Standard_Integer isDelta = Draw::Atoi(arg[3]);
627 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
628 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
629 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
632 Standard_Integer k = 100;
633 for(Standard_Integer i = From; i<=To; i++) {
641 //=======================================================================
642 //function : SetRealArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
643 //=======================================================================
644 static Standard_Integer DDataStd_SetRealArray (Draw_Interpretor& di,
651 if (!DDF::GetDF(arg[1],DF)) return 1;
653 DDF::AddLabel(DF, arg[2], label);
654 Standard_Integer isDelta = Draw::Atoi(arg[3]);
656 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
657 di << " Array of Standard_Real with bounds from = " << From << " to = " << To << "\n";
658 Handle(TDataStd_RealArray) A = TDataStd_RealArray::Set(label, From, To, isDelta);
662 for(Standard_Integer i = From; i<=To; i++) {
663 A->SetValue(i, Draw::Atof(arg[j]) );
671 //=======================================================================
672 //function : SetRealArrayValue (DF, entry, index value)
673 //=======================================================================
674 static Standard_Integer DDataStd_SetRealArrayValue (Draw_Interpretor&,
680 if (!DDF::GetDF(arg[1], DF))
685 if (!DDF::AddLabel(DF, arg[2], label))
688 // Get index and value.
689 Standard_Integer index = Draw::Atoi(arg[3]);
690 Standard_Real value = Draw::Atof(arg[4]);
693 Handle(TDataStd_RealArray) realArray;
694 if (label.FindAttribute(TDataStd_RealArray::GetID(), realArray))
696 realArray->SetValue(index, value);
703 //=======================================================================
704 //function : GetRealArray (DF, entry )
705 //=======================================================================
706 static Standard_Integer DDataStd_GetRealArray (Draw_Interpretor& di,
712 if (!DDF::GetDF(arg[1],DF)) return 1;
714 if( !DDF::FindLabel(DF, arg[2], label) ) {
715 di << "No label for entry" << "\n";
719 Handle(TDataStd_RealArray) A;
720 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
721 di << "There is no TDataStd_RealArray under label" << "\n";
725 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
726 //cout << A->Value(i) << endl;
736 //=======================================================================
737 //function : GetRealArrayValue (DF, entry, index)
738 //=======================================================================
739 static Standard_Integer DDataStd_GetRealArrayValue (Draw_Interpretor& di,
744 if (!DDF::GetDF(arg[1],DF))
748 if (!DDF::FindLabel(DF, arg[2], label)) {
749 di << "No label for entry" << "\n";
753 Handle(TDataStd_RealArray) A;
754 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
755 di << "There is no TDataStd_RealArray under label" << "\n";
759 Standard_Integer index = Draw::Atoi(arg[3]);
760 if (index < A->Lower() || index > A->Upper()) {
761 di << "Index is out of range\n";
764 di << A->Value(index) << "\n";
770 //=======================================================================
771 //function : ChangeRealArray (DF, entry, indx, val )
772 //=======================================================================
773 static Standard_Integer DDataStd_ChangeRealArray (Draw_Interpretor& di,
780 if (!DDF::GetDF(arg[1],DF)) return 1;
782 if( !DDF::FindLabel(DF, arg[2], label) ) {
783 di << "No label for entry" << "\n";
787 Handle(TDataStd_RealArray) A;
788 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
789 di << "There is no TDataStd_RealArray at label" << "\n";
792 Standard_Integer indx = Draw::Atoi(arg[3]);
793 Standard_Real val = Draw::Atof(arg[4]);
794 Standard_Integer low = A->Lower(), up = A->Upper();
795 if(low <= indx && indx <= up)
796 A->SetValue(indx, val);
798 Handle(TColStd_HArray1OfReal) Arr = A->Array();
799 Handle(TColStd_HArray1OfReal) arr;
803 arr = new TColStd_HArray1OfReal(low, up);
804 for(i=low; i<= Arr->Upper(); i++)
805 arr->SetValue(i, Arr->Value(i));
806 for(i=Arr->Upper()+1; i<= up; i++) {
808 arr->SetValue(i, val);
812 } else if(indx < up) {//clip array : indx to be negative
814 arr = new TColStd_HArray1OfReal(low, up);
815 for(i=low; i< up; i++)
816 arr->SetValue(i, Arr->Value(i));
817 arr->SetValue(up, val);
823 di << "DDataStd_ChangeRealArray: Error\n";
827 //=======================================================================
828 //function : SetVariable (DF, entry, isConstant[0/1], units)
829 //=======================================================================
830 static Standard_Integer DDataStd_SetVariable (Draw_Interpretor& di,
837 if (!DDF::GetDF(arg[1],DF)) return 1;
839 DDF::AddLabel(DF, arg[2], label);
841 Handle(TDataStd_Variable) aV = TDataStd_Variable::Set(label);
843 const char* aUnits = arg[4];
844 aV->Unit(Standard_CString(aUnits));
846 aV->Constant(Standard_Boolean(Draw::Atoi(arg[3])));
850 di << "Wrong arguments\n";
854 //=======================================================================
855 //function : GetVariable (DF, entry, [isConstant], [units])
856 //=======================================================================
857 static Standard_Integer DDataStd_GetVariable (Draw_Interpretor& di,
864 if (!DDF::GetDF(arg[1],DF)) return 1;
866 DDF::AddLabel(DF, arg[2], label);
868 Handle(TDataStd_Variable) aV;
869 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
871 di << "TDataStd_Variable: no such attribute\n";
874 Draw::Set(arg[3],TCollection_AsciiString(Standard_Integer(aV->IsConstant())).ToCString());
875 Draw::Set(arg[4],aV->Unit().ToCString());
879 di << "Wrong arguments\n";
883 #include <TDataStd_Relation.hxx>
884 #include <TDataStd_Variable.hxx>
885 //=======================================================================
886 //function : SetRelation (DF, entry, expression, var1[, var2, ...])
887 //=======================================================================
888 static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
889 Standard_Integer nb, const char** arg)
894 if (!DDF::GetDF(arg[1],DF)) return 1;
896 DDF::AddLabel(DF, arg[2], label);
898 Standard_CString expr (arg[3]);
899 Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
900 aR->SetRelation(expr);
901 Handle(TDataStd_Variable) aV;
903 for (Standard_Integer i = 4; i < nb; i++)
905 if (!DDF::FindLabel(DF, arg[i], label))
907 di << "No label for entry" << arg[i] << "\n";
910 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
912 di << "No TDataStd_Variable Attribute on label\n";
915 aR->GetVariables().Append(aV);
919 di << "Usage: SetRelation (DF, entry, expression, var1[, var2, ...])\n";
923 //=======================================================================
924 //function : DumpRelation (DF, entry)
925 //=======================================================================
926 static Standard_Integer DDataStd_DumpRelation (Draw_Interpretor& di,
927 Standard_Integer nb, const char** arg)
932 if (!DDF::GetDF(arg[1],DF)) return 1;
935 if (!DDF::FindLabel(DF, arg[2], label))
937 di << "No label for entry " << arg[2] << "\n";
940 Handle(TDataStd_Relation) aR;
941 if (!label.FindAttribute(TDataStd_Relation::GetID(), aR))
943 di << "No TDataStd_Relation Attribute on label " << arg[2] << "\n";
947 di << "Relation: expression = \"" << aR->GetRelation()
948 << "\" variables list = (";
950 Handle(TDF_Attribute) aV;
951 TCollection_AsciiString anEntry;
953 TDF_ListIteratorOfAttributeList it;
954 for (it.Initialize(aR->GetVariables()); it.More(); it.Next())
960 TDF_Tool::Entry(label, anEntry);
961 di << anEntry.ToCString() << " ";
967 di << "Usage: DumpRelation (DF, entry)\n";
971 #include <TFunction_Function.hxx>
972 //=======================================================================
973 //function : SetFunction (DF, entry, guid, failure)
974 //=======================================================================
975 static Standard_Integer DDataStd_SetFunction (Draw_Interpretor& di,
976 Standard_Integer nb, const char** arg)
981 if (!DDF::GetDF(arg[1],DF)) return 1;
983 DDF::AddLabel(DF, arg[2], label);
985 Standard_GUID guid (arg[3]);
986 Handle(TFunction_Function) aF = TFunction_Function::Set(label, guid);
988 int fail = Draw::Atoi(arg[4]);
989 aF->SetFailure(fail);
994 di << "Wrong arguments" << "\n";
998 //=======================================================================
999 //function : GetFunction (DF, entry, guid(out), failure(out))
1000 //=======================================================================
1001 static Standard_Integer DDataStd_GetFunction (Draw_Interpretor& di,
1002 Standard_Integer nb, const char** arg)
1006 Handle(TDF_Data) DF;
1007 if (!DDF::GetDF(arg[1],DF)) return 1;
1009 if (!DDF::FindLabel(DF, arg[2], label))
1011 di << "No label for entry" << "\n";
1015 Handle(TFunction_Function) aF;
1016 if (!label.FindAttribute(TFunction_Function::GetID(), aF))
1018 di << "No TFunction_Function Attribute on label\n";
1022 char *aStrGUID = new char[37];
1023 aF->GetDriverGUID().ToCString(aStrGUID);
1024 Draw::Set(arg[3],aStrGUID);
1026 Draw::Set(arg[4],TCollection_AsciiString(aF->GetFailure()).ToCString());
1031 di << "Wrong arguments" << "\n";
1035 //=======================================================================
1036 //function : SetExtStringArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
1037 //=======================================================================
1038 static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
1039 Standard_Integer nb,
1042 Handle(TDF_Data) DF;
1043 if (!DDF::GetDF(arg[1],DF)) return 1;
1045 DDF::AddLabel(DF, arg[2], label);
1046 Standard_Integer isDelta = Draw::Atoi(arg[3]);
1048 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1049 di << "Array of ExtString with bounds from = " << From << " to = " << To << "\n";
1050 Handle(TDataStd_ExtStringArray) A = TDataStd_ExtStringArray::Set(label, From, To, isDelta);
1054 for(Standard_Integer i = From; i<=To; i++) {
1055 A->SetValue(i, arg[j] );
1063 //=======================================================================
1064 //function : SetExtStringArrayValue (DF, entry, index, value)
1065 //=======================================================================
1066 static Standard_Integer DDataStd_SetExtStringArrayValue (Draw_Interpretor&,
1071 Handle(TDF_Data) DF;
1072 if (!DDF::GetDF(arg[1], DF))
1077 if (!DDF::AddLabel(DF, arg[2], label))
1080 // Get index and value.
1081 Standard_Integer index = Draw::Atoi(arg[3]);
1084 Handle(TDataStd_ExtStringArray) arr;
1085 if (label.FindAttribute(TDataStd_ExtStringArray::GetID(), arr))
1087 arr->SetValue(index, arg[4]);
1094 //=======================================================================
1095 //function : GetExtStringArray (DF, entry )
1096 //=======================================================================
1097 static Standard_Integer DDataStd_GetExtStringArray (Draw_Interpretor& di,
1103 Handle(TDF_Data) DF;
1104 if (!DDF::GetDF(arg[1],DF)) return 1;
1106 if( !DDF::FindLabel(DF, arg[2], label) ) {
1107 di << "No label for entry" << "\n";
1111 Handle(TDataStd_ExtStringArray) A;
1112 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1113 di << "There is no TDataStd_ExtStringArray under label" << "\n";
1117 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
1118 TCollection_AsciiString anAsciiString(A->Value(i),'?');
1119 di << anAsciiString.ToCString();
1127 //=======================================================================
1128 //function : GetExtStringArrayValue (DF, entry, index)
1129 //=======================================================================
1130 static Standard_Integer DDataStd_GetExtStringArrayValue (Draw_Interpretor& di,
1134 Handle(TDF_Data) DF;
1135 if (!DDF::GetDF(arg[1],DF))
1139 if (!DDF::FindLabel(DF, arg[2], label)) {
1140 di << "No label for entry" << "\n";
1144 Handle(TDataStd_ExtStringArray) A;
1145 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1146 di << "There is no TDataStd_ExtStringArray under label" << "\n";
1150 Standard_Integer index = Draw::Atoi(arg[3]);
1151 if (index < A->Lower() || index > A->Upper()) {
1152 di << "Index is out of range\n";
1155 const TCollection_ExtendedString& value = A->Value(index);
1156 di << value << "\n";
1162 //=======================================================================
1163 //function : ChangeExtStrArray (DF, entry, indx, val )
1164 //=======================================================================
1165 static Standard_Integer DDataStd_ChangeExtStrArray (Draw_Interpretor& di,
1166 Standard_Integer nb,
1171 Handle(TDF_Data) DF;
1172 if (!DDF::GetDF(arg[1],DF)) return 1;
1174 if( !DDF::FindLabel(DF, arg[2], label) ) {
1175 di << "No label for entry" << "\n";
1179 Handle(TDataStd_ExtStringArray) A;
1180 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1181 di << "There is no TDataStd_ExtStringArray at label" << "\n";
1184 Standard_Integer indx = Draw::Atoi(arg[3]);
1185 TCollection_ExtendedString val(arg[4]);
1186 Standard_Integer low = A->Lower(), up = A->Upper();
1187 if(low <= indx && indx <= up)
1188 A->SetValue(indx, val);//TColStd_HArray1OfExtendedString
1190 Handle(TColStd_HArray1OfExtendedString) Arr = A->Array();
1191 Handle(TColStd_HArray1OfExtendedString) arr;
1195 arr = new TColStd_HArray1OfExtendedString(low, up);
1196 for(i=low; i<= Arr->Upper(); i++)
1197 arr->SetValue(i, Arr->Value(i));
1198 for(i=Arr->Upper()+1; i<= up; i++) {
1200 arr->SetValue(i, val);
1202 arr->SetValue(i, 0);
1204 } else if(indx < up) {//clip array : indx to be negative
1206 arr = new TColStd_HArray1OfExtendedString(low, up);
1207 for(i=low; i< up; i++)
1208 arr->SetValue(i, Arr->Value(i));
1209 arr->SetValue(up, val);
1211 A->ChangeArray(arr);
1215 di << "DDataStd_ChangeExtStringArray: Error\n";
1220 //=======================================================================
1221 //function : DDataStd_KeepUTF
1222 //purpose : SetUTFName (DF, fatherEntry, fileName)
1223 //=======================================================================
1224 static Standard_Integer DDataStd_KeepUTF (Draw_Interpretor& di,
1225 Standard_Integer nb,
1229 Handle(TDF_Data) DF;
1230 if (!DDF::GetDF(arg[1],DF)) return 1;
1232 DDF::AddLabel(DF, arg[2], L);
1233 Standard_CString aFileName(arg[3]);
1236 ifstream anIS (aFileName, ios::in | ios::binary);
1238 ifstream anIS (aFileName);
1241 // Can not open file
1242 cout << "Error: can't open file " << aFileName <<endl;;
1247 anIS.getline(buf, 1023,'\n');
1248 // 0xEFBBBF - prefix of UTF8
1249 p = &buf[3]; //skip prefix
1250 TCollection_ExtendedString aES1(p, Standard_True);
1251 TDataStd_Name::Set(L.NewChild(), aES1);
1254 while (anIS.good() && !anIS.eof()) {
1255 anIS.getline(buf, 1023,'\n');
1256 TCollection_ExtendedString aES2(buf, Standard_True);
1257 const TDF_Label& aLab = L.NewChild();
1258 TDataStd_Name::Set(aLab, aES2);
1262 di << "SetUTFName : String is not kept in DF\n";
1266 //=======================================================================
1267 //function : DDataStd_GetUTFtoFile
1268 //purpose : GetUTF (DF, fatherEntry, fileName)
1269 // : all strings from sub-labels of the <fatherEntry> concatenated
1270 // : in one, converted to UTF8 and kept in the file
1271 //=======================================================================
1272 static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di,
1273 Standard_Integer nb,
1277 Handle(TDF_Data) DF;
1278 if (!DDF::GetDF(arg[1],DF)) return 1;
1280 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
1282 TCollection_ExtendedString aES;
1283 Standard_Boolean aF = Standard_False;
1284 TDF_ChildIterator anIt(L);
1285 for(;anIt.More();anIt.Next()) {
1286 const TDF_Label& aLab = anIt.Value();
1287 if(!aLab.IsNull()) {
1288 Handle(TDataStd_Name) anAtt;
1289 if(aLab.FindAttribute(TDataStd_Name::GetID(), anAtt)) {
1290 if(anAtt->Get().Length()) {
1301 cout << "Data is not found in the Document" <<endl;
1305 Standard_CString aFileName(arg[3]);
1308 ofstream anOS (aFileName, ios::in | ios::binary | ios::ate);
1310 ofstream anOS (aFileName, ios::ate);
1313 // A problem with the stream
1315 cout << "Error: problem with the file stream, rdstate = " <<anOS.rdstate() <<endl;
1318 unsigned char prefix[4] = {0xEF,0xBB,0xBF, 0x00};
1319 anOS.write( (char*)&prefix[0], 3);
1320 Standard_Integer n = aES.LengthOfCString();
1321 Standard_PCharacter aCstr = (Standard_PCharacter) Standard::Allocate(n+1);
1322 n = aES.ToUTF8CString(aCstr);
1323 anOS.write( (char*)&aCstr[0], n);
1327 di << "GetUTF : Data is not extracted to the specified file \n";
1331 //=======================================================================
1332 //function : SetByteArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )
1333 //=======================================================================
1334 static Standard_Integer DDataStd_SetByteArray (Draw_Interpretor& di,
1335 Standard_Integer nb,
1339 Handle(TDF_Data) DF;
1340 if (!DDF::GetDF(arg[1],DF)) return 1;
1342 DDF::AddLabel(DF, arg[2], label);
1343 Standard_Integer isDelta = Draw::Atoi(arg[3]);
1344 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1345 di << "Array of Standard_Byte with bounds from = " << From << " to = " << To << "\n";
1346 Handle(TDataStd_ByteArray) A = TDataStd_ByteArray::Set(label, From, To, isDelta);
1350 for(Standard_Integer i = From; i<=To; ++i) {
1351 Standard_Integer ival = Draw::Atoi(arg[j]);
1352 if(ival < 0 || 255 < ival) {
1353 cout << "Bad value = " << ival<< endl;
1356 A->SetValue(i, (Standard_Byte)ival);
1362 di << "DDataStd_SetByteArray: Error\n";
1366 //=======================================================================
1367 //function : SetByteArrayValue (DF, entry, index, value)
1368 //=======================================================================
1369 static Standard_Integer DDataStd_SetByteArrayValue (Draw_Interpretor&,
1374 Handle(TDF_Data) DF;
1375 if (!DDF::GetDF(arg[1], DF))
1380 if (!DDF::AddLabel(DF, arg[2], label))
1383 // Get index and value.
1384 Standard_Integer index = Draw::Atoi(arg[3]);
1385 Standard_Integer value = Draw::Atoi(arg[4]);
1388 if(value < 0 || 255 < value) {
1389 cout << "Bad value = " << value << endl;
1394 Handle(TDataStd_ByteArray) arr;
1395 if (label.FindAttribute(TDataStd_ByteArray::GetID(), arr))
1397 arr->SetValue(index, (Standard_Byte) value);
1404 //=======================================================================
1405 //function : SetBooleanArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )
1406 //=======================================================================
1407 static Standard_Integer DDataStd_SetBooleanArray (Draw_Interpretor& di,
1408 Standard_Integer nb,
1413 Handle(TDF_Data) DF;
1414 if (!DDF::GetDF(arg[1],DF))
1418 DDF::AddLabel(DF, arg[2], label);
1419 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1420 di << "Array of Standard_Boolean with bounds from = " << From << " to = " << To << "\n";
1421 Handle(TDataStd_BooleanArray) A = TDataStd_BooleanArray::Set(label, From, To);
1425 for(Standard_Integer i = From; i<=To; i++)
1427 Standard_Integer ival = Draw::Atoi(arg[j]);
1430 cout << "Bad value = " << ival<< ". 0 or 1 is expected." << endl;
1433 A->SetValue(i, (Standard_Boolean)ival);
1439 di << "DDataStd_SetBooleanArray: Error\n";
1443 //=======================================================================
1444 //function : SetBooleanArrayValue (DF, entry, index, value)
1445 //=======================================================================
1446 static Standard_Integer DDataStd_SetBooleanArrayValue (Draw_Interpretor& di,
1451 Handle(TDF_Data) DF;
1452 if (!DDF::GetDF(arg[1], DF))
1457 if (!DDF::AddLabel(DF, arg[2], label))
1460 // Get index and value.
1461 Standard_Integer index = Draw::Atoi(arg[3]);
1462 Standard_Integer value = Draw::Atoi(arg[4]);
1465 if (value != 0 && value != 1) {
1466 di << "DDataStd_SetBooleanArrayValue: Error! The value should be either 0 or 1.\n";
1471 Handle(TDataStd_BooleanArray) arr;
1472 if (label.FindAttribute(TDataStd_BooleanArray::GetID(), arr))
1474 arr->SetValue(index, (Standard_Boolean) value);
1481 //=======================================================================
1482 //function : DDataStd_SetExtStringList (DF, entry, elmt1, elmt2, ... )
1483 //=======================================================================
1484 static Standard_Integer DDataStd_SetExtStringList (Draw_Interpretor& di,
1485 Standard_Integer nb,
1490 Handle(TDF_Data) DF;
1491 if (!DDF::GetDF(arg[1],DF))
1495 DDF::AddLabel(DF, arg[2], label);
1496 Handle(TDataStd_ExtStringList) A = TDataStd_ExtStringList::Set(label);
1497 for(Standard_Integer i = 3; i <= nb - 1; i++)
1499 TCollection_ExtendedString aValue(arg[i]);
1504 di << "DDataStd_SetExtStringList: Error\n";
1508 //=======================================================================
1509 //function : DDataStd_SetReferenceList (DF, entry, elmt1, elmt2, ... )
1510 //=======================================================================
1511 static Standard_Integer DDataStd_SetReferenceList (Draw_Interpretor& di,
1512 Standard_Integer nb,
1517 Handle(TDF_Data) DF;
1518 if (!DDF::GetDF(arg[1],DF))
1522 DDF::AddLabel(DF, arg[2], label);
1523 if(!label.IsNull()) {
1524 Handle(TDataStd_ReferenceList) A = TDataStd_ReferenceList::Set(label);
1525 for(Standard_Integer i = 3; i <= nb - 1; i++)
1527 TDF_Label aValueLabel;
1528 DDF::AddLabel(DF, arg[i], aValueLabel);
1529 if(aValueLabel.IsNull()) continue;
1530 A->Append(aValueLabel);
1535 di << "DDataStd_SetReferenceList: Error\n";
1540 //=======================================================================
1541 //function : SetBooleanList (DF, entry, elmt1, elmt2, ... )
1542 //=======================================================================
1543 static Standard_Integer DDataStd_SetBooleanList (Draw_Interpretor& di,
1544 Standard_Integer nb,
1549 Handle(TDF_Data) DF;
1550 if (!DDF::GetDF(arg[1],DF))
1554 DDF::AddLabel(DF, arg[2], label);
1555 Handle(TDataStd_BooleanList) A = TDataStd_BooleanList::Set(label);
1556 for(Standard_Integer i = 3; i <= nb - 1; i++)
1558 Standard_Integer ival = Draw::Atoi(arg[i]);
1561 cout << "Bad value = " << ival<< ". 0 or 1 is expected." << endl;
1564 A->Append((Standard_Boolean)ival);
1568 di << "DDataStd_SetBooleanList: Error\n";
1572 //=======================================================================
1573 //function : SetIntegerList (DF, entry, elmt1, elmt2, ... )
1574 //=======================================================================
1575 static Standard_Integer DDataStd_SetIntegerList (Draw_Interpretor& di,
1576 Standard_Integer nb,
1581 Handle(TDF_Data) DF;
1582 if (!DDF::GetDF(arg[1],DF))
1586 DDF::AddLabel(DF, arg[2], label);
1587 Handle(TDataStd_IntegerList) A = TDataStd_IntegerList::Set(label);
1588 for(Standard_Integer i = 3; i <= nb - 1; i++)
1590 Standard_Integer ival = Draw::Atoi(arg[i]);
1595 di << "DDataStd_SetIntegerList: Error\n";
1599 //=======================================================================
1600 //function : SetRealList (DF, entry, elmt1, elmt2, ... )
1601 //=======================================================================
1602 static Standard_Integer DDataStd_SetRealList (Draw_Interpretor& di,
1603 Standard_Integer nb,
1608 Handle(TDF_Data) DF;
1609 if (!DDF::GetDF(arg[1],DF))
1613 DDF::AddLabel(DF, arg[2], label);
1614 Handle(TDataStd_RealList) A = TDataStd_RealList::Set(label);
1615 for(Standard_Integer i = 3; i <= nb - 1; i++)
1617 Standard_Real fval = Draw::Atof(arg[i]);
1622 di << "DDataStd_SetRealList: Error\n";
1626 //=======================================================================
1627 //function : DDataStd_InsertBeforeExtStringList (DF, entry, index, value )
1628 //=======================================================================
1629 static Standard_Integer DDataStd_InsertBeforeExtStringList (Draw_Interpretor& di,
1630 Standard_Integer nb,
1635 Handle(TDF_Data) DF;
1636 if (!DDF::GetDF(arg[1],DF))
1640 DDF::AddLabel(DF, arg[2], label);
1642 Handle(TDataStd_ExtStringList) A;
1643 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
1646 Standard_Integer index = Draw::Atoi(arg[3]);
1647 TCollection_ExtendedString value = arg[4];
1649 if (A->InsertBefore(index, value))
1654 di << "DDataStd_InsertBeforeExtStringList: Error\n";
1658 //=======================================================================
1659 //function : DDataStd_InsertAfterExtStringList (DF, entry, index, value )
1660 //=======================================================================
1661 static Standard_Integer DDataStd_InsertAfterExtStringList (Draw_Interpretor& di,
1662 Standard_Integer nb,
1667 Handle(TDF_Data) DF;
1668 if (!DDF::GetDF(arg[1],DF))
1672 DDF::AddLabel(DF, arg[2], label);
1674 Handle(TDataStd_ExtStringList) A;
1675 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
1678 Standard_Integer index = Draw::Atoi(arg[3]);
1679 TCollection_ExtendedString value = arg[4];
1681 if (A->InsertAfter(index, value))
1686 di << "DDataStd_InsertAfterExtStringList: Error\n";
1690 //=======================================================================
1691 //function : DDataStd_RemoveExtStringList (DF, entry, index )
1692 //=======================================================================
1693 static Standard_Integer DDataStd_RemoveExtStringList (Draw_Interpretor& di,
1694 Standard_Integer nb,
1699 Handle(TDF_Data) DF;
1700 if (!DDF::GetDF(arg[1],DF))
1704 DDF::AddLabel(DF, arg[2], label);
1706 Handle(TDataStd_ExtStringList) A;
1707 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
1710 Standard_Integer index = Draw::Atoi(arg[3]);
1712 if (A->Remove(index))
1717 di << "DDataStd_RemoveExtStringList: Error\n";
1721 //=======================================================================
1722 //function : DDataStd_InsertBeforeBooleanList (DF, entry, index, value )
1723 //=======================================================================
1724 static Standard_Integer DDataStd_InsertBeforeBooleanList (Draw_Interpretor& di,
1725 Standard_Integer nb,
1730 Handle(TDF_Data) DF;
1731 if (!DDF::GetDF(arg[1],DF))
1735 DDF::AddLabel(DF, arg[2], label);
1737 Handle(TDataStd_BooleanList) A;
1738 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
1741 Standard_Integer index = Draw::Atoi(arg[3]);
1742 Standard_Boolean value = (Standard_Boolean) Draw::Atoi(arg[4]);
1744 if (A->InsertBefore(index, value))
1749 di << "DDataStd_InsertBeforeBooleanList: Error\n";
1753 //=======================================================================
1754 //function : DDataStd_InsertAfterBooleanList (DF, entry, index, value )
1755 //=======================================================================
1756 static Standard_Integer DDataStd_InsertAfterBooleanList (Draw_Interpretor& di,
1757 Standard_Integer nb,
1762 Handle(TDF_Data) DF;
1763 if (!DDF::GetDF(arg[1],DF))
1767 DDF::AddLabel(DF, arg[2], label);
1769 Handle(TDataStd_BooleanList) A;
1770 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
1773 Standard_Integer index = Draw::Atoi(arg[3]);
1774 Standard_Boolean value = (Standard_Boolean) Draw::Atoi(arg[4]);
1776 if (A->InsertAfter(index, value))
1781 di << "DDataStd_InsertAfterBooleanList: Error\n";
1785 //=======================================================================
1786 //function : DDataStd_RemoveBooleanList (DF, entry, index )
1787 //=======================================================================
1788 static Standard_Integer DDataStd_RemoveBooleanList (Draw_Interpretor& di,
1789 Standard_Integer nb,
1794 Handle(TDF_Data) DF;
1795 if (!DDF::GetDF(arg[1],DF))
1799 DDF::AddLabel(DF, arg[2], label);
1801 Handle(TDataStd_BooleanList) A;
1802 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
1805 Standard_Integer index = Draw::Atoi(arg[3]);
1807 if (A->Remove(index))
1812 di << "DDataStd_RemoveBooleanList: Error\n";
1816 //=======================================================================
1817 //function : DDataStd_InsertBeforeIntegerList (DF, entry, index, value )
1818 //=======================================================================
1819 static Standard_Integer DDataStd_InsertBeforeIntegerList (Draw_Interpretor& di,
1820 Standard_Integer nb,
1825 Handle(TDF_Data) DF;
1826 if (!DDF::GetDF(arg[1],DF))
1830 DDF::AddLabel(DF, arg[2], label);
1832 Handle(TDataStd_IntegerList) A;
1833 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
1836 Standard_Integer index = Draw::Atoi(arg[3]);
1837 Standard_Integer value = (Standard_Integer) Draw::Atoi(arg[4]);
1839 if (A->InsertBeforeByIndex(index, value))
1844 di << "DDataStd_InsertBeforeIntegerList: Error\n";
1848 //=======================================================================
1849 //function : DDataStd_InsertAfterIntegerList (DF, entry, index, value )
1850 //=======================================================================
1851 static Standard_Integer DDataStd_InsertAfterIntegerList (Draw_Interpretor& di,
1852 Standard_Integer nb,
1857 Handle(TDF_Data) DF;
1858 if (!DDF::GetDF(arg[1],DF))
1862 DDF::AddLabel(DF, arg[2], label);
1864 Handle(TDataStd_IntegerList) A;
1865 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
1868 Standard_Integer index = Draw::Atoi(arg[3]);
1869 Standard_Integer value = (Standard_Integer) Draw::Atoi(arg[4]);
1871 if (A->InsertAfterByIndex(index, value))
1876 di << "DDataStd_InsertAfterIntegerList: Error\n";
1880 //=======================================================================
1881 //function : DDataStd_RemoveIntegerList (DF, entry, index )
1882 //=======================================================================
1883 static Standard_Integer DDataStd_RemoveIntegerList (Draw_Interpretor& di,
1884 Standard_Integer nb,
1889 Handle(TDF_Data) DF;
1890 if (!DDF::GetDF(arg[1],DF))
1894 DDF::AddLabel(DF, arg[2], label);
1896 Handle(TDataStd_IntegerList) A;
1897 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
1900 Standard_Integer index = Draw::Atoi(arg[3]);
1902 if (A->RemoveByIndex(index))
1907 di << "DDataStd_RemoveIntegerList: Error\n";
1911 //=======================================================================
1912 //function : DDataStd_InsertBeforeRealList (DF, entry, index, value )
1913 //=======================================================================
1914 static Standard_Integer DDataStd_InsertBeforeRealList (Draw_Interpretor& di,
1915 Standard_Integer nb,
1920 Handle(TDF_Data) DF;
1921 if (!DDF::GetDF(arg[1],DF))
1925 DDF::AddLabel(DF, arg[2], label);
1927 Handle(TDataStd_RealList) A;
1928 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
1931 Standard_Integer index = Draw::Atoi(arg[3]);
1932 Standard_Real value = (Standard_Real) Draw::Atof(arg[4]);
1934 if (A->InsertBeforeByIndex(index, value))
1939 di << "DDataStd_InsertBeforeRealList: Error\n";
1943 //=======================================================================
1944 //function : DDataStd_InsertAfterRealList (DF, entry, index, value )
1945 //=======================================================================
1946 static Standard_Integer DDataStd_InsertAfterRealList (Draw_Interpretor& di,
1947 Standard_Integer nb,
1952 Handle(TDF_Data) DF;
1953 if (!DDF::GetDF(arg[1],DF))
1957 DDF::AddLabel(DF, arg[2], label);
1959 Handle(TDataStd_RealList) A;
1960 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
1963 Standard_Integer index = Draw::Atoi(arg[3]);
1964 Standard_Real value = (Standard_Real) Draw::Atof(arg[4]);
1966 if (A->InsertAfterByIndex(index, value))
1971 di << "DDataStd_InsertAfterRealList: Error\n";
1975 //=======================================================================
1976 //function : DDataStd_RemoveRealList (DF, entry, index )
1977 //=======================================================================
1978 static Standard_Integer DDataStd_RemoveRealList (Draw_Interpretor& di,
1979 Standard_Integer nb,
1984 Handle(TDF_Data) DF;
1985 if (!DDF::GetDF(arg[1],DF))
1989 DDF::AddLabel(DF, arg[2], label);
1991 Handle(TDataStd_RealList) A;
1992 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
1995 Standard_Integer index = Draw::Atoi(arg[3]);
1997 if (A->RemoveByIndex(index))
2002 di << "DDataStd_RemoveRealList: Error\n";
2006 //=======================================================================
2007 //function : DDataStd_InsertBeforeReferenceList (DF, entry, index, value )
2008 //=======================================================================
2009 static Standard_Integer DDataStd_InsertBeforeReferenceList (Draw_Interpretor& di,
2010 Standard_Integer nb,
2015 Handle(TDF_Data) DF;
2016 if (!DDF::GetDF(arg[1],DF))
2020 DDF::AddLabel(DF, arg[2], label);
2022 Handle(TDataStd_ReferenceList) A;
2023 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2026 Standard_Integer index = Draw::Atoi(arg[3]);
2029 if (!DDF::AddLabel(DF, arg[4], refLabel))
2032 if (A->InsertBefore(index, refLabel))
2037 di << "DDataStd_InsertBeforeReferenceList: Error\n";
2041 //=======================================================================
2042 //function : DDataStd_InsertAfterReferenceList (DF, entry, index, value )
2043 //=======================================================================
2044 static Standard_Integer DDataStd_InsertAfterReferenceList (Draw_Interpretor& di,
2045 Standard_Integer nb,
2050 Handle(TDF_Data) DF;
2051 if (!DDF::GetDF(arg[1],DF))
2055 DDF::AddLabel(DF, arg[2], label);
2057 Handle(TDataStd_ReferenceList) A;
2058 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2061 Standard_Integer index = Draw::Atoi(arg[3]);
2064 if (!DDF::AddLabel(DF, arg[4], refLabel))
2067 if (A->InsertAfter(index, refLabel))
2072 di << "DDataStd_InsertAfterReferenceList: Error\n";
2076 //=======================================================================
2077 //function : DDataStd_RemoveReferenceList (DF, entry, index )
2078 //=======================================================================
2079 static Standard_Integer DDataStd_RemoveReferenceList (Draw_Interpretor& di,
2080 Standard_Integer nb,
2085 Handle(TDF_Data) DF;
2086 if (!DDF::GetDF(arg[1],DF))
2090 DDF::AddLabel(DF, arg[2], label);
2092 Handle(TDataStd_ReferenceList) A;
2093 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2096 Standard_Integer index = Draw::Atoi(arg[3]);
2098 if (A->Remove(index))
2103 di << "DDataStd_RemoveReferenceList: Error\n";
2107 //=======================================================================
2108 //function : GetByteArray (DF, entry )
2109 //=======================================================================
2110 static Standard_Integer DDataStd_GetByteArray (Draw_Interpretor& di,
2116 Handle(TDF_Data) DF;
2117 if (!DDF::GetDF(arg[1],DF)) return 1;
2119 if( !DDF::FindLabel(DF, arg[2], label) ) {
2120 di << "No label for entry" << "\n";
2124 Handle(TDataStd_ByteArray) A;
2125 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
2126 di << "There is no TDataStd_ByteArray at label" << "\n";
2130 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
2131 //cout << A->Value(i) << endl;
2140 //=======================================================================
2141 //function : GetByteArrayValue (DF, entry, index)
2142 //=======================================================================
2143 static Standard_Integer DDataStd_GetByteArrayValue (Draw_Interpretor& di,
2147 Handle(TDF_Data) DF;
2148 if (!DDF::GetDF(arg[1],DF))
2152 if (!DDF::FindLabel(DF, arg[2], label)) {
2153 di << "No label for entry" << "\n";
2157 Handle(TDataStd_ByteArray) A;
2158 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
2159 di << "There is no TDataStd_ByteArray under label" << "\n";
2163 Standard_Integer index = Draw::Atoi(arg[3]);
2164 if (index < A->Lower() || index > A->Upper()) {
2165 di << "Index is out of range\n";
2168 di << A->Value(index) << "\n";
2174 //=======================================================================
2175 //function : GetBooleanArray (DF, entry )
2176 //=======================================================================
2177 static Standard_Integer DDataStd_GetBooleanArray (Draw_Interpretor& di,
2181 Handle(TDF_Data) DF;
2182 if (!DDF::GetDF(arg[1],DF))
2186 if ( !DDF::FindLabel(DF, arg[2], label) )
2188 di << "No label for entry" << "\n";
2192 Handle(TDataStd_BooleanArray) A;
2193 if ( !label.FindAttribute(TDataStd_BooleanArray::GetID(), A) )
2195 di << "There is no TDataStd_BooleanArray at label" << "\n";
2199 for (Standard_Integer i = A->Lower(); i<=A->Upper(); i++)
2201 di << (Standard_Integer) A->Value(i);
2209 //=======================================================================
2210 //function : GetBooleanArrayValue (DF, entry, index)
2211 //=======================================================================
2212 static Standard_Integer DDataStd_GetBooleanArrayValue (Draw_Interpretor& di,
2216 Handle(TDF_Data) DF;
2217 if (!DDF::GetDF(arg[1],DF))
2221 if (!DDF::FindLabel(DF, arg[2], label)) {
2222 di << "No label for entry" << "\n";
2226 Handle(TDataStd_BooleanArray) A;
2227 if ( !label.FindAttribute(TDataStd_BooleanArray::GetID(), A) ) {
2228 di << "There is no TDataStd_BooleanArray under label" << "\n";
2232 Standard_Integer index = Draw::Atoi(arg[3]);
2233 if (index < A->Lower() || index > A->Upper()) {
2234 di << "Index is out of range\n";
2237 di << ((A->Value(index) == Standard_True) ? "True" : "False") << "\n";
2243 //=======================================================================
2244 //function : ChangeByteArray (DF, entry, indx, val )
2245 //=======================================================================
2246 static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di,
2247 Standard_Integer nb,
2252 Handle(TDF_Data) DF;
2253 if (!DDF::GetDF(arg[1],DF)) return 1;
2255 if( !DDF::FindLabel(DF, arg[2], label) ) {
2256 di << "No label for entry" << "\n";
2260 Handle(TDataStd_ByteArray) A;
2261 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
2262 di << "There is no TDataStd_ByteArray at label" << "\n";
2265 Standard_Integer indx = Draw::Atoi(arg[3]);
2266 Standard_Integer ival = Draw::Atoi(arg[4]);
2267 if (ival > 255 || ival < 0) {
2268 di << "DDataStd_ChangeByteArray: Bad value = " <<ival << "\n";
2271 Standard_Integer low = A->Lower(), up = A->Upper();
2272 if(low <= indx && indx <= up)
2273 A->SetValue(indx, (Standard_Byte)ival);
2275 Handle(TColStd_HArray1OfByte) Arr = A->InternalArray();
2276 Handle(TColStd_HArray1OfByte) arr;
2280 arr = new TColStd_HArray1OfByte(low, up);
2281 for(i=low; i<= Arr->Upper(); i++)
2282 arr->SetValue(i, Arr->Value(i));
2283 for(i=Arr->Upper()+1; i<= up; i++) {
2285 arr->SetValue(i, (Standard_Byte)ival);
2287 arr->SetValue(i, 0);
2289 } else if(indx < up) {//clip array : indx to be negative
2291 arr = new TColStd_HArray1OfByte(low, up);
2292 for(i=low; i< up; i++)
2293 arr->SetValue(i, Arr->Value(i));
2294 arr->SetValue(up, (Standard_Byte)ival);
2296 A->ChangeArray(arr);
2300 di << "DDataStd_ChangeByteArray: Error\n";
2304 //=======================================================================
2305 //function : GetBooleanList (DF, entry )
2306 //=======================================================================
2307 static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
2308 Standard_Integer nb,
2312 Handle(TDF_Data) DF;
2313 if (!DDF::GetDF(arg[1],DF))
2317 if ( !DDF::FindLabel(DF, arg[2], label) )
2319 di << "No label for entry" << "\n";
2323 Handle(TDataStd_BooleanList) A;
2324 if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
2326 di << "There is no TDataStd_BooleanList at label" << "\n";
2330 const TDataStd_ListOfByte& bList = A->List();
2331 Standard_Boolean isEmpty = (bList.Extent() > 0) ? Standard_False : Standard_True;
2333 TDataStd_ListIteratorOfListOfByte itr(bList);
2334 for (; itr.More(); itr.Next())
2336 di << (Standard_Integer) itr.Value() << " ";
2340 di << "List is empty\n";
2343 di << "DDataStd_GetBooleanList: Error\n";
2347 //=======================================================================
2348 //function : GetIntegerList (DF, entry )
2349 //=======================================================================
2350 static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
2351 Standard_Integer nb,
2355 Handle(TDF_Data) DF;
2356 if (!DDF::GetDF(arg[1],DF))
2360 if ( !DDF::FindLabel(DF, arg[2], label) )
2362 di << "No label for entry" << "\n";
2366 Handle(TDataStd_IntegerList) A;
2367 if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
2369 di << "There is no TDataStd_IntegerList at label" << "\n";
2373 const TColStd_ListOfInteger& iList = A->List();
2374 Standard_Boolean isEmpty = (iList.Extent() > 0) ? Standard_False : Standard_True;
2376 TColStd_ListIteratorOfListOfInteger itr(iList);
2377 for (; itr.More(); itr.Next())
2379 di << itr.Value() << " ";
2383 di << "List is empty\n";
2387 di << "DDataStd_GetIntegerList: Error\n";
2391 //=======================================================================
2392 //function : GetRealList (DF, entry )
2393 //=======================================================================
2394 static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
2395 Standard_Integer nb,
2399 Handle(TDF_Data) DF;
2400 if (!DDF::GetDF(arg[1],DF))
2404 if ( !DDF::FindLabel(DF, arg[2], label) )
2406 di << "No label for entry" << "\n";
2410 Handle(TDataStd_RealList) A;
2411 if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
2413 di << "There is no TDataStd_RealList at label" << "\n";
2417 const TColStd_ListOfReal& rList = A->List();
2418 Standard_Boolean isEmpty = (rList.Extent() > 0) ? Standard_False : Standard_True;
2420 TColStd_ListIteratorOfListOfReal itr(rList);
2421 for (; itr.More(); itr.Next())
2423 di << itr.Value() << " ";
2427 di << "List is empty\n";
2430 di << "DDataStd_GetRealList: Error\n";
2434 //=======================================================================
2435 //function : DDataStd_GetExtStringList (DF, entry)
2436 //=======================================================================
2437 static Standard_Integer DDataStd_GetExtStringList (Draw_Interpretor& di,
2438 Standard_Integer nb,
2443 Handle(TDF_Data) DF;
2444 if (!DDF::GetDF(arg[1],DF))
2448 if ( !DDF::FindLabel(DF, arg[2], label) )
2450 di << "No label for entry" << "\n";
2454 Handle(TDataStd_ExtStringList) A;
2455 if ( !label.FindAttribute(TDataStd_ExtStringList::GetID(), A) )
2457 di << "There is no TDataStd_ExtStringList at label" << "\n";
2461 const TDataStd_ListOfExtendedString& aList = A->List();
2462 Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
2464 TDataStd_ListIteratorOfListOfExtendedString itr(aList);
2465 for (; itr.More(); itr.Next())
2467 const TCollection_ExtendedString& aStr = itr.Value();
2473 di << "List is empty\n";
2477 di << "DDataStd_GetExtStringList: Error\n";
2481 //=======================================================================
2482 //function : DDataStd_GetReferenceList (DF, entry )
2483 //=======================================================================
2484 static Standard_Integer DDataStd_GetReferenceList (Draw_Interpretor& di,
2485 Standard_Integer nb,
2490 Handle(TDF_Data) DF;
2491 if (!DDF::GetDF(arg[1],DF))
2495 if ( !DDF::FindLabel(DF, arg[2], label) )
2497 di << "No label for entry" << "\n";
2501 Handle(TDataStd_ReferenceList) A;
2502 if ( !label.FindAttribute(TDataStd_ReferenceList::GetID(), A) )
2504 di << "There is no TDataStd_ReferenceList at label" << "\n";
2508 const TDF_LabelList& aList = A->List();
2509 Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
2511 TDF_ListIteratorOfLabelList itr(aList);
2512 for (; itr.More(); itr.Next())
2514 const TDF_Label& aLabel = itr.Value();
2515 if (!aLabel.IsNull()) {
2516 TCollection_AsciiString entry;
2517 TDF_Tool::Entry(aLabel, entry);
2518 di << entry.ToCString() << " ";
2523 di << "List is empty\n";
2526 di << "DDataStd_GetReferenceList: Error\n";
2530 //=======================================================================
2531 //function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
2532 //=======================================================================
2534 static Standard_Integer DDataStd_SetIntPackedMap (Draw_Interpretor& di,
2535 Standard_Integer nb,
2540 Handle(TDF_Data) DF;
2541 if (!DDF::GetDF(arg[1],DF)) return 1;
2543 DDF::AddLabel(DF, arg[2], aLabel);
2544 Standard_Integer isDelta = Draw::Atoi(arg[3]);
2545 Standard_Integer aNum = nb - 4;
2546 Handle(TDataStd_IntPackedMap) anAtt;
2547 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
2548 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
2549 if(anAtt.IsNull()) {
2550 di << "IntPackedMap attribute is not found or not set" << "\n";
2553 Standard_Integer j = 4;
2554 TColStd_PackedMapOfInteger aMap;
2555 for(Standard_Integer i = 1; i<=aNum; i++) {
2556 aMap.Add (Draw::Atoi(arg[j]));
2559 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
2560 anAtt->ChangeMap(aHMap);
2561 cout << "Map extent = " << anAtt->Extent()<<endl;
2564 di << "DDataStd_SetIntPackedMap : Error\n";
2568 //=======================================================================
2569 //function : GetIntPackedMap (DF, entry )
2570 //=======================================================================
2572 static Standard_Integer DDataStd_GetIntPackedMap (Draw_Interpretor& di,
2573 Standard_Integer nb,
2578 Handle(TDF_Data) DF;
2579 if (!DDF::GetDF(arg[1],DF)) return 1;
2581 DDF::AddLabel(DF, arg[2], aLabel);
2582 Handle(TDataStd_IntPackedMap) anAtt;
2583 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt)) {
2584 di << "IntPackedMap attribute is not found or not set" << "\n";
2587 const TColStd_PackedMapOfInteger& aMap = anAtt->GetMap();
2588 TColStd_MapIteratorOfPackedMapOfInteger itr(aMap);
2589 for (Standard_Integer j = 1; itr.More(); itr.Next(),j++){
2590 Standard_Integer aKey(itr.Key());
2595 di << "DDataStd_GetIntPackedMap : Error\n";
2600 //=======================================================================
2601 //function : ChangeIntPackedMap_Add (DF, entry, Key1, Key2,... )
2602 //=======================================================================
2603 static Standard_Integer DDataStd_ChangeIntPackedMap_Add (Draw_Interpretor& di,
2604 Standard_Integer nb,
2609 Handle(TDF_Data) DF;
2610 if (!DDF::GetDF(arg[1],DF)) return 1;
2612 if( !DDF::FindLabel(DF, arg[2], label) ) {
2613 di << "No label for entry" << "\n";
2617 Handle(TDataStd_IntPackedMap) A;
2618 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
2619 di << "There is no TDataStd_IntPackedMap at label" << "\n";
2623 Standard_Integer i, aNum = nb - 3;
2624 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
2625 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
2626 if(!aHMap.IsNull()) {
2627 ahMap->ChangeMap().Assign(aHMap->Map());
2628 for(i=1; i<=aNum;i++) {
2629 Standard_Integer val = Draw::Atoi(arg[i+2]);
2630 if(!ahMap->Map().Contains(val))
2631 ahMap->ChangeMap().Add(val);
2634 A->ChangeMap(ahMap);
2638 di << "DDataStd_ChangeIntPackedMap_Add: Error\n";
2643 //=======================================================================
2644 //function : ChangeIntPackedMap_Rem (DF, entry, Key1, Key2,... )
2645 //=======================================================================
2646 static Standard_Integer DDataStd_ChangeIntPackedMap_Rem (Draw_Interpretor& di,
2647 Standard_Integer nb,
2652 Handle(TDF_Data) DF;
2653 if (!DDF::GetDF(arg[1],DF)) return 1;
2655 if( !DDF::FindLabel(DF, arg[2], label) ) {
2656 di << "No label for entry" << "\n";
2660 Handle(TDataStd_IntPackedMap) A;
2661 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
2662 di << "There is no TDataStd_IntPackedMap at label" << "\n";
2666 Standard_Integer i, aNum = nb - 3;
2667 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
2668 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
2669 if(!aHMap.IsNull()) {
2670 ahMap->ChangeMap().Assign(aHMap->Map());
2671 for(i=1; i<=aNum;i++) {
2672 Standard_Integer val = Draw::Atoi(arg[i+2]);
2673 if(ahMap->Map().Contains(val))
2674 ahMap->ChangeMap().Remove(val);
2677 A->ChangeMap(ahMap);
2681 di << "DDataStd_ChangeIntPackedMap_Rem: Error\n";
2685 //=======================================================================
2686 //function : ChangeIntPackedMap_AddRem (DF, entry, Key1, Key2,... )
2687 // : if Keyi exist in map - remove it, if no - add
2688 //=======================================================================
2689 static Standard_Integer DDataStd_ChangeIntPackedMap_AddRem (Draw_Interpretor& di,
2690 Standard_Integer nb,
2695 Handle(TDF_Data) DF;
2696 if (!DDF::GetDF(arg[1],DF)) return 1;
2698 if( !DDF::FindLabel(DF, arg[2], label) ) {
2699 di << "No label for entry" << "\n";
2703 Handle(TDataStd_IntPackedMap) A;
2704 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
2705 di << "There is no TDataStd_IntPackedMap at label" << "\n";
2709 Standard_Integer i, aNum = nb - 3;
2710 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
2711 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
2712 if(!aHMap.IsNull()) {
2713 ahMap->ChangeMap().Assign(aHMap->Map());
2714 for(i=1; i<=aNum;i++) {
2715 Standard_Integer val = Draw::Atoi(arg[i+2]);
2716 if(!ahMap->Map().Contains(val))
2717 ahMap->ChangeMap().Add(val);
2719 ahMap->ChangeMap().Remove(val);
2722 A->ChangeMap(ahMap);
2726 di << "DDataStd_ChangeIntPackedMap_AddRem: Error\n";
2730 //=======================================================================
2731 //function : SetIntPHugeMap (DF, entry, isDelta Num)
2732 //=======================================================================
2734 static Standard_Integer DDataStd_SetIntPHugeMap (Draw_Interpretor& di,
2735 Standard_Integer nb,
2740 Handle(TDF_Data) DF;
2741 if (!DDF::GetDF(arg[1],DF)) return 1;
2743 DDF::AddLabel(DF, arg[2], aLabel);
2744 Standard_Integer isDelta = Draw::Atoi(arg[3]);
2745 Standard_Integer aNum = Draw::Atoi(arg[4]);
2746 Handle(TDataStd_IntPackedMap) anAtt;
2747 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
2748 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
2749 if(anAtt.IsNull()) {
2750 di << "IntPackedMap attribute is not found or not set" << "\n";
2753 TColStd_PackedMapOfInteger aMap;
2754 for(Standard_Integer i = 1; i<=aNum; i++) {
2757 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
2758 anAtt->ChangeMap(aHMap);
2759 cout << "Map extent = " << anAtt->Extent()<<endl;
2762 di << "DDataStd_SetIntPHugeMap : Error\n";
2766 //=======================================================================
2767 //function : SetNDataIntegers (DF, entry , Num
2768 //=======================================================================
2770 static Standard_Integer DDataStd_SetNDataIntegers2 (Draw_Interpretor& di,
2771 Standard_Integer nb,
2776 Handle(TDF_Data) DF;
2777 if (!DDF::GetDF(arg[1],DF)) return 1;
2779 DDF::AddLabel(DF, arg[2], aLabel);
2780 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2781 Handle(TDataStd_NamedData) anAtt;
2782 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2783 anAtt = TDataStd_NamedData::Set(aLabel);
2784 if(anAtt.IsNull()) {
2785 di << "NamedData attribute is not found or not set" << "\n";
2789 TCollection_ExtendedString aKey("Key_");
2790 for(Standard_Integer i = 1; i<=aNumP; i++) {
2791 TCollection_ExtendedString key = aKey + i;
2792 Standard_Integer aVal = j+i;
2793 anAtt->SetInteger(key, aVal);
2798 di << "DDataStd_SetNDataIntegers2 : Error\n";
2802 //=======================================================================
2803 //function : SetNDataIntArrays2 (DF, entry , key, NumOfArElem )
2804 //=======================================================================
2806 static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di,
2807 Standard_Integer nb,
2812 Handle(TDF_Data) DF;
2813 if (!DDF::GetDF(arg[1],DF)) return 1;
2815 DDF::AddLabel(DF, arg[2], aLabel);
2818 TCollection_ExtendedString aKey(arg[3]);
2819 Standard_Integer aNum = Draw::Atoi(arg[4]);
2820 if (aNum <= 0) return 1;
2821 Handle(TDataStd_NamedData) anAtt;
2822 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2823 anAtt = TDataStd_NamedData::Set(aLabel);
2824 if(anAtt.IsNull()) {
2825 cout<< "NamedData attribute is not found or not set" << endl;
2829 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
2830 for(Standard_Integer i = 1; i<=aNum; i++) {
2831 Standard_Integer aVal = j++;
2832 anArr->SetValue(i, aVal);
2835 anAtt->SetArrayOfIntegers(aKey, anArr);
2838 di << "DDataStd_SetNDataIntArrays2 : Error\n";
2843 //=======================================================================
2844 //function : SetAsciiString(DF, entry , String)
2845 //=======================================================================
2847 static Standard_Integer DDataStd_SetAsciiString (Draw_Interpretor& di,
2848 Standard_Integer nb,
2853 Handle(TDF_Data) DF;
2854 if (!DDF::GetDF(arg[1],DF)) return 1;
2856 DDF::AddLabel(DF, arg[2], aLabel);
2857 TCollection_AsciiString aString(arg[3]);
2858 Handle(TDataStd_AsciiString) anAtt;
2859 if(!aLabel.FindAttribute(TDataStd_AsciiString::GetID(), anAtt))
2860 anAtt = TDataStd_AsciiString::Set(aLabel, aString);
2861 if(anAtt.IsNull()) {
2862 di << "AsciiString attribute is not found or not set" << "\n";
2865 // anAtt->Set(aString);
2866 cout << "String = " << anAtt->Get().ToCString() << " is kept in DF" << endl;
2869 di << "DDataStd_SetAsciiString : Error\n";
2873 //=======================================================================
2874 //function : GetAsciiString(DF, entry )
2875 //=======================================================================
2877 static Standard_Integer DDataStd_GetAsciiString (Draw_Interpretor& di,
2878 Standard_Integer nb,
2883 Handle(TDF_Data) DF;
2884 if (!DDF::GetDF(arg[1],DF)) return 1;
2886 DDF::AddLabel(DF, arg[2], aLabel);
2887 Handle(TDataStd_AsciiString) anAtt;
2888 if(!aLabel.FindAttribute(TDataStd_AsciiString::GetID(), anAtt)) {
2889 cout << "AsciiString attribute is not found or not set" << endl;
2892 cout << "String = " <<anAtt->Get().ToCString() << endl;
2895 di << "DDataStd_GetAsciiString : Error\n";
2899 //=======================================================================
2900 //function : SetNDataIntegers (DF, entry , Num, key1, val1, ...
2901 //=======================================================================
2903 static Standard_Integer DDataStd_SetNDataIntegers (Draw_Interpretor& di,
2904 Standard_Integer nb,
2909 Handle(TDF_Data) DF;
2910 if (!DDF::GetDF(arg[1],DF)) return 1;
2912 DDF::AddLabel(DF, arg[2], aLabel);
2914 // TCollection_ExtendedString aString("123456789 0_abcde");
2915 // Standard_Integer aPos = aString.Search(" ");
2916 // cout << "From Start = " <<aPos<<endl;
2917 // aPos = aString.SearchFromEnd(" ");
2918 // cout << "From Start = " <<aPos<<endl;
2919 // TCollection_ExtendedString aValue = aString.Split(aPos);
2920 // cout << "Value = |"<<aValue<<endl;
2921 // cout << "aKey = " << aString << "|"<<endl;
2923 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2924 Handle(TDataStd_NamedData) anAtt;
2925 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2926 anAtt = TDataStd_NamedData::Set(aLabel);
2927 if(anAtt.IsNull()) {
2928 di << "NamedData attribute is not found or not set" << "\n";
2932 for(Standard_Integer i = 1; i<=aNumP; i++) {
2933 TCollection_ExtendedString aKey(arg[j]);
2934 Standard_Integer aVal = Draw::Atoi(arg[j+1]);
2935 anAtt->SetInteger(aKey, aVal);
2940 di << "DDataStd_SetNDataIntegers : Error\n";
2945 //=======================================================================
2946 //function : GetNDIntegers(DF, entry )
2947 //=======================================================================
2948 static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
2949 Standard_Integer nb,
2954 Handle(TDF_Data) DF;
2955 if (!DDF::GetDF(arg[1],DF)) return 1;
2957 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2960 Handle(TDataStd_NamedData) anAtt;
2961 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2962 cout << "NamedData attribute is not found or not set" << endl;
2965 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2966 const TColStd_DataMapOfStringInteger& aMap = anAtt->GetIntegersContainer();
2967 TColStd_DataMapIteratorOfDataMapOfStringInteger itr(aMap);
2968 for (; itr.More(); itr.Next()){
2969 TCollection_ExtendedString aKey(itr.Key());
2970 TCollection_AsciiString aStr(aKey,'?');
2971 Standard_Integer aValue = itr.Value();
2972 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;;
2977 di << "DDataStd_GetNDIntegers : Error\n";
2981 //=======================================================================
2982 //function : GetNDInteger(DF, entry, key [drawname])
2983 //=======================================================================
2984 static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
2985 Standard_Integer nb,
2990 Handle(TDF_Data) DF;
2991 if (!DDF::GetDF(arg[1],DF)) return 1;
2993 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2996 Handle(TDataStd_NamedData) anAtt;
2997 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2998 cout << "NamedData attribute is not found or not set" << endl;
3002 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3003 if(!anAtt->HasInteger(arg[3])) {
3004 cout << "There is no data specified by Key = "<< arg[3] << endl;
3007 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<endl;
3009 Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
3013 di << "DDataStd_SetNDataIntegers : Error\n";
3017 //========================== REALS ======================================
3018 //=======================================================================
3019 //function : SetNDataReals (DF, entry , Num, key1, val1, ...
3020 //=======================================================================
3022 static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di,
3023 Standard_Integer nb,
3028 Handle(TDF_Data) DF;
3029 if (!DDF::GetDF(arg[1],DF)) return 1;
3031 DDF::AddLabel(DF, arg[2], aLabel);
3033 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
3034 Handle(TDataStd_NamedData) anAtt;
3035 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3036 anAtt = TDataStd_NamedData::Set(aLabel);
3037 if(anAtt.IsNull()) {
3038 cout << "NamedData attribute is not found or not set" << endl;;
3042 for(Standard_Integer i = 1; i<=aNumP; i++) {
3043 TCollection_ExtendedString aKey(arg[j]);
3044 Standard_Real aVal = Draw::Atof(arg[j+1]);
3045 anAtt->SetReal(aKey, aVal);
3050 di << "DDataStd_SetNDataReals : Error\n";
3054 //=======================================================================
3055 //function : GetNDReals(DF, entry )
3056 //=======================================================================
3057 static Standard_Integer DDataStd_GetNDReals (Draw_Interpretor& di,
3058 Standard_Integer nb,
3063 Handle(TDF_Data) DF;
3064 if (!DDF::GetDF(arg[1],DF)) return 1;
3066 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3069 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3070 Handle(TDataStd_NamedData) anAtt;
3071 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3072 cout << "NamedData attribute is not found or not set" << endl;
3075 const TDataStd_DataMapOfStringReal& aMap = anAtt->GetRealsContainer();
3076 TDataStd_DataMapIteratorOfDataMapOfStringReal itr(aMap);
3077 for (; itr.More(); itr.Next()){
3078 TCollection_ExtendedString aKey(itr.Key());
3079 TCollection_AsciiString aStr(aKey,'?');
3080 Standard_Real aValue = itr.Value();
3081 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
3085 di << "DDataStd_GetNDReals : Error\n";
3089 //=======================================================================
3090 //function : GetNDReal(DF, entry, key [drawname])
3091 //=======================================================================
3092 static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
3093 Standard_Integer nb,
3098 Handle(TDF_Data) DF;
3099 if (!DDF::GetDF(arg[1],DF)) return 1;
3101 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3104 Handle(TDataStd_NamedData) anAtt;
3105 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3106 cout << "NamedData attribute is not found or not set" << endl;
3110 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3111 if(!anAtt->HasReal(arg[3])) {
3112 cout << "There is no data specified by Key = "<< arg[3] << endl;
3115 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<endl;
3117 Draw::Set(arg[4], anAtt->GetReal(arg[3]));
3121 di << "DDataStd_GetNDReal : Error\n";
3125 //======================= Strings =======================================
3126 //=======================================================================
3127 //function : SetNDataStrings (DF, entry , Num, key1, val1, ...
3128 //=======================================================================
3130 static Standard_Integer DDataStd_SetNDataStrings (Draw_Interpretor& di,
3131 Standard_Integer nb,
3136 Handle(TDF_Data) DF;
3137 if (!DDF::GetDF(arg[1],DF)) return 1;
3139 DDF::AddLabel(DF, arg[2], aLabel);
3141 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
3142 Handle(TDataStd_NamedData) anAtt;
3143 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3144 anAtt = TDataStd_NamedData::Set(aLabel);
3145 if(anAtt.IsNull()) {
3146 di << "NamedData attribute is not found or not set" << "\n";
3150 for(Standard_Integer i = 1; i<=aNumP; i++) {
3151 TCollection_ExtendedString aKey(arg[j]);
3152 TCollection_ExtendedString aVal(arg[j+1]);
3153 anAtt->SetString(aKey, aVal);
3158 di << "DDataStd_SetNDataStrings : Error\n";
3162 //=======================================================================
3163 //function : GetNDStrings(DF, entry )
3164 //=======================================================================
3165 static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
3166 Standard_Integer nb,
3171 Handle(TDF_Data) DF;
3172 if (!DDF::GetDF(arg[1],DF)) return 1;
3174 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3177 Handle(TDataStd_NamedData) anAtt;
3178 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3179 cout << "NamedData attribute is not found or not set" << endl;
3182 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3183 const TDataStd_DataMapOfStringString& aMap = anAtt->GetStringsContainer();
3184 TDataStd_DataMapIteratorOfDataMapOfStringString itr(aMap);
3185 for (; itr.More(); itr.Next()){
3186 TCollection_ExtendedString aKey(itr.Key());
3187 TCollection_AsciiString aStr(aKey,'?');
3188 TCollection_ExtendedString aVal(itr.Value());
3189 TCollection_AsciiString aStrValue(aVal,'?');
3190 cout << "Key = " << aStr.ToCString() << " Value = " <<aStrValue.ToCString()<< endl;
3194 di << "DDataStd_GetNDStrings : Error\n";
3198 //=======================================================================
3199 //function : GetNDString(DF, entry, key [drawname])
3200 //=======================================================================
3201 static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
3202 Standard_Integer nb,
3207 Handle(TDF_Data) DF;
3208 if (!DDF::GetDF(arg[1],DF)) return 1;
3210 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3213 Handle(TDataStd_NamedData) anAtt;
3214 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3215 di << "NamedData attribute is not found or not set" << "\n";
3219 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3220 if(!anAtt->HasString(arg[3])) {
3221 cout << "There is no data specified by Key = "<< arg[3] << endl;
3224 TCollection_AsciiString aValue (anAtt->GetString(arg[3]), '?');
3225 cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << endl;
3227 Draw::Set(arg[4], aValue.ToCString());
3231 di << "DDataStd_GetNDString : Error\n";
3235 //=========================== Bytes =====================================
3236 //=======================================================================
3237 //function : SetNDataBytes (DF, entry , Num, key1, val1, ...
3238 //=======================================================================
3240 static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di,
3241 Standard_Integer nb,
3246 Handle(TDF_Data) DF;
3247 if (!DDF::GetDF(arg[1],DF)) return 1;
3249 DDF::AddLabel(DF, arg[2], aLabel);
3251 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
3252 Handle(TDataStd_NamedData) anAtt;
3253 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3254 anAtt = TDataStd_NamedData::Set(aLabel);
3255 if(anAtt.IsNull()) {
3256 cout << "NamedData attribute is not found or not set" << endl;
3260 for(Standard_Integer i = 1; i<=aNumP; i++) {
3261 TCollection_ExtendedString aKey(arg[j]);
3262 Standard_Byte aVal = (Standard_Byte)Draw::Atoi(arg[j+1]);
3263 anAtt->SetByte(aKey, aVal);
3268 di << "DDataStd_SetNDataBytes : Error\n";
3272 //=======================================================================
3273 //function : GetNDBytes(DF, entry )
3274 //=======================================================================
3275 static Standard_Integer DDataStd_GetNDBytes (Draw_Interpretor& di,
3276 Standard_Integer nb,
3281 Handle(TDF_Data) DF;
3282 if (!DDF::GetDF(arg[1],DF)) return 1;
3284 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3287 Handle(TDataStd_NamedData) anAtt;
3288 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3289 cout << "NamedData attribute is not found or not set" << endl;
3292 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3293 const TDataStd_DataMapOfStringByte& aMap = anAtt->GetBytesContainer();
3294 TDataStd_DataMapIteratorOfDataMapOfStringByte itr(aMap);
3295 for (; itr.More(); itr.Next()){
3296 TCollection_ExtendedString aKey(itr.Key());
3297 TCollection_AsciiString aStr(aKey,'?');
3298 Standard_Byte aValue = itr.Value();
3299 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
3303 di << "DDataStd_GetNDBytes : Error\n";
3307 //=======================================================================
3308 //function : GetNDByte(DF, entry, key [drawname])
3309 //=======================================================================
3310 static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
3311 Standard_Integer nb,
3316 Handle(TDF_Data) DF;
3317 if (!DDF::GetDF(arg[1],DF)) return 1;
3319 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3322 Handle(TDataStd_NamedData) anAtt;
3323 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3324 cout << "NamedData attribute is not found or not set" << endl;
3328 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3329 if(!anAtt->HasByte(arg[3])) {
3330 cout << "There is no data specified by Key = "<< arg[3] << endl;
3333 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< endl;
3335 Draw::Set(arg[4], anAtt->GetByte(arg[3]));
3339 di << "DDataStd_GetNDByte : Error\n";
3342 //======================== IntArrays ====================================
3343 //=======================================================================
3344 //function : SetNDataIntArrays (DF, entry , key, NumOfArElem, val1, val2,... )
3345 //=======================================================================
3347 static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di,
3348 Standard_Integer nb,
3353 Handle(TDF_Data) DF;
3354 if (!DDF::GetDF(arg[1],DF)) return 1;
3356 DDF::AddLabel(DF, arg[2], aLabel);
3359 TCollection_ExtendedString aKey(arg[3]);
3360 Standard_Integer aNum = Draw::Atoi(arg[4]);
3361 if (aNum <= 0) return 1;
3362 Handle(TDataStd_NamedData) anAtt;
3363 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3364 anAtt = TDataStd_NamedData::Set(aLabel);
3365 if(anAtt.IsNull()) {
3366 cout<< "NamedData attribute is not found or not set" << endl;
3370 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
3371 for(Standard_Integer i = 1; i<=aNum; i++) {
3372 Standard_Integer aVal = Draw::Atoi(arg[j]);
3373 anArr->SetValue(i, aVal);
3376 anAtt->SetArrayOfIntegers(aKey, anArr);
3379 di << "DDataStd_SetNDataIntArrays : Error\n";
3384 //=======================================================================
3385 //function : GetNDIntArrays(DF, entry )
3386 //=======================================================================
3387 static Standard_Integer DDataStd_GetNDIntArrays (Draw_Interpretor& di,
3388 Standard_Integer nb,
3393 Handle(TDF_Data) DF;
3394 if (!DDF::GetDF(arg[1],DF)) return 1;
3396 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3399 Handle(TDataStd_NamedData) anAtt;
3400 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3401 cout << "NamedData attribute is not found or not set" << endl;
3404 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3405 const TDataStd_DataMapOfStringHArray1OfInteger& aMap = anAtt->GetArraysOfIntegersContainer();
3406 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger itr(aMap);
3407 for (; itr.More(); itr.Next()){
3408 TCollection_ExtendedString aKey(itr.Key());
3409 TCollection_AsciiString aStr(aKey,'?');
3410 cout << "Key = " << aStr.ToCString()<< endl;
3411 Handle(TColStd_HArray1OfInteger) anArrValue = itr.Value();
3412 if(!anArrValue.IsNull()) {
3413 Standard_Integer lower = anArrValue->Lower();
3414 Standard_Integer upper = anArrValue->Upper();
3415 for(Standard_Integer i = lower; i<=upper;i++) {
3416 Standard_Integer aValue = anArrValue->Value(i);
3417 cout << "\tValue("<<i<<") = " <<aValue<<endl;
3420 cout << "\tthe specified array is Null "<<endl;
3424 di << "DDataStd_GetNDIntArrays : Error\n";
3428 //=======================================================================
3429 //function : GetNDIntArray(DF, entry, key )
3430 //=======================================================================
3431 static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
3432 Standard_Integer nb,
3437 Handle(TDF_Data) DF;
3438 if (!DDF::GetDF(arg[1],DF)) return 1;
3440 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3443 Handle(TDataStd_NamedData) anAtt;
3444 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3445 cout << "NamedData attribute is not found or not set" << endl;
3449 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3450 if(!anAtt->HasArrayOfIntegers(arg[3])) {
3451 cout << "There is no data specified by Key = "<< arg[3] << endl;
3454 cout << "Key = " << arg[3] <<endl;
3456 Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
3457 if(!anArrValue.IsNull()) {
3458 Standard_Integer lower = anArrValue->Lower();
3459 Standard_Integer upper = anArrValue->Upper();
3460 for(Standard_Integer i = lower; i<=upper;i++) {
3461 Standard_Integer aValue = anArrValue->Value(i);
3462 cout << "\tValue("<<i<<") = " <<aValue<<endl;
3465 cout << "\tthe specified array is Null or not found"<<endl;
3469 di << "DDataStd_SetNDataIntArray : Error\n";
3472 //============================= RealArrays ==============================
3473 //=======================================================================
3474 //function : SetNDataRealArrays (DF entry key NumOfArElem val1 val2... )
3475 //=======================================================================
3477 static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di,
3478 Standard_Integer nb,
3483 Handle(TDF_Data) DF;
3484 if (!DDF::GetDF(arg[1],DF)) return 1;
3486 DDF::AddLabel(DF, arg[2], aLabel);
3489 TCollection_ExtendedString aKey(arg[3]);
3490 Standard_Integer aNum = Draw::Atoi(arg[4]);
3491 if (aNum <= 0) return 1;
3492 Handle(TDataStd_NamedData) anAtt;
3493 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3494 anAtt = TDataStd_NamedData::Set(aLabel);
3495 if(anAtt.IsNull()) {
3496 cout << "NamedData attribute is not found or not set" << endl;
3500 Handle(TColStd_HArray1OfReal) anArr = new TColStd_HArray1OfReal(1, aNum);
3501 for(Standard_Integer i = 1; i<=aNum; i++) {
3502 Standard_Real aVal = Draw::Atof(arg[j]);
3503 anArr->SetValue(i, aVal);
3506 anAtt->SetArrayOfReals(aKey, anArr);
3509 di << "DDataStd_SetNDataRealArrays : Error\n";
3514 //=======================================================================
3515 //function : GetNDRealArrays(DF, entry )
3516 //=======================================================================
3517 static Standard_Integer DDataStd_GetNDRealArrays (Draw_Interpretor& di,
3518 Standard_Integer nb,
3523 Handle(TDF_Data) DF;
3524 if (!DDF::GetDF(arg[1],DF)) return 1;
3526 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3529 Handle(TDataStd_NamedData) anAtt;
3530 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3531 cout << "NamedData attribute is not found or not set" << endl;
3534 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3535 const TDataStd_DataMapOfStringHArray1OfReal& aMap = anAtt->GetArraysOfRealsContainer();
3536 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal itr(aMap);
3537 for (; itr.More(); itr.Next()){
3538 TCollection_ExtendedString aKey(itr.Key());
3539 TCollection_AsciiString aStr(aKey,'?');
3540 cout << "Key = " << aStr.ToCString()<<endl;
3541 Handle(TColStd_HArray1OfReal) anArrValue = itr.Value();
3542 if(!anArrValue.IsNull()) {
3543 Standard_Integer lower = anArrValue->Lower();
3544 Standard_Integer upper = anArrValue->Upper();
3545 for(Standard_Integer i = lower; i<=upper;i++) {
3546 Standard_Real aValue = anArrValue->Value(i);
3547 cout << "\tValue("<<i<<") = " <<aValue<<endl;
3550 cout << "\tthe specified array is Null "<<endl;
3554 di << "DDataStd_GetNDRealArrays : Error\n";
3558 //=======================================================================
3559 //function : GetNDRealArray(DF, entry, key )
3560 //=======================================================================
3561 static Standard_Integer DDataStd_GetNDRealArray (Draw_Interpretor& di,
3562 Standard_Integer nb,
3567 Handle(TDF_Data) DF;
3568 if (!DDF::GetDF(arg[1],DF)) return 1;
3570 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3573 Handle(TDataStd_NamedData) anAtt;
3574 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
3575 di << "NamedData attribute is not found or not set" << "\n";
3579 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
3580 if(!anAtt->HasArrayOfReals(arg[3])) {
3581 cout << "There is no data specified by Key = "<< arg[3] << endl;
3584 cout << "Key = " << arg[3] <<endl;
3586 Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(arg[3]);
3587 if(!anArrValue.IsNull()) {
3588 Standard_Integer lower = anArrValue->Lower();
3589 Standard_Integer upper = anArrValue->Upper();
3590 for(Standard_Integer i = lower; i<=upper;i++) {
3591 Standard_Real aValue = anArrValue->Value(i);
3592 cout << "\tValue("<<i<<") = " <<aValue<<endl;
3595 cout << "\tthe specified array is Null or not found"<<endl;
3599 di << "DDataStd_SetNDataRealArray : Error\n";
3603 //=======================================================================
3604 //function : SetRefArray (DF, entry , From, To, elmt1, elmt2, ...
3605 //=======================================================================
3606 static Standard_Integer DDataStd_SetRefArray (Draw_Interpretor& di,
3607 Standard_Integer nb,
3610 Handle(TDF_Data) DF;
3611 if (!DDF::GetDF(arg[1],DF)) return 1;
3613 DDF::AddLabel(DF, arg[2], label);
3615 Standard_Integer From = Draw::Atoi(arg[3]), To = Draw::Atoi( arg[4] ), j;
3616 di << "RefArray with bounds from = " << From << " to = " << To << "\n";
3618 Handle(TDataStd_ReferenceArray) A = TDataStd_ReferenceArray::Set(label, From, To);
3622 for(Standard_Integer i = From; i<=To; i++) {
3623 TDF_Label aRefLabel;
3624 DDF::AddLabel(DF, arg[j], aRefLabel);
3625 A->SetValue(i, aRefLabel);
3632 //=======================================================================
3633 //function : SetRefArrayValue (DF, entry, index, value)
3634 //=======================================================================
3635 static Standard_Integer DDataStd_SetRefArrayValue (Draw_Interpretor&,
3640 Handle(TDF_Data) DF;
3641 if (!DDF::GetDF(arg[1], DF))
3646 if (!DDF::AddLabel(DF, arg[2], label))
3649 // Get index and value.
3650 Standard_Integer index = Draw::Atoi(arg[3]);
3653 Handle(TDataStd_ReferenceArray) arr;
3654 if (label.FindAttribute(TDataStd_ReferenceArray::GetID(), arr))
3656 TDF_Label aRefLabel;
3657 DDF::AddLabel(DF, arg[4], aRefLabel);
3658 arr->SetValue(index, aRefLabel);
3665 //=======================================================================
3666 //function : GetRefArray (DF, entry )
3667 //=======================================================================
3668 static Standard_Integer DDataStd_GetRefArray (Draw_Interpretor& di,
3673 Handle(TDF_Data) DF;
3674 if (!DDF::GetDF(arg[1],DF)) return 1;
3676 if( !DDF::FindLabel(DF, arg[2], label) ) {
3677 di << "No label for entry" << "\n";
3681 Handle(TDataStd_ReferenceArray) A;
3682 if ( !label.FindAttribute(TDataStd_ReferenceArray::GetID(), A) ) {
3683 di << "There is no TDataStd_ReferenceArray under label" << "\n";
3687 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
3688 const TDF_Label& aLabel = A->Value(i);
3689 TCollection_AsciiString entry;
3690 TDF_Tool::Entry(aLabel, entry);
3691 di << entry.ToCString();
3699 //=======================================================================
3700 //function : GetRefArrayValue (DF, entry, index)
3701 //=======================================================================
3702 static Standard_Integer DDataStd_GetRefArrayValue (Draw_Interpretor& di,
3706 Handle(TDF_Data) DF;
3707 if (!DDF::GetDF(arg[1],DF))
3711 if (!DDF::FindLabel(DF, arg[2], label)) {
3712 di << "No label for entry" << "\n";
3716 Handle(TDataStd_ReferenceArray) A;
3717 if ( !label.FindAttribute(TDataStd_ReferenceArray::GetID(), A) ) {
3718 di << "There is no TDataStd_ReferenceArray under label" << "\n";
3722 Standard_Integer index = Draw::Atoi(arg[3]);
3723 if (index < A->Lower() || index > A->Upper()) {
3724 di << "Index is out of range\n";
3727 const TDF_Label& value = A->Value(index);
3728 TCollection_AsciiString entry;
3729 TDF_Tool::Entry(value, entry);
3730 di << entry.ToCString() << "\n";
3736 //=======================================================================
3737 //function : BasicCommands
3739 //=======================================================================
3741 void DDataStd::BasicCommands (Draw_Interpretor& theCommands)
3744 static Standard_Boolean done = Standard_False;
3746 done = Standard_True;
3748 const char* g = "DData : Standard Attribute Commands";
3753 theCommands.Add ("SetInteger",
3754 "SetInteger (DF, entry, value)",
3755 __FILE__, DDataStd_SetInteger, g);
3757 theCommands.Add ("SetIntArray",
3758 "SetIntArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3759 __FILE__, DDataStd_SetIntArray, g);
3761 theCommands.Add ("SetIntArrayValue",
3762 "SetIntArrayValue (DF, entry, index, value)",
3763 __FILE__, DDataStd_SetIntArrayValue, g);
3765 theCommands.Add ("SetReal",
3766 "SetReal (DF, entry, value)",
3767 __FILE__, DDataStd_SetReal, g);
3769 theCommands.Add ("SetRealArray",
3770 "SetRealArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3771 __FILE__, DDataStd_SetRealArray, g);
3773 theCommands.Add ("SetRealArrayValue",
3774 "SetRealArrayValue (DF, entry, index, value)",
3775 __FILE__, DDataStd_SetRealArrayValue, g);
3777 theCommands.Add ("SetByteArray",
3778 "SetByteArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3779 __FILE__, DDataStd_SetByteArray, g);
3781 theCommands.Add ("SetByteArrayValue",
3782 "SetByteArrayValue (DF, entry, index, value)",
3783 __FILE__, DDataStd_SetByteArrayValue, g);
3785 theCommands.Add ("SetExtStringArray",
3786 "SetExtStringArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3787 __FILE__, DDataStd_SetExtStringArray, g);
3789 theCommands.Add ("SetExtStringArrayValue",
3790 "SetExtStringArrayValue (DF, entry, index, value)",
3791 __FILE__, DDataStd_SetExtStringArrayValue, g);
3793 theCommands.Add ("SetRefArray",
3794 "SetRefArray (DF, entry, From, To, [lab1, lab2, ...])",
3795 __FILE__, DDataStd_SetRefArray, g);
3797 theCommands.Add ("SetRefArrayValue",
3798 "SetRefArrayValue (DF, entry, index, value)",
3799 __FILE__, DDataStd_SetRefArrayValue, g);
3801 theCommands.Add ("SetIntPackedMap",
3802 "SetIntPackedMap (DF, entry, isDelta, key1, key2, ... )",
3803 __FILE__, DDataStd_SetIntPackedMap, g);
3805 theCommands.Add ("SetReference",
3806 "SetReference (DF, entry, reference)",
3807 __FILE__, DDataStd_SetReference, g);
3809 theCommands.Add ("SetComment",
3810 "SetComment (DF, entry, comment)",
3811 __FILE__, DDataStd_SetComment, g);
3813 theCommands.Add ("SetUAttribute",
3814 "SetUAttribute (DF, entry, LocalID)",
3815 __FILE__, DDataStd_SetUAttribute, g);
3817 theCommands.Add ("SetVariable",
3818 "SetVariable (DF, entry, isConstant[0/1], units)",
3819 __FILE__, DDataStd_SetVariable, g);
3821 theCommands.Add ("SetAsciiString",
3822 "SetAsciiString (DF, entry, String )",
3823 __FILE__, DDataStd_SetAsciiString, g);
3825 theCommands.Add ("SetBooleanArray",
3826 "SetBooleanArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3827 __FILE__, DDataStd_SetBooleanArray, g);
3829 theCommands.Add ("SetBooleanArrayValue",
3830 "SetBooleanArrayValue (DF, entry, index, value)",
3831 __FILE__, DDataStd_SetBooleanArrayValue, g);
3833 theCommands.Add ("SetBooleanList",
3834 "SetBooleanList (DF, entry, elmt1, elmt2, ... )",
3835 __FILE__, DDataStd_SetBooleanList, g);
3837 theCommands.Add ("SetIntegerList",
3838 "SetIntegerList (DF, entry, elmt1, elmt2, ... )",
3839 __FILE__, DDataStd_SetIntegerList, g);
3841 theCommands.Add ("SetRealList",
3842 "SetRealList (DF, entry, elmt1, elmt2, ... )",
3843 __FILE__, DDataStd_SetRealList, g);
3845 theCommands.Add ("SetExtStringList",
3846 "SetExtStringList (DF, entry, elmt1, elmt2, ... )",
3847 __FILE__, DDataStd_SetExtStringList, g);
3849 theCommands.Add ("SetReferenceList",
3850 "SetReferenceList (DF, entry, elmt1, elmt2, ... )",
3851 __FILE__, DDataStd_SetReferenceList, g);
3853 theCommands.Add ("InsertBeforeExtStringList",
3854 "InsertBeforeExtStringList (DF, entry, index, value )",
3855 __FILE__, DDataStd_InsertBeforeExtStringList, g);
3857 theCommands.Add ("InsertAfterExtStringList",
3858 "InsertAfterExtStringList (DF, entry, index, value )",
3859 __FILE__, DDataStd_InsertAfterExtStringList, g);
3861 theCommands.Add ("RemoveExtStringList",
3862 "RemoveExtStringList (DF, entry, index )",
3863 __FILE__, DDataStd_RemoveExtStringList, g);
3865 theCommands.Add ("InsertBeforeBooleanList",
3866 "InsertBeforeBooleanList (DF, entry, index, value )",
3867 __FILE__, DDataStd_InsertBeforeBooleanList, g);
3869 theCommands.Add ("InsertAfterBooleanList",
3870 "InsertAfterBooleanList (DF, entry, index, value )",
3871 __FILE__, DDataStd_InsertAfterBooleanList, g);
3873 theCommands.Add ("RemoveBooleanList",
3874 "RemoveBooleanList (DF, entry, index )",
3875 __FILE__, DDataStd_RemoveBooleanList, g);
3877 theCommands.Add ("InsertBeforeIntegerList",
3878 "InsertBeforeIntegerList (DF, entry, index, value )",
3879 __FILE__, DDataStd_InsertBeforeIntegerList, g);
3881 theCommands.Add ("InsertAfterIntegerList",
3882 "InsertAfterIntegerList (DF, entry, index, value )",
3883 __FILE__, DDataStd_InsertAfterIntegerList, g);
3885 theCommands.Add ("RemoveIntegerList",
3886 "RemoveIntegerList (DF, entry, index )",
3887 __FILE__, DDataStd_RemoveIntegerList, g);
3889 theCommands.Add ("InsertBeforeRealList",
3890 "InsertBeforeRealList (DF, entry, index, value )",
3891 __FILE__, DDataStd_InsertBeforeRealList, g);
3893 theCommands.Add ("InsertAfterRealList",
3894 "InsertAfterRealList (DF, entry, index, value )",
3895 __FILE__, DDataStd_InsertAfterRealList, g);
3897 theCommands.Add ("RemoveRealList",
3898 "RemoveRealList (DF, entry, index )",
3899 __FILE__, DDataStd_RemoveRealList, g);
3901 theCommands.Add ("InsertBeforeReferenceList",
3902 "InsertBeforeReferenceList (DF, entry, index, value )",
3903 __FILE__, DDataStd_InsertBeforeReferenceList, g);
3905 theCommands.Add ("InsertAfterReferenceList",
3906 "InsertAfterReferenceList (DF, entry, index, value )",
3907 __FILE__, DDataStd_InsertAfterReferenceList, g);
3909 theCommands.Add ("RemoveReferenceList",
3910 "RemoveReferenceList (DF, entry, index )",
3911 __FILE__, DDataStd_RemoveReferenceList, g);
3915 theCommands.Add ("GetAsciiString",
3916 "GetAsciiString (DF, entry )",
3917 __FILE__, DDataStd_GetAsciiString, g);
3919 theCommands.Add ("GetInteger",
3920 "GetInteger (DF, entry, [drawname])",
3921 __FILE__, DDataStd_GetInteger, g);
3923 theCommands.Add ("GetIntArray",
3924 "GetIntArray (DF, entry )",
3925 __FILE__, DDataStd_GetIntArray, g);
3927 theCommands.Add ("GetIntArrayValue",
3928 "GetIntArrayValue (DF, entry, index)",
3929 __FILE__, DDataStd_GetIntArrayValue, g);
3931 theCommands.Add ("GetRealArray",
3932 "GetRealArray (DF, entry )",
3933 __FILE__, DDataStd_GetRealArray, g);
3935 theCommands.Add ("GetRealArrayValue",
3936 "GetRealArrayValue (DF, entry, index)",
3937 __FILE__, DDataStd_GetRealArrayValue, g);
3939 theCommands.Add ("GetByteArray",
3940 "GetByteArray (DF, entry )",
3941 __FILE__, DDataStd_GetByteArray, g);
3943 theCommands.Add ("GetByteArrayValue",
3944 "GetByteArrayValue (DF, entry, index)",
3945 __FILE__, DDataStd_GetByteArrayValue, g);
3947 theCommands.Add ("GetExtStringArray",
3948 "GetExtStringArray (DF, entry )",
3949 __FILE__, DDataStd_GetExtStringArray, g);
3951 theCommands.Add ("GetExtStringArrayValue",
3952 "GetExtStringArrayValue (DF, entry, index)",
3953 __FILE__, DDataStd_GetExtStringArrayValue, g);
3955 theCommands.Add ("GetRefArray",
3956 "GetRefArray (DF, entry )",
3957 __FILE__, DDataStd_GetRefArray, g);
3959 theCommands.Add ("GetRefArrayValue",
3960 "GetRefArrayValue (DF, entry, index)",
3961 __FILE__, DDataStd_GetRefArrayValue, g);
3963 theCommands.Add ("GetIntPackedMap",
3964 "GetIntPackedMap (DF, entry )",
3965 __FILE__, DDataStd_GetIntPackedMap, g);
3967 theCommands.Add ("GetReal",
3968 "GetReal (DF, entry, [drawname])",
3969 __FILE__, DDataStd_GetReal, g);
3971 theCommands.Add ("GetReference",
3972 "GetReference (DF, entry)",
3973 __FILE__, DDataStd_GetReference, g);
3976 theCommands.Add ("GetComment",
3977 "GetComment (DF, entry)",
3978 __FILE__, DDataStd_GetComment, g);
3980 theCommands.Add("Self",
3981 "Self(document, entry)",
3982 __FILE__, DDataStd_Self, g);
3984 theCommands.Add ("GetUAttribute",
3985 "GetUAttribute (DF, entry)",
3986 __FILE__, DDataStd_GetUAttribute, g);
3988 theCommands.Add ("GetVariable",
3989 "GetVariable (DF, entry, [isConstant], [units])",
3990 __FILE__, DDataStd_GetVariable, g);
3992 theCommands.Add ("SetRelation",
3993 "SetRelation (DF, entry, expression, var1[, var2, ...])",
3994 __FILE__, DDataStd_SetRelation, g);
3996 theCommands.Add ("DumpRelation",
3997 "DumpRelation (DF, entry)",
3998 __FILE__, DDataStd_DumpRelation, g);
4000 theCommands.Add ("GetBooleanArray",
4001 "GetBooleanArray (DF, entry )",
4002 __FILE__, DDataStd_GetBooleanArray, g);
4004 theCommands.Add ("GetBooleanArrayValue",
4005 "GetBooleanArrayValue (DF, entry, index)",
4006 __FILE__, DDataStd_GetBooleanArrayValue, g);
4008 theCommands.Add ("GetBooleanList",
4009 "GetBooleanList (DF, entry )",
4010 __FILE__, DDataStd_GetBooleanList, g);
4012 theCommands.Add ("GetIntegerList",
4013 "GetIntegerList (DF, entry )",
4014 __FILE__, DDataStd_GetIntegerList, g);
4016 theCommands.Add ("GetRealList",
4017 "GetRealList (DF, entry )",
4018 __FILE__, DDataStd_GetRealList, g);
4020 theCommands.Add ("GetExtStringList",
4021 "GetExtStringList (DF, entry)",
4022 __FILE__, DDataStd_GetExtStringList, g);
4024 theCommands.Add ("GetReferenceList",
4025 "GetReferenceList (DF, entry)",
4026 __FILE__, DDataStd_GetReferenceList, g);
4028 // ========================= UTF =====================================
4029 const char* ggg = "UTF Commands";
4031 theCommands.Add ("SetUTFName",
4032 "SetUTFName (DF, entry, fileName)",
4033 __FILE__, DDataStd_KeepUTF, ggg);
4035 theCommands.Add ("GetUTF",
4036 "GetUTF (DF, entry, fileName)",
4037 __FILE__, DDataStd_GetUTFtoFile, ggg);
4039 //======================= NData Commands ========================
4041 const char* gN = "NData Commands";
4042 theCommands.Add ("SetNDataIntegers",
4043 "SetNDataIntegers (DF, entry, NumPairs, key1, val1, ... )",
4044 __FILE__, DDataStd_SetNDataIntegers, gN);
4046 theCommands.Add ("SetNDataReals",
4047 "SetNDataReals (DF, entry, NumPairs, key1, val1, ... )",
4048 __FILE__, DDataStd_SetNDataReals, gN);
4050 theCommands.Add ("SetNDataStrings",
4051 "SetNDataStrings (DF, entry, NumPairs, key1, val1, ... )",
4052 __FILE__, DDataStd_SetNDataStrings, gN);
4054 theCommands.Add ("SetNDataBytes",
4055 "SetNDataBytes (DF, entry, NumPairs, key1, val1, ... )",
4056 __FILE__, DDataStd_SetNDataBytes, gN);
4058 theCommands.Add ("SetNDataIntArrays",
4059 "SetNDataIntArrays (DF entry entry key NumOfArrElems val1 val2... )",
4060 __FILE__, DDataStd_SetNDataIntAr, gN);
4062 theCommands.Add ("SetNDataRealArrays",
4063 "SetNDataRealArrays (DF entry key NumOfArrElems val1 val2... )",
4064 __FILE__, DDataStd_SetNDataRealAr, gN);
4068 theCommands.Add ("GetNDIntegers",
4069 "GetNDIntegers (DF, entry )",
4070 __FILE__, DDataStd_GetNDIntegers, g);
4072 theCommands.Add ("GetNDInteger",
4073 "GetNDInteger (DF entry key [drawname])",
4074 __FILE__, DDataStd_GetNDInteger, g);
4076 theCommands.Add ("GetNDReals",
4077 "GetNDReals (DF entry )",
4078 __FILE__, DDataStd_GetNDReals, g);
4080 theCommands.Add ("GetNDReal",
4081 "GetNDReal (DF entry key [drawname])",
4082 __FILE__, DDataStd_GetNDReal, g);
4084 theCommands.Add ("GetNDStrings",
4085 "GetNDStrings (DF entry )",
4086 __FILE__, DDataStd_GetNDStrings, g);
4088 theCommands.Add ("GetNDString",
4089 "GetNDString (DF entry key [drawname])",
4090 __FILE__, DDataStd_GetNDString, g);
4092 theCommands.Add ("GetNDBytes",
4093 "GetNDBytes (DF entry )",
4094 __FILE__, DDataStd_GetNDBytes, g);
4096 theCommands.Add ("GetNDByte",
4097 "GetNDByte (DF entry key [drawname])",
4098 __FILE__, DDataStd_GetNDByte, g);
4100 theCommands.Add ("GetNDIntArrays",
4101 "GetNDIntArrays (DF, entry )",
4102 __FILE__, DDataStd_GetNDIntArrays, g);
4104 theCommands.Add ("GetNDIntArray",
4105 "GetNDIntArray (DF entry key )",
4106 __FILE__, DDataStd_GetNDIntArray, g);
4108 theCommands.Add ("GetNDRealArrays",
4109 "GetNDRealArrays (DF entry )",
4110 __FILE__, DDataStd_GetNDRealArrays, g);
4112 theCommands.Add ("GetNDRealArray",
4113 "GetNDRealArray (DF entry key )",
4114 __FILE__, DDataStd_GetNDRealArray, g);
4116 //====================== Change =======================
4117 theCommands.Add ("ChangeByteArray",
4118 "ChangeByteArray (DF, entry, indx, value )",
4119 __FILE__, DDataStd_ChangeByteArray, g);
4121 theCommands.Add ("ChangeIntArray",
4122 "ChangeIntArray (DF, entry, indx, value )",
4123 __FILE__, DDataStd_ChangeIntArray, g);
4125 theCommands.Add ("ChangeRealArray",
4126 "ChangeRealArray (DF, entry, indx, value )",
4127 __FILE__, DDataStd_ChangeRealArray, g);
4129 theCommands.Add ("ChangeExtStrArray",
4130 "ChangeExtStrArray (DF, entry, indx, value )",
4131 __FILE__, DDataStd_ChangeExtStrArray, g);
4133 theCommands.Add ("ChangeIntPackedMap_Add",
4134 "ChangeIntPackedMAp_Add (DF, entry, key[,key [...]] )",
4135 __FILE__, DDataStd_ChangeIntPackedMap_Add, g);
4137 theCommands.Add ("ChangeIntPackedMap_Rem",
4138 "ChangeIntPackedMAp_Rem (DF, entry, key[,key [...]] )",
4139 __FILE__, DDataStd_ChangeIntPackedMap_Rem, g);
4141 theCommands.Add ("ChangeIntPackedMap_AddRem",
4142 "ChangeIntPackedMAp_AddRem (DF, entry, key[,key [...]] )",
4143 __FILE__, DDataStd_ChangeIntPackedMap_AddRem, g);
4145 //=========================================================
4146 // TFunction commands
4147 const char* gg = "DFunction Commands";
4149 theCommands.Add ("SetFunction",
4150 "SetFunction (DF, entry, guid, failure)",
4151 __FILE__, DDataStd_SetFunction, gg);
4153 theCommands.Add ("GetFunction",
4154 "GetFunction (DF, entry, guid(out), failure(out))",
4155 __FILE__, DDataStd_GetFunction, gg);
4157 //=========================================================
4160 //======================================================================
4161 //======= for internal use
4163 theCommands.Add ("SetNDataIntegers2",
4164 "SetNDataIntegers2 (DF, entry, NumPair )",
4165 __FILE__, DDataStd_SetNDataIntegers2, gN);
4167 theCommands.Add ("SetNDataIntArrays2",
4168 "SetNDataIntArrays2 (DF entry entry key NumOfArrElems)",
4169 __FILE__, DDataStd_SetNDataIntAr2, gN);
4171 theCommands.Add ("SetIntArrayT",
4172 "SetIntArrayT (DF, entry, isDelta, From, To )",
4173 __FILE__, DDataStd_SetIntArrayTest, g);
4175 theCommands.Add ("SetIntPHugeMap",
4176 "SetIntPHugeMap (DF, entry, isDelta Num)",
4177 __FILE__, DDataStd_SetIntPHugeMap, g);