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>
98 //=======================================================================
99 //function : DDataStd_SetInteger
100 //purpose : SetInteger (DF, entry, value)
101 //=======================================================================
103 static Standard_Integer DDataStd_SetInteger (Draw_Interpretor& di,
109 if (!DDF::GetDF(arg[1],DF)) return 1;
111 DDF::AddLabel(DF, arg[2], L);
112 TDataStd_Integer::Set(L,Draw::Atoi(arg[3]));
115 di << "DDataStd_SetInteger : Error" << "\n";
119 //=======================================================================
120 //function : DDataStd_SetReal
121 //purpose : SetReal (DF, entry, value)
122 //=======================================================================
124 static Standard_Integer DDataStd_SetReal (Draw_Interpretor& di,
130 if (!DDF::GetDF(arg[1],DF)) return 1;
132 DDF::AddLabel(DF, arg[2], L);
133 TDataStd_Real::Set(L,Draw::Atof(arg[3]));
136 di << "DDataStd_SetReal : Error" << "\n";
142 //=======================================================================
143 //function : DDataStd_SetReference
144 //purpose : SetReference (DF, entry, reference)
145 //=======================================================================
147 static Standard_Integer DDataStd_SetReference (Draw_Interpretor& di,
153 if (!DDF::GetDF(arg[1],DF)) return 1;
155 DDF::AddLabel(DF, arg[2], L);
157 if (!DDF::FindLabel(DF,arg[3],LREF)) return 1;
158 TDF_Reference::Set(L,LREF);
161 di << "DDataStd_SetReference : Error" << "\n";
166 //=======================================================================
167 //function : DDataStd_SetComment
168 //purpose : SetComment (DF, entry, Comment)
169 //=======================================================================
171 static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
177 if (!DDF::GetDF(arg[1],DF)) return 1;
179 DDF::AddLabel(DF, arg[2], L);
180 TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));
183 di << "DDataStd_SetComment : Error" << "\n";
189 //=======================================================================
190 //function : DDataStd_GetInteger
191 //purpose : GetReal (DF, entry, [drawname])
192 //=======================================================================
194 static Standard_Integer DDataStd_GetInteger (Draw_Interpretor& di,
198 if (nb == 3 || nb == 4) {
200 if (!DDF::GetDF(arg[1],DF)) return 1;
201 Handle(TDataStd_Integer) A;
202 if (!DDF::Find(DF,arg[2],TDataStd_Integer::GetID(),A)) return 1;
203 if (nb == 4) Draw::Set(arg[3],A->Get());
204 else Draw::Set(arg[2],A->Get());
208 di << "DDataStd_GetInteger : Error" << "\n";
212 //=======================================================================
213 //function : DDataStd_GetReal
214 //purpose : GetReal (DF, entry, [drawname])
215 //=======================================================================
217 static Standard_Integer DDataStd_GetReal (Draw_Interpretor& di,
221 if (nb == 3 || nb == 4) {
223 if (!DDF::GetDF(arg[1],DF)) return 1;
224 Handle(TDataStd_Real) A;
225 if (!DDF::Find(DF,arg[2],TDataStd_Real::GetID(),A)) return 1;
226 if (nb == 4) Draw::Set(arg[3],A->Get());
227 else Draw::Set(arg[2],A->Get());
231 di << "DDataStd_GetReal : Error" << "\n";
236 //=======================================================================
237 //function : DDataStd_GetReference
238 //purpose : GetShape (DF, entry)
239 //=======================================================================
241 static Standard_Integer DDataStd_GetReference (Draw_Interpretor& di,
247 if (!DDF::GetDF(arg[1],DF)) return 1;
248 Handle(TDF_Reference) REF;
249 if (!DDF::Find(DF,arg[2],TDF_Reference::GetID(),REF)) return 1;
250 TCollection_AsciiString entry; TDF_Tool::Entry(REF->Get(),entry);
251 di << entry.ToCString();
254 di << "DDataStd_GetReference : Error" << "\n";
258 //=======================================================================
259 //function : DDataStd_GetComment
260 //purpose : GetShape (DF, entry)
261 //=======================================================================
263 static Standard_Integer DDataStd_GetComment (Draw_Interpretor& di,
269 if (!DDF::GetDF(arg[1],DF)) return 1;
270 Handle(TDataStd_Comment) A;
271 if (!DDF::Find(DF,arg[2],TDataStd_Comment::GetID(),A)) return 1;
272 TCollection_AsciiString s(A->Get(),'?');
273 di << A->Get().ToExtString();
276 di << "DDataStd_GetComment : Error" << "\n";
282 //=======================================================================
284 //purpose : Self (document,label)
285 //=======================================================================
287 static Standard_Integer DDataStd_Self (Draw_Interpretor& di,
291 TCollection_AsciiString s;
294 if (!DDF::GetDF(arg[1],DF)) return 1;
296 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
297 // TDataStd::MakeSelfContained(L,removed);
298 // if (removed.IsEmpty()) cout << "noone attriburte removed" << endl;
299 // for (TDF_ListIteratorOfAttributeList it(removed);it.More();it.Next()) {
300 // TDF_Tool::Entry(it.Value()->Label(),s); cout << s << " ";
305 di << "Self : Error" << "\n";
311 //=======================================================================
312 //function : SetUObject (DF, entry, ObjectID)
313 //=======================================================================
314 // static Standard_Integer DDataStd_SetUObject (Draw_Interpretor&,
315 // Standard_Integer nb,
319 // Handle(TDF_Data) DF;
320 // if (!DDF::GetDF(arg[1],DF)) return 1;
322 // DDF::AddLabel(DF, arg[2], label);
324 // Standard_GUID guid(arg[3]); //"00000000-0000-0000-1111-000000000000");
325 // TDataStd_UObject::Set(label, guid);
329 // cout << "Wrong arguments" << endl;
333 //=======================================================================
334 //function : SetUAttribute (DF, entry, LocalID)
335 //=======================================================================
336 static Standard_Integer DDataStd_SetUAttribute (Draw_Interpretor& di,
342 if (!DDF::GetDF(arg[1],DF)) return 1;
344 DDF::AddLabel(DF, arg[2], label);
346 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
347 TDataStd_UAttribute::Set(label, guid);
351 di << "Wrong arguments" << "\n";
355 //=======================================================================
356 //function : GetUAttribute (DF, entry, LoaclID)
357 //=======================================================================
358 static Standard_Integer DDataStd_GetUAttribute (Draw_Interpretor& di,
364 if (!DDF::GetDF(arg[1],DF)) return 1;
366 if( !DDF::FindLabel(DF, arg[2], label) ) {
367 di << "No label for entry" << "\n";
370 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
372 Handle(TDataStd_UAttribute) UA;
373 if( !label.FindAttribute(guid, UA) ) {
374 di << "No UAttribute Attribute on label" << "\n";
377 char *aStrGUID = new char[37];
378 UA->ID().ToCString(aStrGUID);
384 di << "Wrong arguments" << "\n";
389 //=======================================================================
390 //function : CheckUObject (DF, entry, ObjectID)
391 //=======================================================================
392 // static Standard_Integer DDataStd_CheckUObject (Draw_Interpretor&,
393 // Standard_Integer nb,
397 // Handle(TDF_Data) DF;
398 // if (!DDF::GetDF(arg[1],DF)) return 1;
400 // if( !DDF::FindLabel(DF, arg[2], label) ) {
401 // cout << "No label for entry" << endl;
404 // Handle(TDataStd_Object) O;
405 // Handle(TDataStd_UObject) UO;
406 // Standard_GUID guidUO(arg[3]);
408 // if( !label.FindAttribute( TDataStd_Object::GetID(), O) ) {
409 // cout << "No Object Attribute on label" << endl;
412 // cout << "UObject is found with ObjectID = ";
413 // O->Find(label, guidUO, UO);
414 // UO->ObjectID().ShallowDump(cout);
420 // cout << "Wrong arguments" << endl;
425 //=======================================================================
426 //function : SetIntArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
427 //=======================================================================
428 static Standard_Integer DDataStd_SetIntArray (Draw_Interpretor& di,
433 if (!DDF::GetDF(arg[1],DF)) return 1;
435 DDF::AddLabel(DF, arg[2], label);
436 Standard_Integer isDelta = Draw::Atoi(arg[3]);
437 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
438 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
439 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
443 for(Standard_Integer i = From; i<=To; i++) {
444 A->SetValue(i, Draw::Atoi(arg[j]) );
452 //=======================================================================
453 //function : SetIntArrayValue (DF, entry, index, value)
454 //=======================================================================
455 static Standard_Integer DDataStd_SetIntArrayValue (Draw_Interpretor&,
461 if (!DDF::GetDF(arg[1], DF))
466 if (!DDF::AddLabel(DF, arg[2], label))
469 // Get index and value.
470 Standard_Integer index = Draw::Atoi(arg[3]);
471 Standard_Integer value = Draw::Atoi(arg[4]);
474 Handle(TDataStd_IntegerArray) arr;
475 if (label.FindAttribute(TDataStd_IntegerArray::GetID(), arr))
477 arr->SetValue(index, value);
484 //=======================================================================
485 //function : GetIntArray (DF, entry )
486 //=======================================================================
487 static Standard_Integer DDataStd_GetIntArray (Draw_Interpretor& di,
494 if (!DDF::GetDF(arg[1],DF)) return 1;
496 if( !DDF::FindLabel(DF, arg[2], label) ) {
497 di << "No label for entry" << "\n";
501 Handle(TDataStd_IntegerArray) A;
502 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
503 di << "There is no TDataStd_IntegerArray under label" << "\n";
507 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
508 //cout << A->Value(i) << endl;
517 //=======================================================================
518 //function : GetIntArrayValue (DF, entry, index)
519 //=======================================================================
520 static Standard_Integer DDataStd_GetIntArrayValue (Draw_Interpretor& di,
525 if (!DDF::GetDF(arg[1],DF))
529 if (!DDF::FindLabel(DF, arg[2], label)) {
530 di << "No label for entry" << "\n";
534 Handle(TDataStd_IntegerArray) A;
535 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
536 di << "There is no TDataStd_IntegerArray under label" << "\n";
540 Standard_Integer index = Draw::Atoi(arg[3]);
541 if (index < A->Lower() || index > A->Upper()) {
542 di << "Index is out of range" << "\n";
545 di << A->Value(index) << "\n";
551 //=======================================================================
552 //function : ChangeIntArray (DF, entry, indx, val )
553 //=======================================================================
554 static Standard_Integer DDataStd_ChangeIntArray (Draw_Interpretor& di,
561 if (!DDF::GetDF(arg[1],DF)) return 1;
563 if( !DDF::FindLabel(DF, arg[2], label) ) {
564 di << "No label for entry" << "\n";
568 Handle(TDataStd_IntegerArray) A;
569 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
570 di << "There is no TDataStd_IntegerArray at label" << "\n";
573 Standard_Integer indx = Draw::Atoi(arg[3]);
574 Standard_Integer val = Draw::Atoi(arg[4]);
575 Standard_Integer low = A->Lower(), up = A->Upper();
576 if(low <= indx && indx <= up)
577 A->SetValue(indx, val);
579 Handle(TColStd_HArray1OfInteger) Arr = A->Array();
580 Handle(TColStd_HArray1OfInteger) arr;
584 arr = new TColStd_HArray1OfInteger(low, up);
585 for(i=low; i<= Arr->Upper(); i++)
586 arr->SetValue(i, Arr->Value(i));
587 for(i=Arr->Upper()+1; i<= up; i++) {
589 arr->SetValue(i, val);
593 } else if(indx < up) {//clip array : indx to be negative
595 arr = new TColStd_HArray1OfInteger(low, up);
596 for(i=low; i< up; i++)
597 arr->SetValue(i, Arr->Value(i));
598 arr->SetValue(up, val);
604 di << "DDataStd_ChangeIntArray: Error" << "\n";
608 //=======================================================================
609 //function : SetIntArrayT (DF, entry , isDelta, From, To) - for testing
611 //=======================================================================
612 static Standard_Integer DDataStd_SetIntArrayTest (Draw_Interpretor& di,
619 if (!DDF::GetDF(arg[1],DF)) return 1;
621 DDF::AddLabel(DF, arg[2], label);
622 Standard_Integer isDelta = Draw::Atoi(arg[3]);
623 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
624 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
625 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
628 Standard_Integer k = 100;
629 for(Standard_Integer i = From; i<=To; i++) {
637 //=======================================================================
638 //function : SetRealArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
639 //=======================================================================
640 static Standard_Integer DDataStd_SetRealArray (Draw_Interpretor& di,
647 if (!DDF::GetDF(arg[1],DF)) return 1;
649 DDF::AddLabel(DF, arg[2], label);
650 Standard_Integer isDelta = Draw::Atoi(arg[3]);
652 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
653 di << " Array of Standard_Real with bounds from = " << From << " to = " << To << "\n";
654 Handle(TDataStd_RealArray) A = TDataStd_RealArray::Set(label, From, To, isDelta);
658 for(Standard_Integer i = From; i<=To; i++) {
659 A->SetValue(i, Draw::Atof(arg[j]) );
667 //=======================================================================
668 //function : SetRealArrayValue (DF, entry, index value)
669 //=======================================================================
670 static Standard_Integer DDataStd_SetRealArrayValue (Draw_Interpretor&,
676 if (!DDF::GetDF(arg[1], DF))
681 if (!DDF::AddLabel(DF, arg[2], label))
684 // Get index and value.
685 Standard_Integer index = Draw::Atoi(arg[3]);
686 Standard_Real value = Draw::Atof(arg[4]);
689 Handle(TDataStd_RealArray) realArray;
690 if (label.FindAttribute(TDataStd_RealArray::GetID(), realArray))
692 realArray->SetValue(index, value);
699 //=======================================================================
700 //function : GetRealArray (DF, entry )
701 //=======================================================================
702 static Standard_Integer DDataStd_GetRealArray (Draw_Interpretor& di,
708 if (!DDF::GetDF(arg[1],DF)) return 1;
710 if( !DDF::FindLabel(DF, arg[2], label) ) {
711 di << "No label for entry" << "\n";
715 Handle(TDataStd_RealArray) A;
716 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
717 di << "There is no TDataStd_RealArray under label" << "\n";
721 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
722 //cout << A->Value(i) << endl;
732 //=======================================================================
733 //function : GetRealArrayValue (DF, entry, index)
734 //=======================================================================
735 static Standard_Integer DDataStd_GetRealArrayValue (Draw_Interpretor& di,
740 if (!DDF::GetDF(arg[1],DF))
744 if (!DDF::FindLabel(DF, arg[2], label)) {
745 di << "No label for entry" << "\n";
749 Handle(TDataStd_RealArray) A;
750 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
751 di << "There is no TDataStd_RealArray under label" << "\n";
755 Standard_Integer index = Draw::Atoi(arg[3]);
756 if (index < A->Lower() || index > A->Upper()) {
757 di << "Index is out of range" << "\n";
760 di << A->Value(index) << "\n";
766 //=======================================================================
767 //function : ChangeRealArray (DF, entry, indx, val )
768 //=======================================================================
769 static Standard_Integer DDataStd_ChangeRealArray (Draw_Interpretor& di,
776 if (!DDF::GetDF(arg[1],DF)) return 1;
778 if( !DDF::FindLabel(DF, arg[2], label) ) {
779 di << "No label for entry" << "\n";
783 Handle(TDataStd_RealArray) A;
784 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
785 di << "There is no TDataStd_RealArray at label" << "\n";
788 Standard_Integer indx = Draw::Atoi(arg[3]);
789 Standard_Real val = Draw::Atof(arg[4]);
790 Standard_Integer low = A->Lower(), up = A->Upper();
791 if(low <= indx && indx <= up)
792 A->SetValue(indx, val);
794 Handle(TColStd_HArray1OfReal) Arr = A->Array();
795 Handle(TColStd_HArray1OfReal) arr;
799 arr = new TColStd_HArray1OfReal(low, up);
800 for(i=low; i<= Arr->Upper(); i++)
801 arr->SetValue(i, Arr->Value(i));
802 for(i=Arr->Upper()+1; i<= up; i++) {
804 arr->SetValue(i, val);
808 } else if(indx < up) {//clip array : indx to be negative
810 arr = new TColStd_HArray1OfReal(low, up);
811 for(i=low; i< up; i++)
812 arr->SetValue(i, Arr->Value(i));
813 arr->SetValue(up, val);
819 di << "DDataStd_ChangeRealArray: Error" << "\n";
823 //=======================================================================
824 //function : SetVariable (DF, entry, isConstant[0/1], units)
825 //=======================================================================
826 static Standard_Integer DDataStd_SetVariable (Draw_Interpretor& di,
833 if (!DDF::GetDF(arg[1],DF)) return 1;
835 DDF::AddLabel(DF, arg[2], label);
837 Handle(TDataStd_Variable) aV = TDataStd_Variable::Set(label);
839 const char* aUnits = arg[4];
840 aV->Unit(Standard_CString(aUnits));
842 aV->Constant(Standard_Boolean(Draw::Atoi(arg[3])));
846 di << "Wrong arguments" << "\n";
850 //=======================================================================
851 //function : GetVariable (DF, entry, [isConstant], [units])
852 //=======================================================================
853 static Standard_Integer DDataStd_GetVariable (Draw_Interpretor& di,
860 if (!DDF::GetDF(arg[1],DF)) return 1;
862 DDF::AddLabel(DF, arg[2], label);
864 Handle(TDataStd_Variable) aV;
865 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
867 di << "TDataStd_Variable: no such attribute" << "\n";
870 Draw::Set(arg[3],TCollection_AsciiString(Standard_Integer(aV->IsConstant())).ToCString());
871 Draw::Set(arg[4],aV->Unit().ToCString());
875 di << "Wrong arguments" << "\n";
879 #include <TDataStd_Relation.hxx>
880 #include <TDataStd_Variable.hxx>
881 //=======================================================================
882 //function : SetRelation (DF, entry, expression, var1[, var2, ...])
883 //=======================================================================
884 static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
885 Standard_Integer nb, const char** arg)
890 if (!DDF::GetDF(arg[1],DF)) return 1;
892 DDF::AddLabel(DF, arg[2], label);
894 Standard_CString expr (arg[3]);
895 Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
896 aR->SetRelation(expr);
897 Handle(TDataStd_Variable) aV;
899 for (Standard_Integer i = 4; i < nb; i++)
901 if (!DDF::FindLabel(DF, arg[i], label))
903 di << "No label for entry" << arg[i] << "\n";
906 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
908 di << "No TDataStd_Variable Attribute on label" << "\n";
911 aR->GetVariables().Append(aV);
915 di << "Usage: SetRelation (DF, entry, expression, var1[, var2, ...])" << "\n";
919 //=======================================================================
920 //function : DumpRelation (DF, entry)
921 //=======================================================================
922 static Standard_Integer DDataStd_DumpRelation (Draw_Interpretor& di,
923 Standard_Integer nb, const char** arg)
928 if (!DDF::GetDF(arg[1],DF)) return 1;
931 if (!DDF::FindLabel(DF, arg[2], label))
933 di << "No label for entry " << arg[2] << "\n";
936 Handle(TDataStd_Relation) aR;
937 if (!label.FindAttribute(TDataStd_Relation::GetID(), aR))
939 di << "No TDataStd_Relation Attribute on label " << arg[2] << "\n";
943 di << "Relation: expression = \"" << aR->GetRelation()
944 << "\" variables list = (";
946 Handle(TDF_Attribute) aV;
947 TCollection_AsciiString anEntry;
949 TDF_ListIteratorOfAttributeList it;
950 for (it.Initialize(aR->GetVariables()); it.More(); it.Next())
956 TDF_Tool::Entry(label, anEntry);
957 di << anEntry.ToCString() << " ";
963 di << "Usage: DumpRelation (DF, entry)" << "\n";
967 #include <TFunction_Function.hxx>
968 //=======================================================================
969 //function : SetFunction (DF, entry, guid, failure)
970 //=======================================================================
971 static Standard_Integer DDataStd_SetFunction (Draw_Interpretor& di,
972 Standard_Integer nb, const char** arg)
977 if (!DDF::GetDF(arg[1],DF)) return 1;
979 DDF::AddLabel(DF, arg[2], label);
981 Standard_GUID guid (arg[3]);
982 Handle(TFunction_Function) aF = TFunction_Function::Set(label, guid);
984 int fail = Draw::Atoi(arg[4]);
985 aF->SetFailure(fail);
990 di << "Wrong arguments" << "\n";
994 //=======================================================================
995 //function : GetFunction (DF, entry, guid(out), failure(out))
996 //=======================================================================
997 static Standard_Integer DDataStd_GetFunction (Draw_Interpretor& di,
998 Standard_Integer nb, const char** arg)
1002 Handle(TDF_Data) DF;
1003 if (!DDF::GetDF(arg[1],DF)) return 1;
1005 if (!DDF::FindLabel(DF, arg[2], label))
1007 di << "No label for entry" << "\n";
1011 Handle(TFunction_Function) aF;
1012 if (!label.FindAttribute(TFunction_Function::GetID(), aF))
1014 di << "No TFunction_Function Attribute on label" << "\n";
1018 char *aStrGUID = new char[37];
1019 aF->GetDriverGUID().ToCString(aStrGUID);
1020 Draw::Set(arg[3],aStrGUID);
1022 Draw::Set(arg[4],TCollection_AsciiString(aF->GetFailure()).ToCString());
1027 di << "Wrong arguments" << "\n";
1031 //=======================================================================
1032 //function : SetExtStringArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
1033 //=======================================================================
1034 static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
1035 Standard_Integer nb,
1038 Handle(TDF_Data) DF;
1039 if (!DDF::GetDF(arg[1],DF)) return 1;
1041 DDF::AddLabel(DF, arg[2], label);
1042 Standard_Integer isDelta = Draw::Atoi(arg[3]);
1044 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1045 di << "Array of ExtString with bounds from = " << From << " to = " << To << "\n";
1046 Handle(TDataStd_ExtStringArray) A = TDataStd_ExtStringArray::Set(label, From, To, isDelta);
1050 for(Standard_Integer i = From; i<=To; i++) {
1051 A->SetValue(i, arg[j] );
1059 //=======================================================================
1060 //function : SetExtStringArrayValue (DF, entry, index, value)
1061 //=======================================================================
1062 static Standard_Integer DDataStd_SetExtStringArrayValue (Draw_Interpretor&,
1067 Handle(TDF_Data) DF;
1068 if (!DDF::GetDF(arg[1], DF))
1073 if (!DDF::AddLabel(DF, arg[2], label))
1076 // Get index and value.
1077 Standard_Integer index = Draw::Atoi(arg[3]);
1080 Handle(TDataStd_ExtStringArray) arr;
1081 if (label.FindAttribute(TDataStd_ExtStringArray::GetID(), arr))
1083 arr->SetValue(index, arg[4]);
1090 //=======================================================================
1091 //function : GetExtStringArray (DF, entry )
1092 //=======================================================================
1093 static Standard_Integer DDataStd_GetExtStringArray (Draw_Interpretor& di,
1099 Handle(TDF_Data) DF;
1100 if (!DDF::GetDF(arg[1],DF)) return 1;
1102 if( !DDF::FindLabel(DF, arg[2], label) ) {
1103 di << "No label for entry" << "\n";
1107 Handle(TDataStd_ExtStringArray) A;
1108 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1109 di << "There is no TDataStd_ExtStringArray under label" << "\n";
1113 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
1114 TCollection_AsciiString anAsciiString(A->Value(i),'?');
1115 di << anAsciiString.ToCString();
1123 //=======================================================================
1124 //function : GetExtStringArrayValue (DF, entry, index)
1125 //=======================================================================
1126 static Standard_Integer DDataStd_GetExtStringArrayValue (Draw_Interpretor& di,
1130 Handle(TDF_Data) DF;
1131 if (!DDF::GetDF(arg[1],DF))
1135 if (!DDF::FindLabel(DF, arg[2], label)) {
1136 di << "No label for entry" << "\n";
1140 Handle(TDataStd_ExtStringArray) A;
1141 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1142 di << "There is no TDataStd_ExtStringArray under label" << "\n";
1146 Standard_Integer index = Draw::Atoi(arg[3]);
1147 if (index < A->Lower() || index > A->Upper()) {
1148 di << "Index is out of range" << "\n";
1151 const TCollection_ExtendedString& value = A->Value(index);
1152 di << value << "\n";
1158 //=======================================================================
1159 //function : ChangeExtStrArray (DF, entry, indx, val )
1160 //=======================================================================
1161 static Standard_Integer DDataStd_ChangeExtStrArray (Draw_Interpretor& di,
1162 Standard_Integer nb,
1167 Handle(TDF_Data) DF;
1168 if (!DDF::GetDF(arg[1],DF)) return 1;
1170 if( !DDF::FindLabel(DF, arg[2], label) ) {
1171 di << "No label for entry" << "\n";
1175 Handle(TDataStd_ExtStringArray) A;
1176 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1177 di << "There is no TDataStd_ExtStringArray at label" << "\n";
1180 Standard_Integer indx = Draw::Atoi(arg[3]);
1181 TCollection_ExtendedString val(arg[4]);
1182 Standard_Integer low = A->Lower(), up = A->Upper();
1183 if(low <= indx && indx <= up)
1184 A->SetValue(indx, val);//TColStd_HArray1OfExtendedString
1186 Handle(TColStd_HArray1OfExtendedString) Arr = A->Array();
1187 Handle(TColStd_HArray1OfExtendedString) arr;
1191 arr = new TColStd_HArray1OfExtendedString(low, up);
1192 for(i=low; i<= Arr->Upper(); i++)
1193 arr->SetValue(i, Arr->Value(i));
1194 for(i=Arr->Upper()+1; i<= up; i++) {
1196 arr->SetValue(i, val);
1198 arr->SetValue(i, 0);
1200 } else if(indx < up) {//clip array : indx to be negative
1202 arr = new TColStd_HArray1OfExtendedString(low, up);
1203 for(i=low; i< up; i++)
1204 arr->SetValue(i, Arr->Value(i));
1205 arr->SetValue(up, val);
1207 A->ChangeArray(arr);
1211 di << "DDataStd_ChangeExtStringArray: Error" << "\n";
1216 //=======================================================================
1217 //function : DDataStd_KeepUTF
1218 //purpose : SetUTFName (DF, fatherEntry, fileName)
1219 //=======================================================================
1220 static Standard_Integer DDataStd_KeepUTF (Draw_Interpretor& di,
1221 Standard_Integer nb,
1225 Handle(TDF_Data) DF;
1226 if (!DDF::GetDF(arg[1],DF)) return 1;
1228 DDF::AddLabel(DF, arg[2], L);
1229 Standard_CString aFileName(arg[3]);
1232 ifstream anIS (aFileName, ios::in | ios::binary);
1234 ifstream anIS (aFileName);
1237 // Can not open file
1238 cout << "Error: can't open file " << aFileName <<endl;;
1243 anIS.getline(buf, 1023,'\n');
1244 // 0xEFBBBF - prefix of UTF8
1245 p = &buf[3]; //skip prefix
1246 TCollection_ExtendedString aES1(p, Standard_True);
1247 TDataStd_Name::Set(L.NewChild(), aES1);
1250 while (anIS.good() && !anIS.eof()) {
1251 anIS.getline(buf, 1023,'\n');
1252 TCollection_ExtendedString aES2(buf, Standard_True);
1253 const TDF_Label& aLab = L.NewChild();
1254 TDataStd_Name::Set(aLab, aES2);
1258 di << "SetUTFName : String is not kept in DF" << "\n";
1262 //=======================================================================
1263 //function : DDataStd_GetUTFtoFile
1264 //purpose : GetUTF (DF, fatherEntry, fileName)
1265 // : all strings from sub-labels of the <fatherEntry> concatenated
1266 // : in one, converted to UTF8 and kept in the file
1267 //=======================================================================
1268 static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di,
1269 Standard_Integer nb,
1273 Handle(TDF_Data) DF;
1274 if (!DDF::GetDF(arg[1],DF)) return 1;
1276 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
1278 TCollection_ExtendedString aES;
1279 Standard_Boolean aF = Standard_False;
1280 TDF_ChildIterator anIt(L);
1281 for(;anIt.More();anIt.Next()) {
1282 const TDF_Label& aLab = anIt.Value();
1283 if(!aLab.IsNull()) {
1284 Handle(TDataStd_Name) anAtt;
1285 if(aLab.FindAttribute(TDataStd_Name::GetID(), anAtt)) {
1286 if(anAtt->Get().Length()) {
1297 cout << "Data is not found in the Document" <<endl;
1301 Standard_CString aFileName(arg[3]);
1304 ofstream anOS (aFileName, ios::in | ios::binary | ios::ate);
1306 ofstream anOS (aFileName, ios::ate);
1309 // A problem with the stream
1311 cout << "Error: problem with the file stream, rdstate = " <<anOS.rdstate() <<endl;
1314 unsigned char prefix[4] = {0xEF,0xBB,0xBF, 0x00};
1315 anOS.write( (char*)&prefix[0], 3);
1316 Standard_Integer n = aES.LengthOfCString();
1317 Standard_PCharacter aCstr = (Standard_PCharacter) Standard::Allocate(n+1);
1318 n = aES.ToUTF8CString(aCstr);
1319 anOS.write( (char*)&aCstr[0], n);
1323 di << "GetUTF : Data is not extracted to the specified file " <<"\n";
1327 //=======================================================================
1328 //function : SetByteArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )
1329 //=======================================================================
1330 static Standard_Integer DDataStd_SetByteArray (Draw_Interpretor& di,
1331 Standard_Integer nb,
1335 Handle(TDF_Data) DF;
1336 if (!DDF::GetDF(arg[1],DF)) return 1;
1338 DDF::AddLabel(DF, arg[2], label);
1339 Standard_Integer isDelta = Draw::Atoi(arg[3]);
1340 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1341 di << "Array of Standard_Byte with bounds from = " << From << " to = " << To << "\n";
1342 Handle(TDataStd_ByteArray) A = TDataStd_ByteArray::Set(label, From, To, isDelta);
1346 for(Standard_Integer i = From; i<=To; ++i) {
1347 Standard_Integer ival = Draw::Atoi(arg[j]);
1348 if(ival < 0 || 255 < ival) {
1349 cout << "Bad value = " << ival<< endl;
1352 A->SetValue(i, (Standard_Byte)ival);
1358 di << "DDataStd_SetByteArray: Error" << "\n";
1362 //=======================================================================
1363 //function : SetByteArrayValue (DF, entry, index, value)
1364 //=======================================================================
1365 static Standard_Integer DDataStd_SetByteArrayValue (Draw_Interpretor&,
1370 Handle(TDF_Data) DF;
1371 if (!DDF::GetDF(arg[1], DF))
1376 if (!DDF::AddLabel(DF, arg[2], label))
1379 // Get index and value.
1380 Standard_Integer index = Draw::Atoi(arg[3]);
1381 Standard_Integer value = Draw::Atoi(arg[4]);
1384 if(value < 0 || 255 < value) {
1385 cout << "Bad value = " << value << endl;
1390 Handle(TDataStd_ByteArray) arr;
1391 if (label.FindAttribute(TDataStd_ByteArray::GetID(), arr))
1393 arr->SetValue(index, (Standard_Byte) value);
1400 //=======================================================================
1401 //function : SetBooleanArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )
1402 //=======================================================================
1403 static Standard_Integer DDataStd_SetBooleanArray (Draw_Interpretor& di,
1404 Standard_Integer nb,
1409 Handle(TDF_Data) DF;
1410 if (!DDF::GetDF(arg[1],DF))
1414 DDF::AddLabel(DF, arg[2], label);
1415 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
1416 di << "Array of Standard_Boolean with bounds from = " << From << " to = " << To << "\n";
1417 Handle(TDataStd_BooleanArray) A = TDataStd_BooleanArray::Set(label, From, To);
1421 for(Standard_Integer i = From; i<=To; i++)
1423 Standard_Integer ival = Draw::Atoi(arg[j]);
1426 cout << "Bad value = " << ival<< ". 0 or 1 is expected." << endl;
1429 A->SetValue(i, (Standard_Boolean)ival);
1435 di << "DDataStd_SetBooleanArray: Error" << "\n";
1439 //=======================================================================
1440 //function : SetBooleanArrayValue (DF, entry, index, value)
1441 //=======================================================================
1442 static Standard_Integer DDataStd_SetBooleanArrayValue (Draw_Interpretor& di,
1447 Handle(TDF_Data) DF;
1448 if (!DDF::GetDF(arg[1], DF))
1453 if (!DDF::AddLabel(DF, arg[2], label))
1456 // Get index and value.
1457 Standard_Integer index = Draw::Atoi(arg[3]);
1458 Standard_Integer value = Draw::Atoi(arg[4]);
1461 if (value != 0 && value != 1) {
1462 di << "DDataStd_SetBooleanArrayValue: Error! The value should be either 0 or 1." << "\n";
1467 Handle(TDataStd_BooleanArray) arr;
1468 if (label.FindAttribute(TDataStd_BooleanArray::GetID(), arr))
1470 arr->SetValue(index, (Standard_Boolean) value);
1477 //=======================================================================
1478 //function : SetBooleanList (DF, entry, elmt1, elmt2, ... )
1479 //=======================================================================
1480 static Standard_Integer DDataStd_SetBooleanList (Draw_Interpretor& di,
1481 Standard_Integer nb,
1486 Handle(TDF_Data) DF;
1487 if (!DDF::GetDF(arg[1],DF))
1491 DDF::AddLabel(DF, arg[2], label);
1492 Handle(TDataStd_BooleanList) A = TDataStd_BooleanList::Set(label);
1493 for(Standard_Integer i = 3; i <= nb - 1; i++)
1495 Standard_Integer ival = Draw::Atoi(arg[i]);
1498 cout << "Bad value = " << ival<< ". 0 or 1 is expected." << endl;
1501 A->Append((Standard_Boolean)ival);
1505 di << "DDataStd_SetBooleanList: Error" << "\n";
1509 //=======================================================================
1510 //function : SetIntegerList (DF, entry, elmt1, elmt2, ... )
1511 //=======================================================================
1512 static Standard_Integer DDataStd_SetIntegerList (Draw_Interpretor& di,
1513 Standard_Integer nb,
1518 Handle(TDF_Data) DF;
1519 if (!DDF::GetDF(arg[1],DF))
1523 DDF::AddLabel(DF, arg[2], label);
1524 Handle(TDataStd_IntegerList) A = TDataStd_IntegerList::Set(label);
1525 for(Standard_Integer i = 3; i <= nb - 1; i++)
1527 Standard_Integer ival = Draw::Atoi(arg[i]);
1532 di << "DDataStd_SetIntegerList: Error" << "\n";
1536 //=======================================================================
1537 //function : SetRealList (DF, entry, elmt1, elmt2, ... )
1538 //=======================================================================
1539 static Standard_Integer DDataStd_SetRealList (Draw_Interpretor& di,
1540 Standard_Integer nb,
1545 Handle(TDF_Data) DF;
1546 if (!DDF::GetDF(arg[1],DF))
1550 DDF::AddLabel(DF, arg[2], label);
1551 Handle(TDataStd_RealList) A = TDataStd_RealList::Set(label);
1552 for(Standard_Integer i = 3; i <= nb - 1; i++)
1554 Standard_Real fval = Draw::Atof(arg[i]);
1559 di << "DDataStd_SetRealList: Error" << "\n";
1563 //=======================================================================
1564 //function : GetByteArray (DF, entry )
1565 //=======================================================================
1566 static Standard_Integer DDataStd_GetByteArray (Draw_Interpretor& di,
1572 Handle(TDF_Data) DF;
1573 if (!DDF::GetDF(arg[1],DF)) return 1;
1575 if( !DDF::FindLabel(DF, arg[2], label) ) {
1576 di << "No label for entry" << "\n";
1580 Handle(TDataStd_ByteArray) A;
1581 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
1582 di << "There is no TDataStd_ByteArray at label" << "\n";
1586 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
1587 //cout << A->Value(i) << endl;
1596 //=======================================================================
1597 //function : GetByteArrayValue (DF, entry, index)
1598 //=======================================================================
1599 static Standard_Integer DDataStd_GetByteArrayValue (Draw_Interpretor& di,
1603 Handle(TDF_Data) DF;
1604 if (!DDF::GetDF(arg[1],DF))
1608 if (!DDF::FindLabel(DF, arg[2], label)) {
1609 di << "No label for entry" << "\n";
1613 Handle(TDataStd_ByteArray) A;
1614 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
1615 di << "There is no TDataStd_ByteArray under label" << "\n";
1619 Standard_Integer index = Draw::Atoi(arg[3]);
1620 if (index < A->Lower() || index > A->Upper()) {
1621 di << "Index is out of range" << "\n";
1624 di << A->Value(index) << "\n";
1630 //=======================================================================
1631 //function : GetBooleanArray (DF, entry )
1632 //=======================================================================
1633 static Standard_Integer DDataStd_GetBooleanArray (Draw_Interpretor& di,
1637 Handle(TDF_Data) DF;
1638 if (!DDF::GetDF(arg[1],DF))
1642 if ( !DDF::FindLabel(DF, arg[2], label) )
1644 di << "No label for entry" << "\n";
1648 Handle(TDataStd_BooleanArray) A;
1649 if ( !label.FindAttribute(TDataStd_BooleanArray::GetID(), A) )
1651 di << "There is no TDataStd_BooleanArray at label" << "\n";
1655 for (Standard_Integer i = A->Lower(); i<=A->Upper(); i++)
1657 di << (Standard_Integer) A->Value(i);
1665 //=======================================================================
1666 //function : GetBooleanArrayValue (DF, entry, index)
1667 //=======================================================================
1668 static Standard_Integer DDataStd_GetBooleanArrayValue (Draw_Interpretor& di,
1672 Handle(TDF_Data) DF;
1673 if (!DDF::GetDF(arg[1],DF))
1677 if (!DDF::FindLabel(DF, arg[2], label)) {
1678 di << "No label for entry" << "\n";
1682 Handle(TDataStd_BooleanArray) A;
1683 if ( !label.FindAttribute(TDataStd_BooleanArray::GetID(), A) ) {
1684 di << "There is no TDataStd_BooleanArray under label" << "\n";
1688 Standard_Integer index = Draw::Atoi(arg[3]);
1689 if (index < A->Lower() || index > A->Upper()) {
1690 di << "Index is out of range" << "\n";
1693 di << ((A->Value(index) == Standard_True) ? "True" : "False") << "\n";
1699 //=======================================================================
1700 //function : ChangeByteArray (DF, entry, indx, val )
1701 //=======================================================================
1702 static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di,
1703 Standard_Integer nb,
1708 Handle(TDF_Data) DF;
1709 if (!DDF::GetDF(arg[1],DF)) return 1;
1711 if( !DDF::FindLabel(DF, arg[2], label) ) {
1712 di << "No label for entry" << "\n";
1716 Handle(TDataStd_ByteArray) A;
1717 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
1718 di << "There is no TDataStd_ByteArray at label" << "\n";
1721 Standard_Integer indx = Draw::Atoi(arg[3]);
1722 Standard_Integer ival = Draw::Atoi(arg[4]);
1723 if (ival > 255 || ival < 0) {
1724 di << "DDataStd_ChangeByteArray: Bad value = " <<ival << "\n";
1727 Standard_Integer low = A->Lower(), up = A->Upper();
1728 if(low <= indx && indx <= up)
1729 A->SetValue(indx, (Standard_Byte)ival);
1731 Handle(TColStd_HArray1OfByte) Arr = A->InternalArray();
1732 Handle(TColStd_HArray1OfByte) arr;
1736 arr = new TColStd_HArray1OfByte(low, up);
1737 for(i=low; i<= Arr->Upper(); i++)
1738 arr->SetValue(i, Arr->Value(i));
1739 for(i=Arr->Upper()+1; i<= up; i++) {
1741 arr->SetValue(i, (Standard_Byte)ival);
1743 arr->SetValue(i, 0);
1745 } else if(indx < up) {//clip array : indx to be negative
1747 arr = new TColStd_HArray1OfByte(low, up);
1748 for(i=low; i< up; i++)
1749 arr->SetValue(i, Arr->Value(i));
1750 arr->SetValue(up, (Standard_Byte)ival);
1752 A->ChangeArray(arr);
1756 di << "DDataStd_ChangeByteArray: Error" << "\n";
1760 //=======================================================================
1761 //function : GetBooleanList (DF, entry )
1762 //=======================================================================
1763 static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
1767 Handle(TDF_Data) DF;
1768 if (!DDF::GetDF(arg[1],DF))
1772 if ( !DDF::FindLabel(DF, arg[2], label) )
1774 di << "No label for entry" << "\n";
1778 Handle(TDataStd_BooleanList) A;
1779 if ( !label.FindAttribute(TDataStd_BooleanList::GetID(), A) )
1781 di << "There is no TDataStd_BooleanList at label" << "\n";
1785 const TDataStd_ListOfByte& bList = A->List();
1786 TDataStd_ListIteratorOfListOfByte itr(bList);
1787 for (; itr.More(); itr.Next())
1789 di << (Standard_Integer) itr.Value() << " ";
1795 //=======================================================================
1796 //function : GetIntegerList (DF, entry )
1797 //=======================================================================
1798 static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
1802 Handle(TDF_Data) DF;
1803 if (!DDF::GetDF(arg[1],DF))
1807 if ( !DDF::FindLabel(DF, arg[2], label) )
1809 di << "No label for entry" << "\n";
1813 Handle(TDataStd_IntegerList) A;
1814 if ( !label.FindAttribute(TDataStd_IntegerList::GetID(), A) )
1816 di << "There is no TDataStd_IntegerList at label" << "\n";
1820 const TColStd_ListOfInteger& iList = A->List();
1821 TColStd_ListIteratorOfListOfInteger itr(iList);
1822 for (; itr.More(); itr.Next())
1824 di << itr.Value() << " ";
1830 //=======================================================================
1831 //function : GetRealList (DF, entry )
1832 //=======================================================================
1833 static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
1837 Handle(TDF_Data) DF;
1838 if (!DDF::GetDF(arg[1],DF))
1842 if ( !DDF::FindLabel(DF, arg[2], label) )
1844 di << "No label for entry" << "\n";
1848 Handle(TDataStd_RealList) A;
1849 if ( !label.FindAttribute(TDataStd_RealList::GetID(), A) )
1851 di << "There is no TDataStd_RealList at label" << "\n";
1855 const TColStd_ListOfReal& iList = A->List();
1856 TColStd_ListIteratorOfListOfReal itr(iList);
1857 for (; itr.More(); itr.Next())
1859 di << itr.Value() << " ";
1865 //=======================================================================
1866 //function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
1867 //=======================================================================
1869 static Standard_Integer DDataStd_SetIntPackedMap (Draw_Interpretor& di,
1870 Standard_Integer nb,
1875 Handle(TDF_Data) DF;
1876 if (!DDF::GetDF(arg[1],DF)) return 1;
1878 DDF::AddLabel(DF, arg[2], aLabel);
1879 Standard_Integer isDelta = Draw::Atoi(arg[3]);
1880 Standard_Integer aNum = nb - 4;
1881 Handle(TDataStd_IntPackedMap) anAtt;
1882 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
1883 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
1884 if(anAtt.IsNull()) {
1885 di << "IntPackedMap attribute is not found or not set" << "\n";
1888 Standard_Integer j = 4;
1889 TColStd_PackedMapOfInteger aMap;
1890 for(Standard_Integer i = 1; i<=aNum; i++) {
1891 aMap.Add (Draw::Atoi(arg[j]));
1894 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
1895 anAtt->ChangeMap(aHMap);
1896 cout << "Map extent = " << anAtt->Extent()<<endl;
1899 di << "DDataStd_SetIntPackedMap : Error" << "\n";
1903 //=======================================================================
1904 //function : GetIntPackedMap (DF, entry )
1905 //=======================================================================
1907 static Standard_Integer DDataStd_GetIntPackedMap (Draw_Interpretor& di,
1908 Standard_Integer nb,
1913 Handle(TDF_Data) DF;
1914 if (!DDF::GetDF(arg[1],DF)) return 1;
1916 DDF::AddLabel(DF, arg[2], aLabel);
1917 Handle(TDataStd_IntPackedMap) anAtt;
1918 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt)) {
1919 di << "IntPackedMap attribute is not found or not set" << "\n";
1922 const TColStd_PackedMapOfInteger& aMap = anAtt->GetMap();
1923 TColStd_MapIteratorOfPackedMapOfInteger itr(aMap);
1924 for (Standard_Integer j = 1; itr.More(); itr.Next(),j++){
1925 Standard_Integer aKey(itr.Key());
1930 di << "DDataStd_GetIntPackedMap : Error" << "\n";
1935 //=======================================================================
1936 //function : ChangeIntPackedMap_Add (DF, entry, Key1, Key2,... )
1937 //=======================================================================
1938 static Standard_Integer DDataStd_ChangeIntPackedMap_Add (Draw_Interpretor& di,
1939 Standard_Integer nb,
1944 Handle(TDF_Data) DF;
1945 if (!DDF::GetDF(arg[1],DF)) return 1;
1947 if( !DDF::FindLabel(DF, arg[2], label) ) {
1948 di << "No label for entry" << "\n";
1952 Handle(TDataStd_IntPackedMap) A;
1953 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
1954 di << "There is no TDataStd_IntPackedMap at label" << "\n";
1958 Standard_Integer i, aNum = nb - 3;
1959 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
1960 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
1961 if(!aHMap.IsNull()) {
1962 ahMap->ChangeMap().Assign(aHMap->Map());
1963 for(i=1; i<=aNum;i++) {
1964 Standard_Integer val = Draw::Atoi(arg[i+2]);
1965 if(!ahMap->Map().Contains(val))
1966 ahMap->ChangeMap().Add(val);
1969 A->ChangeMap(ahMap);
1973 di << "DDataStd_ChangeIntPackedMap_Add: Error" << "\n";
1978 //=======================================================================
1979 //function : ChangeIntPackedMap_Rem (DF, entry, Key1, Key2,... )
1980 //=======================================================================
1981 static Standard_Integer DDataStd_ChangeIntPackedMap_Rem (Draw_Interpretor& di,
1982 Standard_Integer nb,
1987 Handle(TDF_Data) DF;
1988 if (!DDF::GetDF(arg[1],DF)) return 1;
1990 if( !DDF::FindLabel(DF, arg[2], label) ) {
1991 di << "No label for entry" << "\n";
1995 Handle(TDataStd_IntPackedMap) A;
1996 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
1997 di << "There is no TDataStd_IntPackedMap at label" << "\n";
2001 Standard_Integer i, aNum = nb - 3;
2002 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
2003 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
2004 if(!aHMap.IsNull()) {
2005 ahMap->ChangeMap().Assign(aHMap->Map());
2006 for(i=1; i<=aNum;i++) {
2007 Standard_Integer val = Draw::Atoi(arg[i+2]);
2008 if(ahMap->Map().Contains(val))
2009 ahMap->ChangeMap().Remove(val);
2012 A->ChangeMap(ahMap);
2016 di << "DDataStd_ChangeIntPackedMap_Rem: Error" << "\n";
2020 //=======================================================================
2021 //function : ChangeIntPackedMap_AddRem (DF, entry, Key1, Key2,... )
2022 // : if Keyi exist in map - remove it, if no - add
2023 //=======================================================================
2024 static Standard_Integer DDataStd_ChangeIntPackedMap_AddRem (Draw_Interpretor& di,
2025 Standard_Integer nb,
2030 Handle(TDF_Data) DF;
2031 if (!DDF::GetDF(arg[1],DF)) return 1;
2033 if( !DDF::FindLabel(DF, arg[2], label) ) {
2034 di << "No label for entry" << "\n";
2038 Handle(TDataStd_IntPackedMap) A;
2039 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
2040 di << "There is no TDataStd_IntPackedMap at label" << "\n";
2044 Standard_Integer i, aNum = nb - 3;
2045 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
2046 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
2047 if(!aHMap.IsNull()) {
2048 ahMap->ChangeMap().Assign(aHMap->Map());
2049 for(i=1; i<=aNum;i++) {
2050 Standard_Integer val = Draw::Atoi(arg[i+2]);
2051 if(!ahMap->Map().Contains(val))
2052 ahMap->ChangeMap().Add(val);
2054 ahMap->ChangeMap().Remove(val);
2057 A->ChangeMap(ahMap);
2061 di << "DDataStd_ChangeIntPackedMap_AddRem: Error" << "\n";
2065 //=======================================================================
2066 //function : SetIntPHugeMap (DF, entry, isDelta Num)
2067 //=======================================================================
2069 static Standard_Integer DDataStd_SetIntPHugeMap (Draw_Interpretor& di,
2070 Standard_Integer nb,
2075 Handle(TDF_Data) DF;
2076 if (!DDF::GetDF(arg[1],DF)) return 1;
2078 DDF::AddLabel(DF, arg[2], aLabel);
2079 Standard_Integer isDelta = Draw::Atoi(arg[3]);
2080 Standard_Integer aNum = Draw::Atoi(arg[4]);
2081 Handle(TDataStd_IntPackedMap) anAtt;
2082 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
2083 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
2084 if(anAtt.IsNull()) {
2085 di << "IntPackedMap attribute is not found or not set" << "\n";
2088 TColStd_PackedMapOfInteger aMap;
2089 for(Standard_Integer i = 1; i<=aNum; i++) {
2092 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
2093 anAtt->ChangeMap(aHMap);
2094 cout << "Map extent = " << anAtt->Extent()<<endl;
2097 di << "DDataStd_SetIntPHugeMap : Error" << "\n";
2101 //=======================================================================
2102 //function : SetNDataIntegers (DF, entry , Num
2103 //=======================================================================
2105 static Standard_Integer DDataStd_SetNDataIntegers2 (Draw_Interpretor& di,
2106 Standard_Integer nb,
2111 Handle(TDF_Data) DF;
2112 if (!DDF::GetDF(arg[1],DF)) return 1;
2114 DDF::AddLabel(DF, arg[2], aLabel);
2115 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2116 Handle(TDataStd_NamedData) anAtt;
2117 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2118 anAtt = TDataStd_NamedData::Set(aLabel);
2119 if(anAtt.IsNull()) {
2120 di << "NamedData attribute is not found or not set" << "\n";
2124 TCollection_ExtendedString aKey("Key_");
2125 for(Standard_Integer i = 1; i<=aNumP; i++) {
2126 TCollection_ExtendedString key = aKey + i;
2127 Standard_Integer aVal = j+i;
2128 anAtt->SetInteger(key, aVal);
2133 di << "DDataStd_SetNDataIntegers2 : Error" << "\n";
2137 //=======================================================================
2138 //function : SetNDataIntArrays2 (DF, entry , key, NumOfArElem )
2139 //=======================================================================
2141 static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di,
2142 Standard_Integer nb,
2147 Handle(TDF_Data) DF;
2148 if (!DDF::GetDF(arg[1],DF)) return 1;
2150 DDF::AddLabel(DF, arg[2], aLabel);
2153 TCollection_ExtendedString aKey(arg[3]);
2154 Standard_Integer aNum = Draw::Atoi(arg[4]);
2155 if (aNum <= 0) return 1;
2156 Handle(TDataStd_NamedData) anAtt;
2157 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2158 anAtt = TDataStd_NamedData::Set(aLabel);
2159 if(anAtt.IsNull()) {
2160 cout<< "NamedData attribute is not found or not set" << endl;
2164 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
2165 for(Standard_Integer i = 1; i<=aNum; i++) {
2166 Standard_Integer aVal = j++;
2167 anArr->SetValue(i, aVal);
2170 anAtt->SetArrayOfIntegers(aKey, anArr);
2173 di << "DDataStd_SetNDataIntArrays2 : Error" << "\n";
2178 //=======================================================================
2179 //function : SetAsciiString(DF, entry , String)
2180 //=======================================================================
2182 static Standard_Integer DDataStd_SetAsciiString (Draw_Interpretor& di,
2183 Standard_Integer nb,
2188 Handle(TDF_Data) DF;
2189 if (!DDF::GetDF(arg[1],DF)) return 1;
2191 DDF::AddLabel(DF, arg[2], aLabel);
2192 TCollection_AsciiString aString(arg[3]);
2193 Handle(TDataStd_AsciiString) anAtt;
2194 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2195 anAtt = TDataStd_AsciiString::Set(aLabel, aString);
2196 if(anAtt.IsNull()) {
2197 di << "AsciiString attribute is not found or not set" << "\n";
2200 // anAtt->Set(aString);
2201 cout << "String = " << anAtt->Get().ToCString() << " is kept in DF" << endl;
2204 di << "DDataStd_SetAsciiString : Error" << "\n";
2208 //=======================================================================
2209 //function : GetAsciiString(DF, entry )
2210 //=======================================================================
2212 static Standard_Integer DDataStd_GetAsciiString (Draw_Interpretor& di,
2213 Standard_Integer nb,
2218 Handle(TDF_Data) DF;
2219 if (!DDF::GetDF(arg[1],DF)) return 1;
2221 DDF::AddLabel(DF, arg[2], aLabel);
2222 Handle(TDataStd_AsciiString) anAtt;
2223 if(!aLabel.FindAttribute(TDataStd_AsciiString::GetID(), anAtt)) {
2224 cout << "AsciiString attribute is not found or not set" << endl;
2227 cout << "String = " <<anAtt->Get().ToCString() << endl;
2230 di << "DDataStd_GetAsciiString : Error" << "\n";
2234 //=======================================================================
2235 //function : SetNDataIntegers (DF, entry , Num, key1, val1, ...
2236 //=======================================================================
2238 static Standard_Integer DDataStd_SetNDataIntegers (Draw_Interpretor& di,
2239 Standard_Integer nb,
2244 Handle(TDF_Data) DF;
2245 if (!DDF::GetDF(arg[1],DF)) return 1;
2247 DDF::AddLabel(DF, arg[2], aLabel);
2249 // TCollection_ExtendedString aString("123456789 0_abcde");
2250 // Standard_Integer aPos = aString.Search(" ");
2251 // cout << "From Start = " <<aPos<<endl;
2252 // aPos = aString.SearchFromEnd(" ");
2253 // cout << "From Start = " <<aPos<<endl;
2254 // TCollection_ExtendedString aValue = aString.Split(aPos);
2255 // cout << "Value = |"<<aValue<<endl;
2256 // cout << "aKey = " << aString << "|"<<endl;
2258 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2259 Handle(TDataStd_NamedData) anAtt;
2260 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2261 anAtt = TDataStd_NamedData::Set(aLabel);
2262 if(anAtt.IsNull()) {
2263 di << "NamedData attribute is not found or not set" << "\n";
2267 for(Standard_Integer i = 1; i<=aNumP; i++) {
2268 TCollection_ExtendedString aKey(arg[j]);
2269 Standard_Integer aVal = Draw::Atoi(arg[j+1]);
2270 anAtt->SetInteger(aKey, aVal);
2275 di << "DDataStd_SetNDataIntegers : Error" << "\n";
2280 //=======================================================================
2281 //function : GetNDIntegers(DF, entry )
2282 //=======================================================================
2283 static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
2284 Standard_Integer nb,
2289 Handle(TDF_Data) DF;
2290 if (!DDF::GetDF(arg[1],DF)) return 1;
2292 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2295 Handle(TDataStd_NamedData) anAtt;
2296 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2297 cout << "NamedData attribute is not found or not set" << endl;
2300 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2301 const TColStd_DataMapOfStringInteger& aMap = anAtt->GetIntegersContainer();
2302 TColStd_DataMapIteratorOfDataMapOfStringInteger itr(aMap);
2303 for (; itr.More(); itr.Next()){
2304 TCollection_ExtendedString aKey(itr.Key());
2305 TCollection_AsciiString aStr(aKey,'?');
2306 Standard_Integer aValue = itr.Value();
2307 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;;
2312 di << "DDataStd_GetNDIntegers : Error" << "\n";
2316 //=======================================================================
2317 //function : GetNDInteger(DF, entry, key [drawname])
2318 //=======================================================================
2319 static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
2320 Standard_Integer nb,
2325 Handle(TDF_Data) DF;
2326 if (!DDF::GetDF(arg[1],DF)) return 1;
2328 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2331 Handle(TDataStd_NamedData) anAtt;
2332 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2333 cout << "NamedData attribute is not found or not set" << endl;
2337 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2338 if(!anAtt->HasInteger(arg[3])) {
2339 cout << "There is no data specified by Key = "<< arg[3] << endl;
2342 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<endl;
2344 Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
2348 di << "DDataStd_SetNDataIntegers : Error" << "\n";
2352 //========================== REALS ======================================
2353 //=======================================================================
2354 //function : SetNDataReals (DF, entry , Num, key1, val1, ...
2355 //=======================================================================
2357 static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di,
2358 Standard_Integer nb,
2363 Handle(TDF_Data) DF;
2364 if (!DDF::GetDF(arg[1],DF)) return 1;
2366 DDF::AddLabel(DF, arg[2], aLabel);
2368 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2369 Handle(TDataStd_NamedData) anAtt;
2370 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2371 anAtt = TDataStd_NamedData::Set(aLabel);
2372 if(anAtt.IsNull()) {
2373 cout << "NamedData attribute is not found or not set" << endl;;
2377 for(Standard_Integer i = 1; i<=aNumP; i++) {
2378 TCollection_ExtendedString aKey(arg[j]);
2379 Standard_Real aVal = Draw::Atof(arg[j+1]);
2380 anAtt->SetReal(aKey, aVal);
2385 di << "DDataStd_SetNDataReals : Error" << "\n";
2389 //=======================================================================
2390 //function : GetNDReals(DF, entry )
2391 //=======================================================================
2392 static Standard_Integer DDataStd_GetNDReals (Draw_Interpretor& di,
2393 Standard_Integer nb,
2398 Handle(TDF_Data) DF;
2399 if (!DDF::GetDF(arg[1],DF)) return 1;
2401 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2404 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2405 Handle(TDataStd_NamedData) anAtt;
2406 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2407 cout << "NamedData attribute is not found or not set" << endl;
2410 const TDataStd_DataMapOfStringReal& aMap = anAtt->GetRealsContainer();
2411 TDataStd_DataMapIteratorOfDataMapOfStringReal itr(aMap);
2412 for (; itr.More(); itr.Next()){
2413 TCollection_ExtendedString aKey(itr.Key());
2414 TCollection_AsciiString aStr(aKey,'?');
2415 Standard_Real aValue = itr.Value();
2416 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
2420 di << "DDataStd_GetNDReals : Error" << "\n";
2424 //=======================================================================
2425 //function : GetNDReal(DF, entry, key [drawname])
2426 //=======================================================================
2427 static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
2428 Standard_Integer nb,
2433 Handle(TDF_Data) DF;
2434 if (!DDF::GetDF(arg[1],DF)) return 1;
2436 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2439 Handle(TDataStd_NamedData) anAtt;
2440 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2441 cout << "NamedData attribute is not found or not set" << endl;
2445 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2446 if(!anAtt->HasReal(arg[3])) {
2447 cout << "There is no data specified by Key = "<< arg[3] << endl;
2450 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<endl;
2452 Draw::Set(arg[4], anAtt->GetReal(arg[3]));
2456 di << "DDataStd_GetNDReal : Error" << "\n";
2460 //======================= Strings =======================================
2461 //=======================================================================
2462 //function : SetNDataStrings (DF, entry , Num, key1, val1, ...
2463 //=======================================================================
2465 static Standard_Integer DDataStd_SetNDataStrings (Draw_Interpretor& di,
2466 Standard_Integer nb,
2471 Handle(TDF_Data) DF;
2472 if (!DDF::GetDF(arg[1],DF)) return 1;
2474 DDF::AddLabel(DF, arg[2], aLabel);
2476 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2477 Handle(TDataStd_NamedData) anAtt;
2478 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2479 anAtt = TDataStd_NamedData::Set(aLabel);
2480 if(anAtt.IsNull()) {
2481 di << "NamedData attribute is not found or not set" << "\n";
2485 for(Standard_Integer i = 1; i<=aNumP; i++) {
2486 TCollection_ExtendedString aKey(arg[j]);
2487 TCollection_ExtendedString aVal(arg[j+1]);
2488 anAtt->SetString(aKey, aVal);
2493 di << "DDataStd_SetNDataStrings : Error" << "\n";
2497 //=======================================================================
2498 //function : GetNDStrings(DF, entry )
2499 //=======================================================================
2500 static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
2501 Standard_Integer nb,
2506 Handle(TDF_Data) DF;
2507 if (!DDF::GetDF(arg[1],DF)) return 1;
2509 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2512 Handle(TDataStd_NamedData) anAtt;
2513 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2514 cout << "NamedData attribute is not found or not set" << endl;
2517 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2518 const TDataStd_DataMapOfStringString& aMap = anAtt->GetStringsContainer();
2519 TDataStd_DataMapIteratorOfDataMapOfStringString itr(aMap);
2520 for (; itr.More(); itr.Next()){
2521 TCollection_ExtendedString aKey(itr.Key());
2522 TCollection_AsciiString aStr(aKey,'?');
2523 TCollection_ExtendedString aVal(itr.Value());
2524 TCollection_AsciiString aStrValue(aVal,'?');
2525 cout << "Key = " << aStr.ToCString() << " Value = " <<aStrValue.ToCString()<< endl;
2529 di << "DDataStd_GetNDStrings : Error" << "\n";
2533 //=======================================================================
2534 //function : GetNDString(DF, entry, key [drawname])
2535 //=======================================================================
2536 static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
2537 Standard_Integer nb,
2542 Handle(TDF_Data) DF;
2543 if (!DDF::GetDF(arg[1],DF)) return 1;
2545 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2548 Handle(TDataStd_NamedData) anAtt;
2549 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2550 di << "NamedData attribute is not found or not set" << "\n";
2554 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2555 if(!anAtt->HasString(arg[3])) {
2556 cout << "There is no data specified by Key = "<< arg[3] << endl;
2559 TCollection_AsciiString aValue (anAtt->GetString(arg[3]), '?');
2560 cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << endl;
2562 Draw::Set(arg[4], aValue.ToCString());
2566 di << "DDataStd_GetNDString : Error" << "\n";
2570 //=========================== Bytes =====================================
2571 //=======================================================================
2572 //function : SetNDataBytes (DF, entry , Num, key1, val1, ...
2573 //=======================================================================
2575 static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di,
2576 Standard_Integer nb,
2581 Handle(TDF_Data) DF;
2582 if (!DDF::GetDF(arg[1],DF)) return 1;
2584 DDF::AddLabel(DF, arg[2], aLabel);
2586 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
2587 Handle(TDataStd_NamedData) anAtt;
2588 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2589 anAtt = TDataStd_NamedData::Set(aLabel);
2590 if(anAtt.IsNull()) {
2591 cout << "NamedData attribute is not found or not set" << endl;
2595 for(Standard_Integer i = 1; i<=aNumP; i++) {
2596 TCollection_ExtendedString aKey(arg[j]);
2597 Standard_Byte aVal = (Standard_Byte)Draw::Atoi(arg[j+1]);
2598 anAtt->SetByte(aKey, aVal);
2603 di << "DDataStd_SetNDataBytes : Error" << "\n";
2607 //=======================================================================
2608 //function : GetNDBytes(DF, entry )
2609 //=======================================================================
2610 static Standard_Integer DDataStd_GetNDBytes (Draw_Interpretor& di,
2611 Standard_Integer nb,
2616 Handle(TDF_Data) DF;
2617 if (!DDF::GetDF(arg[1],DF)) return 1;
2619 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2622 Handle(TDataStd_NamedData) anAtt;
2623 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2624 cout << "NamedData attribute is not found or not set" << endl;
2627 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2628 const TDataStd_DataMapOfStringByte& aMap = anAtt->GetBytesContainer();
2629 TDataStd_DataMapIteratorOfDataMapOfStringByte itr(aMap);
2630 for (; itr.More(); itr.Next()){
2631 TCollection_ExtendedString aKey(itr.Key());
2632 TCollection_AsciiString aStr(aKey,'?');
2633 Standard_Byte aValue = itr.Value();
2634 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
2638 di << "DDataStd_GetNDBytes : Error" << "\n";
2642 //=======================================================================
2643 //function : GetNDByte(DF, entry, key [drawname])
2644 //=======================================================================
2645 static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
2646 Standard_Integer nb,
2651 Handle(TDF_Data) DF;
2652 if (!DDF::GetDF(arg[1],DF)) return 1;
2654 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2657 Handle(TDataStd_NamedData) anAtt;
2658 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2659 cout << "NamedData attribute is not found or not set" << endl;
2663 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2664 if(!anAtt->HasByte(arg[3])) {
2665 cout << "There is no data specified by Key = "<< arg[3] << endl;
2668 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< endl;
2670 Draw::Set(arg[4], anAtt->GetByte(arg[3]));
2674 di << "DDataStd_GetNDByte : Error" << "\n";
2677 //======================== IntArrays ====================================
2678 //=======================================================================
2679 //function : SetNDataIntArrays (DF, entry , key, NumOfArElem, val1, val2,... )
2680 //=======================================================================
2682 static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di,
2683 Standard_Integer nb,
2688 Handle(TDF_Data) DF;
2689 if (!DDF::GetDF(arg[1],DF)) return 1;
2691 DDF::AddLabel(DF, arg[2], aLabel);
2694 TCollection_ExtendedString aKey(arg[3]);
2695 Standard_Integer aNum = Draw::Atoi(arg[4]);
2696 if (aNum <= 0) return 1;
2697 Handle(TDataStd_NamedData) anAtt;
2698 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2699 anAtt = TDataStd_NamedData::Set(aLabel);
2700 if(anAtt.IsNull()) {
2701 cout<< "NamedData attribute is not found or not set" << endl;
2705 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
2706 for(Standard_Integer i = 1; i<=aNum; i++) {
2707 Standard_Integer aVal = Draw::Atoi(arg[j]);
2708 anArr->SetValue(i, aVal);
2711 anAtt->SetArrayOfIntegers(aKey, anArr);
2714 di << "DDataStd_SetNDataIntArrays : Error" << "\n";
2719 //=======================================================================
2720 //function : GetNDIntArrays(DF, entry )
2721 //=======================================================================
2722 static Standard_Integer DDataStd_GetNDIntArrays (Draw_Interpretor& di,
2723 Standard_Integer nb,
2728 Handle(TDF_Data) DF;
2729 if (!DDF::GetDF(arg[1],DF)) return 1;
2731 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2734 Handle(TDataStd_NamedData) anAtt;
2735 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2736 cout << "NamedData attribute is not found or not set" << endl;
2739 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2740 const TDataStd_DataMapOfStringHArray1OfInteger& aMap = anAtt->GetArraysOfIntegersContainer();
2741 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger itr(aMap);
2742 for (; itr.More(); itr.Next()){
2743 TCollection_ExtendedString aKey(itr.Key());
2744 TCollection_AsciiString aStr(aKey,'?');
2745 cout << "Key = " << aStr.ToCString()<< endl;
2746 Handle(TColStd_HArray1OfInteger) anArrValue = itr.Value();
2747 if(!anArrValue.IsNull()) {
2748 Standard_Integer lower = anArrValue->Lower();
2749 Standard_Integer upper = anArrValue->Upper();
2750 for(Standard_Integer i = lower; i<=upper;i++) {
2751 Standard_Integer aValue = anArrValue->Value(i);
2752 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2755 cout << "\tthe specified array is Null "<<endl;
2759 di << "DDataStd_GetNDIntArrays : Error" << "\n";
2763 //=======================================================================
2764 //function : GetNDIntArray(DF, entry, key )
2765 //=======================================================================
2766 static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
2767 Standard_Integer nb,
2772 Handle(TDF_Data) DF;
2773 if (!DDF::GetDF(arg[1],DF)) return 1;
2775 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2778 Handle(TDataStd_NamedData) anAtt;
2779 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2780 cout << "NamedData attribute is not found or not set" << endl;
2784 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2785 if(!anAtt->HasArrayOfIntegers(arg[3])) {
2786 cout << "There is no data specified by Key = "<< arg[3] << endl;
2789 cout << "Key = " << arg[3] <<endl;
2791 Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
2792 if(!anArrValue.IsNull()) {
2793 Standard_Integer lower = anArrValue->Lower();
2794 Standard_Integer upper = anArrValue->Upper();
2795 for(Standard_Integer i = lower; i<=upper;i++) {
2796 Standard_Integer aValue = anArrValue->Value(i);
2797 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2800 cout << "\tthe specified array is Null or not found"<<endl;
2804 di << "DDataStd_SetNDataIntArray : Error" << "\n";
2807 //============================= RealArrays ==============================
2808 //=======================================================================
2809 //function : SetNDataRealArrays (DF entry key NumOfArElem val1 val2... )
2810 //=======================================================================
2812 static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di,
2813 Standard_Integer nb,
2818 Handle(TDF_Data) DF;
2819 if (!DDF::GetDF(arg[1],DF)) return 1;
2821 DDF::AddLabel(DF, arg[2], aLabel);
2824 TCollection_ExtendedString aKey(arg[3]);
2825 Standard_Integer aNum = Draw::Atoi(arg[4]);
2826 if (aNum <= 0) return 1;
2827 Handle(TDataStd_NamedData) anAtt;
2828 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2829 anAtt = TDataStd_NamedData::Set(aLabel);
2830 if(anAtt.IsNull()) {
2831 cout << "NamedData attribute is not found or not set" << endl;
2835 Handle(TColStd_HArray1OfReal) anArr = new TColStd_HArray1OfReal(1, aNum);
2836 for(Standard_Integer i = 1; i<=aNum; i++) {
2837 Standard_Real aVal = Draw::Atof(arg[j]);
2838 anArr->SetValue(i, aVal);
2841 anAtt->SetArrayOfReals(aKey, anArr);
2844 di << "DDataStd_SetNDataRealArrays : Error" << "\n";
2849 //=======================================================================
2850 //function : GetNDRealArrays(DF, entry )
2851 //=======================================================================
2852 static Standard_Integer DDataStd_GetNDRealArrays (Draw_Interpretor& di,
2853 Standard_Integer nb,
2858 Handle(TDF_Data) DF;
2859 if (!DDF::GetDF(arg[1],DF)) return 1;
2861 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2864 Handle(TDataStd_NamedData) anAtt;
2865 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2866 cout << "NamedData attribute is not found or not set" << endl;
2869 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2870 const TDataStd_DataMapOfStringHArray1OfReal& aMap = anAtt->GetArraysOfRealsContainer();
2871 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal itr(aMap);
2872 for (; itr.More(); itr.Next()){
2873 TCollection_ExtendedString aKey(itr.Key());
2874 TCollection_AsciiString aStr(aKey,'?');
2875 cout << "Key = " << aStr.ToCString()<<endl;
2876 Handle(TColStd_HArray1OfReal) anArrValue = itr.Value();
2877 if(!anArrValue.IsNull()) {
2878 Standard_Integer lower = anArrValue->Lower();
2879 Standard_Integer upper = anArrValue->Upper();
2880 for(Standard_Integer i = lower; i<=upper;i++) {
2881 Standard_Real aValue = anArrValue->Value(i);
2882 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2885 cout << "\tthe specified array is Null "<<endl;
2889 di << "DDataStd_GetNDRealArrays : Error" << "\n";
2893 //=======================================================================
2894 //function : GetNDRealArray(DF, entry, key )
2895 //=======================================================================
2896 static Standard_Integer DDataStd_GetNDRealArray (Draw_Interpretor& di,
2897 Standard_Integer nb,
2902 Handle(TDF_Data) DF;
2903 if (!DDF::GetDF(arg[1],DF)) return 1;
2905 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2908 Handle(TDataStd_NamedData) anAtt;
2909 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2910 di << "NamedData attribute is not found or not set" << "\n";
2914 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2915 if(!anAtt->HasArrayOfReals(arg[3])) {
2916 cout << "There is no data specified by Key = "<< arg[3] << endl;
2919 cout << "Key = " << arg[3] <<endl;
2921 Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(arg[3]);
2922 if(!anArrValue.IsNull()) {
2923 Standard_Integer lower = anArrValue->Lower();
2924 Standard_Integer upper = anArrValue->Upper();
2925 for(Standard_Integer i = lower; i<=upper;i++) {
2926 Standard_Real aValue = anArrValue->Value(i);
2927 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2930 cout << "\tthe specified array is Null or not found"<<endl;
2934 di << "DDataStd_SetNDataRealArray : Error" << "\n";
2938 //=======================================================================
2939 //function : SetRefArray (DF, entry , From, To, elmt1, elmt2, ...
2940 //=======================================================================
2941 static Standard_Integer DDataStd_SetRefArray (Draw_Interpretor& di,
2942 Standard_Integer nb,
2945 Handle(TDF_Data) DF;
2946 if (!DDF::GetDF(arg[1],DF)) return 1;
2948 DDF::AddLabel(DF, arg[2], label);
2950 Standard_Integer From = Draw::Atoi(arg[3]), To = Draw::Atoi( arg[4] ), j;
2951 di << "RefArray with bounds from = " << From << " to = " << To << "\n";
2953 Handle(TDataStd_ReferenceArray) A = TDataStd_ReferenceArray::Set(label, From, To);
2957 for(Standard_Integer i = From; i<=To; i++) {
2958 TDF_Label aRefLabel;
2959 DDF::AddLabel(DF, arg[j], aRefLabel);
2960 A->SetValue(i, aRefLabel);
2967 //=======================================================================
2968 //function : SetRefArrayValue (DF, entry, index, value)
2969 //=======================================================================
2970 static Standard_Integer DDataStd_SetRefArrayValue (Draw_Interpretor&,
2975 Handle(TDF_Data) DF;
2976 if (!DDF::GetDF(arg[1], DF))
2981 if (!DDF::AddLabel(DF, arg[2], label))
2984 // Get index and value.
2985 Standard_Integer index = Draw::Atoi(arg[3]);
2988 Handle(TDataStd_ReferenceArray) arr;
2989 if (label.FindAttribute(TDataStd_ReferenceArray::GetID(), arr))
2991 TDF_Label aRefLabel;
2992 DDF::AddLabel(DF, arg[4], aRefLabel);
2993 arr->SetValue(index, aRefLabel);
3000 //=======================================================================
3001 //function : GetRefArray (DF, entry )
3002 //=======================================================================
3003 static Standard_Integer DDataStd_GetRefArray (Draw_Interpretor& di,
3008 Handle(TDF_Data) DF;
3009 if (!DDF::GetDF(arg[1],DF)) return 1;
3011 if( !DDF::FindLabel(DF, arg[2], label) ) {
3012 di << "No label for entry" << "\n";
3016 Handle(TDataStd_ReferenceArray) A;
3017 if ( !label.FindAttribute(TDataStd_ReferenceArray::GetID(), A) ) {
3018 di << "There is no TDataStd_ReferenceArray under label" << "\n";
3022 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
3023 const TDF_Label& aLabel = A->Value(i);
3024 TCollection_AsciiString entry;
3025 TDF_Tool::Entry(aLabel, entry);
3026 di << entry.ToCString();
3034 //=======================================================================
3035 //function : GetRefArrayValue (DF, entry, index)
3036 //=======================================================================
3037 static Standard_Integer DDataStd_GetRefArrayValue (Draw_Interpretor& di,
3041 Handle(TDF_Data) DF;
3042 if (!DDF::GetDF(arg[1],DF))
3046 if (!DDF::FindLabel(DF, arg[2], label)) {
3047 di << "No label for entry" << "\n";
3051 Handle(TDataStd_ReferenceArray) A;
3052 if ( !label.FindAttribute(TDataStd_ReferenceArray::GetID(), A) ) {
3053 di << "There is no TDataStd_ReferenceArray under label" << "\n";
3057 Standard_Integer index = Draw::Atoi(arg[3]);
3058 if (index < A->Lower() || index > A->Upper()) {
3059 di << "Index is out of range" << "\n";
3062 const TDF_Label& value = A->Value(index);
3063 TCollection_AsciiString entry;
3064 TDF_Tool::Entry(value, entry);
3065 di << entry.ToCString() << "\n";
3071 //=======================================================================
3072 //function : BasicCommands
3074 //=======================================================================
3076 void DDataStd::BasicCommands (Draw_Interpretor& theCommands)
3079 static Standard_Boolean done = Standard_False;
3081 done = Standard_True;
3083 const char* g = "DData : Standard Attribute Commands";
3088 theCommands.Add ("SetInteger",
3089 "SetInteger (DF, entry, value)",
3090 __FILE__, DDataStd_SetInteger, g);
3092 theCommands.Add ("SetIntArray",
3093 "SetIntArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3094 __FILE__, DDataStd_SetIntArray, g);
3096 theCommands.Add ("SetIntArrayValue",
3097 "SetIntArrayValue (DF, entry, index, value)",
3098 __FILE__, DDataStd_SetIntArrayValue, g);
3100 theCommands.Add ("SetReal",
3101 "SetReal (DF, entry, value)",
3102 __FILE__, DDataStd_SetReal, g);
3104 theCommands.Add ("SetRealArray",
3105 "SetRealArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3106 __FILE__, DDataStd_SetRealArray, g);
3108 theCommands.Add ("SetRealArrayValue",
3109 "SetRealArrayValue (DF, entry, index, value)",
3110 __FILE__, DDataStd_SetRealArrayValue, g);
3112 theCommands.Add ("SetByteArray",
3113 "SetByteArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3114 __FILE__, DDataStd_SetByteArray, g);
3116 theCommands.Add ("SetByteArrayValue",
3117 "SetByteArrayValue (DF, entry, index, value)",
3118 __FILE__, DDataStd_SetByteArrayValue, g);
3120 theCommands.Add ("SetExtStringArray",
3121 "SetExtStringArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3122 __FILE__, DDataStd_SetExtStringArray, g);
3124 theCommands.Add ("SetExtStringArrayValue",
3125 "SetExtStringArrayValue (DF, entry, index, value)",
3126 __FILE__, DDataStd_SetExtStringArrayValue, g);
3128 theCommands.Add ("SetRefArray",
3129 "SetRefArray (DF, entry, From, To, [lab1, lab2, ...])",
3130 __FILE__, DDataStd_SetRefArray, g);
3132 theCommands.Add ("SetRefArrayValue",
3133 "SetRefArrayValue (DF, entry, index, value)",
3134 __FILE__, DDataStd_SetRefArrayValue, g);
3136 theCommands.Add ("SetIntPackedMap",
3137 "SetIntPackedMap (DF, entry, isDelta, key1, key2, ... )",
3138 __FILE__, DDataStd_SetIntPackedMap, g);
3140 theCommands.Add ("SetReference",
3141 "SetReference (DF, entry, reference)",
3142 __FILE__, DDataStd_SetReference, g);
3144 theCommands.Add ("SetComment",
3145 "SetComment (DF, entry, comment)",
3146 __FILE__, DDataStd_SetComment, g);
3148 theCommands.Add ("SetUAttribute",
3149 "SetUAttribute (DF, entry, LocalID)",
3150 __FILE__, DDataStd_SetUAttribute, g);
3152 theCommands.Add ("SetVariable",
3153 "SetVariable (DF, entry, isConstant[0/1], units)",
3154 __FILE__, DDataStd_SetVariable, g);
3156 theCommands.Add ("SetAsciiString",
3157 "SetAsciiString (DF, entry, String )",
3158 __FILE__, DDataStd_SetAsciiString, g);
3160 theCommands.Add ("SetBooleanArray",
3161 "SetBooleanArray (DF, entry, isDelta, From, To, [elmt1, elmt2, ...])",
3162 __FILE__, DDataStd_SetBooleanArray, g);
3164 theCommands.Add ("SetBooleanArrayValue",
3165 "SetBooleanArrayValue (DF, entry, index, value)",
3166 __FILE__, DDataStd_SetBooleanArrayValue, g);
3168 theCommands.Add ("SetBooleanList",
3169 "SetBooleanList (DF, entry, elmt1, elmt2, ... )",
3170 __FILE__, DDataStd_SetBooleanList, g);
3172 theCommands.Add ("SetIntegerList",
3173 "SetIntegerList (DF, entry, elmt1, elmt2, ... )",
3174 __FILE__, DDataStd_SetIntegerList, g);
3176 theCommands.Add ("SetRealList",
3177 "SetRealList (DF, entry, elmt1, elmt2, ... )",
3178 __FILE__, DDataStd_SetRealList, g);
3183 theCommands.Add ("GetAsciiString",
3184 "GetAsciiString (DF, entry )",
3185 __FILE__, DDataStd_GetAsciiString, g);
3187 theCommands.Add ("GetInteger",
3188 "GetInteger (DF, entry, [drawname])",
3189 __FILE__, DDataStd_GetInteger, g);
3191 theCommands.Add ("GetIntArray",
3192 "GetIntArray (DF, entry )",
3193 __FILE__, DDataStd_GetIntArray, g);
3195 theCommands.Add ("GetIntArrayValue",
3196 "GetIntArrayValue (DF, entry, index)",
3197 __FILE__, DDataStd_GetIntArrayValue, g);
3199 theCommands.Add ("GetRealArray",
3200 "GetRealArray (DF, entry )",
3201 __FILE__, DDataStd_GetRealArray, g);
3203 theCommands.Add ("GetRealArrayValue",
3204 "GetRealArrayValue (DF, entry, index)",
3205 __FILE__, DDataStd_GetRealArrayValue, g);
3207 theCommands.Add ("GetByteArray",
3208 "GetByteArray (DF, entry )",
3209 __FILE__, DDataStd_GetByteArray, g);
3211 theCommands.Add ("GetByteArrayValue",
3212 "GetByteArrayValue (DF, entry, index)",
3213 __FILE__, DDataStd_GetByteArrayValue, g);
3215 theCommands.Add ("GetExtStringArray",
3216 "GetExtStringArray (DF, entry )",
3217 __FILE__, DDataStd_GetExtStringArray, g);
3219 theCommands.Add ("GetExtStringArrayValue",
3220 "GetExtStringArrayValue (DF, entry, index)",
3221 __FILE__, DDataStd_GetExtStringArrayValue, g);
3223 theCommands.Add ("GetRefArray",
3224 "GetRefArray (DF, entry )",
3225 __FILE__, DDataStd_GetRefArray, g);
3227 theCommands.Add ("GetRefArrayValue",
3228 "GetRefArrayValue (DF, entry, index)",
3229 __FILE__, DDataStd_GetRefArrayValue, g);
3231 theCommands.Add ("GetIntPackedMap",
3232 "GetIntPackedMap (DF, entry )",
3233 __FILE__, DDataStd_GetIntPackedMap, g);
3235 theCommands.Add ("GetReal",
3236 "GetReal (DF, entry, [drawname])",
3237 __FILE__, DDataStd_GetReal, g);
3239 theCommands.Add ("GetReference",
3240 "GetReference (DF, entry)",
3241 __FILE__, DDataStd_GetReference, g);
3244 theCommands.Add ("GetComment",
3245 "GetComment (DF, entry)",
3246 __FILE__, DDataStd_GetComment, g);
3248 theCommands.Add("Self",
3249 "Self(document, entry)",
3250 __FILE__, DDataStd_Self, g);
3252 theCommands.Add ("GetUAttribute",
3253 "GetUAttribute (DF, entry)",
3254 __FILE__, DDataStd_GetUAttribute, g);
3256 theCommands.Add ("GetVariable",
3257 "GetVariable (DF, entry, [isConstant], [units])",
3258 __FILE__, DDataStd_GetVariable, g);
3260 theCommands.Add ("SetRelation",
3261 "SetRelation (DF, entry, expression, var1[, var2, ...])",
3262 __FILE__, DDataStd_SetRelation, g);
3264 theCommands.Add ("DumpRelation",
3265 "DumpRelation (DF, entry)",
3266 __FILE__, DDataStd_DumpRelation, g);
3268 theCommands.Add ("GetBooleanArray",
3269 "GetBooleanArray (DF, entry )",
3270 __FILE__, DDataStd_GetBooleanArray, g);
3272 theCommands.Add ("GetBooleanArrayValue",
3273 "GetBooleanArrayValue (DF, entry, index)",
3274 __FILE__, DDataStd_GetBooleanArrayValue, g);
3276 theCommands.Add ("GetBooleanList",
3277 "GetBooleanList (DF, entry )",
3278 __FILE__, DDataStd_GetBooleanList, g);
3280 theCommands.Add ("GetIntegerList",
3281 "GetIntegerList (DF, entry )",
3282 __FILE__, DDataStd_GetIntegerList, g);
3284 theCommands.Add ("GetRealList",
3285 "GetRealList (DF, entry )",
3286 __FILE__, DDataStd_GetRealList, g);
3290 // ========================= UTF =====================================
3291 const char* ggg = "UTF Commands";
3293 theCommands.Add ("SetUTFName",
3294 "SetUTFName (DF, entry, fileName)",
3295 __FILE__, DDataStd_KeepUTF, ggg);
3297 theCommands.Add ("GetUTF",
3298 "GetUTF (DF, entry, fileName)",
3299 __FILE__, DDataStd_GetUTFtoFile, ggg);
3301 //======================= NData Commands ========================
3303 const char* gN = "NData Commands";
3304 theCommands.Add ("SetNDataIntegers",
3305 "SetNDataIntegers (DF, entry, NumPairs, key1, val1, ... )",
3306 __FILE__, DDataStd_SetNDataIntegers, gN);
3308 theCommands.Add ("SetNDataReals",
3309 "SetNDataReals (DF, entry, NumPairs, key1, val1, ... )",
3310 __FILE__, DDataStd_SetNDataReals, gN);
3312 theCommands.Add ("SetNDataStrings",
3313 "SetNDataStrings (DF, entry, NumPairs, key1, val1, ... )",
3314 __FILE__, DDataStd_SetNDataStrings, gN);
3316 theCommands.Add ("SetNDataBytes",
3317 "SetNDataBytes (DF, entry, NumPairs, key1, val1, ... )",
3318 __FILE__, DDataStd_SetNDataBytes, gN);
3320 theCommands.Add ("SetNDataIntArrays",
3321 "SetNDataIntArrays (DF entry entry key NumOfArrElems val1 val2... )",
3322 __FILE__, DDataStd_SetNDataIntAr, gN);
3324 theCommands.Add ("SetNDataRealArrays",
3325 "SetNDataRealArrays (DF entry key NumOfArrElems val1 val2... )",
3326 __FILE__, DDataStd_SetNDataRealAr, gN);
3330 theCommands.Add ("GetNDIntegers",
3331 "GetNDIntegers (DF, entry )",
3332 __FILE__, DDataStd_GetNDIntegers, g);
3334 theCommands.Add ("GetNDInteger",
3335 "GetNDInteger (DF entry key [drawname])",
3336 __FILE__, DDataStd_GetNDInteger, g);
3338 theCommands.Add ("GetNDReals",
3339 "GetNDReals (DF entry )",
3340 __FILE__, DDataStd_GetNDReals, g);
3342 theCommands.Add ("GetNDReal",
3343 "GetNDReal (DF entry key [drawname])",
3344 __FILE__, DDataStd_GetNDReal, g);
3346 theCommands.Add ("GetNDStrings",
3347 "GetNDStrings (DF entry )",
3348 __FILE__, DDataStd_GetNDStrings, g);
3350 theCommands.Add ("GetNDString",
3351 "GetNDString (DF entry key [drawname])",
3352 __FILE__, DDataStd_GetNDString, g);
3354 theCommands.Add ("GetNDBytes",
3355 "GetNDBytes (DF entry )",
3356 __FILE__, DDataStd_GetNDBytes, g);
3358 theCommands.Add ("GetNDByte",
3359 "GetNDByte (DF entry key [drawname])",
3360 __FILE__, DDataStd_GetNDByte, g);
3362 theCommands.Add ("GetNDIntArrays",
3363 "GetNDIntArrays (DF, entry )",
3364 __FILE__, DDataStd_GetNDIntArrays, g);
3366 theCommands.Add ("GetNDIntArray",
3367 "GetNDIntArray (DF entry key )",
3368 __FILE__, DDataStd_GetNDIntArray, g);
3370 theCommands.Add ("GetNDRealArrays",
3371 "GetNDRealArrays (DF entry )",
3372 __FILE__, DDataStd_GetNDRealArrays, g);
3374 theCommands.Add ("GetNDRealArray",
3375 "GetNDRealArray (DF entry key )",
3376 __FILE__, DDataStd_GetNDRealArray, g);
3378 //====================== Change =======================
3379 theCommands.Add ("ChangeByteArray",
3380 "ChangeByteArray (DF, entry, indx, value )",
3381 __FILE__, DDataStd_ChangeByteArray, g);
3383 theCommands.Add ("ChangeIntArray",
3384 "ChangeIntArray (DF, entry, indx, value )",
3385 __FILE__, DDataStd_ChangeIntArray, g);
3387 theCommands.Add ("ChangeRealArray",
3388 "ChangeRealArray (DF, entry, indx, value )",
3389 __FILE__, DDataStd_ChangeRealArray, g);
3391 theCommands.Add ("ChangeExtStrArray",
3392 "ChangeExtStrArray (DF, entry, indx, value )",
3393 __FILE__, DDataStd_ChangeExtStrArray, g);
3395 theCommands.Add ("ChangeIntPackedMap_Add",
3396 "ChangeIntPackedMAp_Add (DF, entry, key[,key [...]] )",
3397 __FILE__, DDataStd_ChangeIntPackedMap_Add, g);
3399 theCommands.Add ("ChangeIntPackedMap_Rem",
3400 "ChangeIntPackedMAp_Rem (DF, entry, key[,key [...]] )",
3401 __FILE__, DDataStd_ChangeIntPackedMap_Rem, g);
3403 theCommands.Add ("ChangeIntPackedMap_AddRem",
3404 "ChangeIntPackedMAp_AddRem (DF, entry, key[,key [...]] )",
3405 __FILE__, DDataStd_ChangeIntPackedMap_AddRem, g);
3407 //=========================================================
3408 // TFunction commands
3409 const char* gg = "DFunction Commands";
3411 theCommands.Add ("SetFunction",
3412 "SetFunction (DF, entry, guid, failure)",
3413 __FILE__, DDataStd_SetFunction, gg);
3415 theCommands.Add ("GetFunction",
3416 "GetFunction (DF, entry, guid(out), failure(out))",
3417 __FILE__, DDataStd_GetFunction, gg);
3419 //=========================================================
3422 //======================================================================
3423 //======= for internal use
3425 theCommands.Add ("SetNDataIntegers2",
3426 "SetNDataIntegers2 (DF, entry, NumPair )",
3427 __FILE__, DDataStd_SetNDataIntegers2, gN);
3429 theCommands.Add ("SetNDataIntArrays2",
3430 "SetNDataIntArrays2 (DF entry entry key NumOfArrElems)",
3431 __FILE__, DDataStd_SetNDataIntAr2, gN);
3433 theCommands.Add ("SetIntArrayT",
3434 "SetIntArrayT (DF, entry, isDelta, From, To )",
3435 __FILE__, DDataStd_SetIntArrayTest, g);
3437 theCommands.Add ("SetIntPHugeMap",
3438 "SetIntPHugeMap (DF, entry, isDelta Num)",
3439 __FILE__, DDataStd_SetIntPHugeMap, g);