Adding test cases from chl grid
[occt.git] / src / DDataStd / DDataStd_BasicCommands.cxx
CommitLineData
b311480e 1// Created on: 1997-07-30
2// Created by: Denis PASCAL
3// Copyright (c) 1997-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22#include <DDataStd.hxx>
23
24#include <Standard_PCharacter.hxx>
25
26#include <DDF.hxx>
27#include <Draw_Interpretor.hxx>
28#include <Draw_Appli.hxx>
29#include <DrawTrSurf.hxx>
30
31#include <DDF.hxx>
32
33#include <TDF_Data.hxx>
34#include <TDF_Label.hxx>
35#include <TDF_Tool.hxx>
36#include <TDF_AttributeSequence.hxx>
37#include <TDF_AttributeList.hxx>
38#include <TDF_ListIteratorOfAttributeList.hxx>
39
40#include <DBRep.hxx>
41#include <TopAbs.hxx>
42#include <TopoDS.hxx>
43#include <TopoDS_Vertex.hxx>
44#include <TopoDS_Edge.hxx>
45#include <TopoDS_Wire.hxx>
46#include <TopoDS_Face.hxx>
47#include <TopoDS_Shell.hxx>
48#include <TopoDS_Solid.hxx>
49#include <TopoDS_Shape.hxx>
50
51#include <gp_Pnt.hxx>
52#include <gp_Dir.hxx>
53#include <gp_Pln.hxx>
54
55#include <TCollection_AsciiString.hxx>
56#include <TColStd_HArray1OfReal.hxx>
57
58// LES ATTRIBUTES
59#include <TDataStd.hxx>
60#include <TDataStd_Comment.hxx>
61#include <TDataStd_Name.hxx>
62#include <TDataStd_Integer.hxx>
63#include <TDataStd_Real.hxx>
64#include <TDF_Reference.hxx>
65#include <TDataStd_UAttribute.hxx>
66#include <TDataStd_IntegerArray.hxx>
67#include <TDataStd_RealArray.hxx>
68#include <TDataStd_Variable.hxx>
69#include <TDataStd_ExtStringArray.hxx>
70#include <TDF_ChildIterator.hxx>
71#include <TDF_Tool.hxx>
72
7fd59977 73#include <TDataStd_NamedData.hxx>
74#include <TColStd_DataMapOfStringInteger.hxx>
75#include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
76#include <TDataStd_DataMapOfStringReal.hxx>
77#include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
78#include <TDataStd_DataMapOfStringByte.hxx>
79#include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
80#include <TDataStd_DataMapOfStringString.hxx>
81#include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
82#include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
83#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
84#include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
85#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
86#include <TColStd_HArray1OfInteger.hxx>
87#include <TColStd_HArray1OfReal.hxx>
88#include <TDataStd_AsciiString.hxx>
89#include <TDataStd_IntPackedMap.hxx>
90#include <TColStd_HPackedMapOfInteger.hxx>
91#include <TColStd_PackedMapOfInteger.hxx>
92#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
93#include <TDataStd_ByteArray.hxx>
94
95#include <Standard_Macro.hxx>
96#ifdef OptJr
97#define ROUNDMEM(len) (((len)+3)&~0x3)
98#else
99#define ROUNDMEM(len) (len)
100#endif
101
102//=======================================================================
103//function : DDataStd_SetInteger
104//purpose : SetInteger (DF, entry, value)
105//=======================================================================
106
107static Standard_Integer DDataStd_SetInteger (Draw_Interpretor& di,
108 Standard_Integer nb,
109 const char** arg)
110{
111 if (nb == 4) {
112 Handle(TDF_Data) DF;
113 if (!DDF::GetDF(arg[1],DF)) return 1;
114 TDF_Label L;
115 DDF::AddLabel(DF, arg[2], L);
116 TDataStd_Integer::Set(L,atoi(arg[3]));
117 return 0;
118 }
119 di << "DDataStd_SetInteger : Error" << "\n";
120 return 1;
121}
122
123//=======================================================================
124//function : DDataStd_SetReal
125//purpose : SetReal (DF, entry, value)
126//=======================================================================
127
128static Standard_Integer DDataStd_SetReal (Draw_Interpretor& di,
129 Standard_Integer nb,
130 const char** arg)
131{
132 if (nb == 4) {
133 Handle(TDF_Data) DF;
134 if (!DDF::GetDF(arg[1],DF)) return 1;
135 TDF_Label L;
136 DDF::AddLabel(DF, arg[2], L);
137 TDataStd_Real::Set(L,atof(arg[3]));
138 return 0;
139 }
140 di << "DDataStd_SetReal : Error" << "\n";
141 return 1;
142}
143
144
145
146//=======================================================================
147//function : DDataStd_SetReference
148//purpose : SetReference (DF, entry, reference)
149//=======================================================================
150
151static Standard_Integer DDataStd_SetReference (Draw_Interpretor& di,
152 Standard_Integer nb,
153 const char** arg)
154{
155 if (nb == 4) {
156 Handle(TDF_Data) DF;
157 if (!DDF::GetDF(arg[1],DF)) return 1;
158 TDF_Label L;
159 DDF::AddLabel(DF, arg[2], L);
160 TDF_Label LREF;
161 if (!DDF::FindLabel(DF,arg[3],LREF)) return 1;
162 TDF_Reference::Set(L,LREF);
163 return 0;
164 }
165 di << "DDataStd_SetReference : Error" << "\n";
166 return 1;
167}
168
169
170//=======================================================================
171//function : DDataStd_SetComment
172//purpose : SetComment (DF, entry, Comment)
173//=======================================================================
174
175static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
176 Standard_Integer nb,
177 const char** arg)
178{
179 if (nb == 4) {
180 Handle(TDF_Data) DF;
181 if (!DDF::GetDF(arg[1],DF)) return 1;
182 TDF_Label L;
183 DDF::AddLabel(DF, arg[2], L);
184 TDataStd_Comment::Set(L,arg[3]);
185 return 0;
186 }
187 di << "DDataStd_SetComment : Error" << "\n";
188 return 1;
189}
190
191
192
193//=======================================================================
194//function : DDataStd_GetInteger
195//purpose : GetReal (DF, entry, [drawname])
196//=======================================================================
197
198static Standard_Integer DDataStd_GetInteger (Draw_Interpretor& di,
199 Standard_Integer nb,
200 const char** arg)
201{
202 if (nb == 3 || nb == 4) {
203 Handle(TDF_Data) DF;
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());
209 di << A->Get();
210 return 0;
211 }
212 di << "DDataStd_GetInteger : Error" << "\n";
213 return 1;
214}
215
216//=======================================================================
217//function : DDataStd_GetReal
218//purpose : GetReal (DF, entry, [drawname])
219//=======================================================================
220
221static Standard_Integer DDataStd_GetReal (Draw_Interpretor& di,
222 Standard_Integer nb,
223 const char** arg)
224{
225 if (nb == 3 || nb == 4) {
226 Handle(TDF_Data) DF;
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());
232 di << A->Get();
233 return 0;
234 }
235 di << "DDataStd_GetReal : Error" << "\n";
236 return 1;
237}
238
239
240//=======================================================================
241//function : DDataStd_GetReference
242//purpose : GetShape (DF, entry)
243//=======================================================================
244
245static Standard_Integer DDataStd_GetReference (Draw_Interpretor& di,
246 Standard_Integer nb,
247 const char** arg)
248{
249 if (nb == 3) {
250 Handle(TDF_Data) DF;
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();
256 return 0;
257 }
258 di << "DDataStd_GetReference : Error" << "\n";
259 return 1;
260}
261
262//=======================================================================
263//function : DDataStd_GetComment
264//purpose : GetShape (DF, entry)
265//=======================================================================
266
267static Standard_Integer DDataStd_GetComment (Draw_Interpretor& di,
268 Standard_Integer nb,
269 const char** arg)
270{
271 if (nb == 3) {
272 Handle(TDF_Data) DF;
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 << s.ToCString();
278 return 0;
279 }
280 di << "DDataStd_GetComment : Error" << "\n";
281 return 1;
282}
283
284
285
286//=======================================================================
287//function :
288//purpose : Self (document,label)
289//=======================================================================
290
291static Standard_Integer DDataStd_Self (Draw_Interpretor& di,
292 Standard_Integer nb,
293 const char** arg)
294{
295 TCollection_AsciiString s;
296 if (nb == 3) {
297 Handle(TDF_Data) DF;
298 if (!DDF::GetDF(arg[1],DF)) return 1;
299 TDF_Label L;
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 << " ";
305// cout << endl;
306// }
307 return 0;
308 }
309 di << "Self : Error" << "\n";
310 return 0;
311}
312
313
314
315//=======================================================================
316//function : SetUObject (DF, entry, ObjectID)
317//=======================================================================
318// static Standard_Integer DDataStd_SetUObject (Draw_Interpretor&,
319// Standard_Integer nb,
320// const char** arg)
321// {
322// if( nb == 4 ) {
323// Handle(TDF_Data) DF;
324// if (!DDF::GetDF(arg[1],DF)) return 1;
325// TDF_Label label;
326// DDF::AddLabel(DF, arg[2], label);
327
328// Standard_GUID guid(arg[3]); //"00000000-0000-0000-1111-000000000000");
329// TDataStd_UObject::Set(label, guid);
330// return 0;
331// }
332
333// cout << "Wrong arguments" << endl;
334// return 1;
335// }
336
337//=======================================================================
338//function : SetUAttribute (DF, entry, LocalID)
339//=======================================================================
340static Standard_Integer DDataStd_SetUAttribute (Draw_Interpretor& di,
341 Standard_Integer nb,
342 const char** arg)
343{
344 if( nb == 4 ) {
345 Handle(TDF_Data) DF;
346 if (!DDF::GetDF(arg[1],DF)) return 1;
347 TDF_Label label;
348 DDF::AddLabel(DF, arg[2], label);
349
350 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
351 TDataStd_UAttribute::Set(label, guid);
352 return 0;
353 }
354
355 di << "Wrong arguments" << "\n";
356 return 1;
357}
358
359//=======================================================================
360//function : GetUAttribute (DF, entry, LoaclID)
361//=======================================================================
362static Standard_Integer DDataStd_GetUAttribute (Draw_Interpretor& di,
363 Standard_Integer nb,
364 const char** arg)
365{
366 if( nb == 4 ) {
367 Handle(TDF_Data) DF;
368 if (!DDF::GetDF(arg[1],DF)) return 1;
369 TDF_Label label;
370 if( !DDF::FindLabel(DF, arg[2], label) ) {
371 di << "No label for entry" << "\n";
372 return 1;
373 }
374 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
375
376 Handle(TDataStd_UAttribute) UA;
377 if( !label.FindAttribute(guid, UA) ) {
378 di << "No UAttribute Attribute on label" << "\n";
379 }
380 else {
381// UA->ID().ShallowDump(cout);
382// cout << endl;
383 char *aStrGUID = new char[37];
384 UA->ID().ToCString(aStrGUID);
385 di << aStrGUID;
386 }
387 return 0;
388 }
389
390 di << "Wrong arguments" << "\n";
391 return 1;
392}
393
394
395//=======================================================================
396//function : CheckUObject (DF, entry, ObjectID)
397//=======================================================================
398// static Standard_Integer DDataStd_CheckUObject (Draw_Interpretor&,
399// Standard_Integer nb,
400// const char** arg)
401// {
402// if( nb == 4 ) {
403// Handle(TDF_Data) DF;
404// if (!DDF::GetDF(arg[1],DF)) return 1;
405// TDF_Label label;
406// if( !DDF::FindLabel(DF, arg[2], label) ) {
407// cout << "No label for entry" << endl;
408// return 1;
409// }
410// Handle(TDataStd_Object) O;
411// Handle(TDataStd_UObject) UO;
412// Standard_GUID guidUO(arg[3]);
413
414// if( !label.FindAttribute( TDataStd_Object::GetID(), O) ) {
415// cout << "No Object Attribute on label" << endl;
416// }
417// else {
418// cout << "UObject is found with ObjectID = ";
419// O->Find(label, guidUO, UO);
420// UO->ObjectID().ShallowDump(cout);
421// cout << endl;
422// }
423// return 0;
424// }
425
426// cout << "Wrong arguments" << endl;
427// return 1;
428// }
429
430
431//=======================================================================
432//function : SetIntArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
433//=======================================================================
434static Standard_Integer DDataStd_SetIntArray (Draw_Interpretor& di,
435 Standard_Integer,
436 const char** arg)
437{
438
439
440 Handle(TDF_Data) DF;
441 if (!DDF::GetDF(arg[1],DF)) return 1;
442 TDF_Label label;
443 DDF::AddLabel(DF, arg[2], label);
444 Standard_Integer isDelta = atoi(arg[3]);
445 Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j;
446 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
447 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
448
449 j = 6;
450 for(Standard_Integer i = From; i<=To; i++) {
451 A->SetValue(i, atoi(arg[j]) );
452 j++;
453 }
454
455 return 0;
456}
457
458//=======================================================================
459//function : GetIntArray (DF, entry )
460//=======================================================================
461static Standard_Integer DDataStd_GetIntArray (Draw_Interpretor& di,
462 Standard_Integer,
463 const char** arg)
464{
465
466
467 Handle(TDF_Data) DF;
468 if (!DDF::GetDF(arg[1],DF)) return 1;
469 TDF_Label label;
470 if( !DDF::FindLabel(DF, arg[2], label) ) {
471 di << "No label for entry" << "\n";
472 return 1;
473 }
474
475 Handle(TDataStd_IntegerArray) A;
476 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
477 di << "There is no TDataStd_IntegerArray under label" << "\n";
478 return 1;
479 }
480
481 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
482 //cout << A->Value(i) << endl;
483 di << A->Value(i);
484 if(i<A->Upper())
485 di<<" ";
486 }
487 di<<"\n";
488 return 0;
489}
490//
491//=======================================================================
492//function : ChangeIntArray (DF, entry, indx, val )
493//=======================================================================
494static Standard_Integer DDataStd_ChangeIntArray (Draw_Interpretor& di,
495 Standard_Integer nb,
496 const char** arg)
497{
498
499 if( nb == 5 ) {
500 Handle(TDF_Data) DF;
501 if (!DDF::GetDF(arg[1],DF)) return 1;
502 TDF_Label label;
503 if( !DDF::FindLabel(DF, arg[2], label) ) {
504 di << "No label for entry" << "\n";
505 return 1;
506 }
507
508 Handle(TDataStd_IntegerArray) A;
509 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
510 di << "There is no TDataStd_IntegerArray at label" << "\n";
511 return 1;
512 }
513 Standard_Integer indx = atoi(arg[3]);
514 Standard_Integer val = atoi(arg[4]);
515 Standard_Integer low = A->Lower(), up = A->Upper();
516 if(low <= indx && indx <= up)
517 A->SetValue(indx, val);
518 else {
519 Handle(TColStd_HArray1OfInteger) Arr = A->Array();
520 Handle(TColStd_HArray1OfInteger) arr;
521 Standard_Integer i;
522 if(indx > up) {
523 up = indx;
524 arr = new TColStd_HArray1OfInteger(low, up);
525 for(i=low; i<= Arr->Upper(); i++)
526 arr->SetValue(i, Arr->Value(i));
527 for(i=Arr->Upper()+1; i<= up; i++) {
528 if(i == up)
529 arr->SetValue(i, val);
530 else
531 arr->SetValue(i, 0);
532 }
533 } else if(indx < up) {//clip array : indx to be negative
534 up = abs(indx);
535 arr = new TColStd_HArray1OfInteger(low, up);
536 for(i=low; i< up; i++)
537 arr->SetValue(i, Arr->Value(i));
538 arr->SetValue(up, val);
539 }
540 A->ChangeArray(arr);
541 }
542 return 0;
543 }
544 di << "DDataStd_ChangeIntArray: Error" << "\n";
545 return 0;
546}
547
548//=======================================================================
549//function : SetIntArrayT (DF, entry , isDelta, From, To) - for testing
550// : huge arrays
551//=======================================================================
552static Standard_Integer DDataStd_SetIntArrayTest (Draw_Interpretor& di,
553 Standard_Integer,
554 const char** arg)
555{
556
557
558 Handle(TDF_Data) DF;
559 if (!DDF::GetDF(arg[1],DF)) return 1;
560 TDF_Label label;
561 DDF::AddLabel(DF, arg[2], label);
562 Standard_Integer isDelta = atoi(arg[3]);
563 Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j;
564 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
565 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
566
567 j = 6;
568 Standard_Integer k = 100;
569 for(Standard_Integer i = From; i<=To; i++) {
570 A->SetValue(i, ++k);
571 j++;
572 }
573
574 return 0;
575}
576
577//=======================================================================
578//function : SetRealArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
579//=======================================================================
580static Standard_Integer DDataStd_SetRealArray (Draw_Interpretor& di,
581 Standard_Integer,
582 const char** arg)
583{
584
585
586 Handle(TDF_Data) DF;
587 if (!DDF::GetDF(arg[1],DF)) return 1;
588 TDF_Label label;
589 DDF::AddLabel(DF, arg[2], label);
590 Standard_Integer isDelta = atoi(arg[3]);
591
592 Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j;
593 di << " Array of Standard_Real with bounds from = " << From << " to = " << To << "\n";
594 Handle(TDataStd_RealArray) A = TDataStd_RealArray::Set(label, From, To, isDelta);
595
596 j = 6;
597 for(Standard_Integer i = From; i<=To; i++) {
598 A->SetValue(i, atof(arg[j]) );
599 j++;
600 }
601
602 return 0;
603}
604
605//=======================================================================
606//function : GetRealArray (DF, entry )
607//=======================================================================
608static Standard_Integer DDataStd_GetRealArray (Draw_Interpretor& di,
609 Standard_Integer,
610 const char** arg)
611{
612
613 Handle(TDF_Data) DF;
614 if (!DDF::GetDF(arg[1],DF)) return 1;
615 TDF_Label label;
616 if( !DDF::FindLabel(DF, arg[2], label) ) {
617 di << "No label for entry" << "\n";
618 return 1;
619 }
620
621 Handle(TDataStd_RealArray) A;
622 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
623 di << "There is no TDataStd_RealArray under label" << "\n";
624 return 1;
625 }
626
627 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
628 //cout << A->Value(i) << endl;
629 di << A->Value(i);
630 if(i<A->Upper())
631 di<<" ";
632 }
633 di<<"\n";
634
635 return 0;
636}
637
638//
639//=======================================================================
640//function : ChangeRealArray (DF, entry, indx, val )
641//=======================================================================
642static Standard_Integer DDataStd_ChangeRealArray (Draw_Interpretor& di,
643 Standard_Integer nb,
644 const char** arg)
645{
646
647 if( nb == 5 ) {
648 Handle(TDF_Data) DF;
649 if (!DDF::GetDF(arg[1],DF)) return 1;
650 TDF_Label label;
651 if( !DDF::FindLabel(DF, arg[2], label) ) {
652 di << "No label for entry" << "\n";
653 return 1;
654 }
655
656 Handle(TDataStd_RealArray) A;
657 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
658 di << "There is no TDataStd_RealArray at label" << "\n";
659 return 1;
660 }
661 Standard_Integer indx = atoi(arg[3]);
662 Standard_Real val = atof(arg[4]);
663 Standard_Integer low = A->Lower(), up = A->Upper();
664 if(low <= indx && indx <= up)
665 A->SetValue(indx, val);
666 else {
667 Handle(TColStd_HArray1OfReal) Arr = A->Array();
668 Handle(TColStd_HArray1OfReal) arr;
669 Standard_Integer i;
670 if(indx > up) {
671 up = indx;
672 arr = new TColStd_HArray1OfReal(low, up);
673 for(i=low; i<= Arr->Upper(); i++)
674 arr->SetValue(i, Arr->Value(i));
675 for(i=Arr->Upper()+1; i<= up; i++) {
676 if(i == up)
677 arr->SetValue(i, val);
678 else
679 arr->SetValue(i, 0);
680 }
681 } else if(indx < up) {//clip array : indx to be negative
682 up = abs(indx);
683 arr = new TColStd_HArray1OfReal(low, up);
684 for(i=low; i< up; i++)
685 arr->SetValue(i, Arr->Value(i));
686 arr->SetValue(up, val);
687 }
688 A->ChangeArray(arr);
689 }
690 return 0;
691 }
692 di << "DDataStd_ChangeRealArray: Error" << "\n";
693 return 0;
694}
695
696//=======================================================================
697//function : SetVariable (DF, entry, isConstant[0/1], units)
698//=======================================================================
699static Standard_Integer DDataStd_SetVariable (Draw_Interpretor& di,
700 Standard_Integer nb,
701 const char** arg)
702{
703 if (nb == 5)
704 {
705 Handle(TDF_Data) DF;
706 if (!DDF::GetDF(arg[1],DF)) return 1;
707 TDF_Label label;
708 DDF::AddLabel(DF, arg[2], label);
709
710 Handle(TDataStd_Variable) aV = TDataStd_Variable::Set(label);
711
712 const char* aUnits = arg[4];
713 aV->Unit(Standard_CString(aUnits));
714
715 aV->Constant(Standard_Boolean(atoi(arg[3])));
716 return 0;
717 }
718
719 di << "Wrong arguments" << "\n";
720 return 1;
721}
722
723//=======================================================================
724//function : GetVariable (DF, entry, [isConstant], [units])
725//=======================================================================
726static Standard_Integer DDataStd_GetVariable (Draw_Interpretor& di,
727 Standard_Integer nb,
728 const char** arg)
729{
730 if (nb == 5)
731 {
732 Handle(TDF_Data) DF;
733 if (!DDF::GetDF(arg[1],DF)) return 1;
734 TDF_Label label;
735 DDF::AddLabel(DF, arg[2], label);
736
737 Handle(TDataStd_Variable) aV;
738 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
739 {
740 di << "TDataStd_Variable: no such attribute" << "\n";
741 }
742
743 Draw::Set(arg[3],TCollection_AsciiString(Standard_Integer(aV->IsConstant())).ToCString());
744 Draw::Set(arg[4],aV->Unit().ToCString());
745 return 0;
746 }
747
748 di << "Wrong arguments" << "\n";
749 return 1;
750}
751
752#include <TDataStd_Relation.hxx>
753#include <TDataStd_Variable.hxx>
754//=======================================================================
755//function : SetRelation (DF, entry, expression, var1[, var2, ...])
756//=======================================================================
757static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
758 Standard_Integer nb, const char** arg)
759{
760 if (nb >= 5)
761 {
762 Handle(TDF_Data) DF;
763 if (!DDF::GetDF(arg[1],DF)) return 1;
764 TDF_Label label;
765 DDF::AddLabel(DF, arg[2], label);
766
767 Standard_CString expr (arg[3]);
768 Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
769 aR->SetRelation(expr);
770 Handle(TDataStd_Variable) aV;
771
772 for (Standard_Integer i = 4; i < nb; i++)
773 {
774 if (!DDF::FindLabel(DF, arg[i], label))
775 {
776 di << "No label for entry" << arg[i] << "\n";
777 return 1;
778 }
779 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
780 {
781 di << "No TDataStd_Variable Attribute on label" << "\n";
782 return 1;
783 }
784 aR->GetVariables().Append(aV);
785 }
786 return 0;
787 }
788 di << "Usage: SetRelation (DF, entry, expression, var1[, var2, ...])" << "\n";
789 return 1;
790}
791
792//=======================================================================
793//function : DumpRelation (DF, entry)
794//=======================================================================
795static Standard_Integer DDataStd_DumpRelation (Draw_Interpretor& di,
796 Standard_Integer nb, const char** arg)
797{
798 if (nb == 3)
799 {
800 Handle(TDF_Data) DF;
801 if (!DDF::GetDF(arg[1],DF)) return 1;
802
803 TDF_Label label;
804 if (!DDF::FindLabel(DF, arg[2], label))
805 {
806 di << "No label for entry " << arg[2] << "\n";
807 return 1;
808 }
809 Handle(TDataStd_Relation) aR;
810 if (!label.FindAttribute(TDataStd_Relation::GetID(), aR))
811 {
812 di << "No TDataStd_Relation Attribute on label " << arg[2] << "\n";
813 return 1;
814 }
815
816 di << "Relation: expression = \"" << aR->GetRelation()
817 << "\" variables list = (";
818
819 Handle(TDF_Attribute) aV;
820 TCollection_AsciiString anEntry;
821
822 TDF_ListIteratorOfAttributeList it;
823 for (it.Initialize(aR->GetVariables()); it.More(); it.Next())
824 {
825 aV = it.Value();
826 if (!aV.IsNull())
827 {
828 label = aV->Label();
829 TDF_Tool::Entry(label, anEntry);
830 di << anEntry.ToCString() << " ";
831 }
832 }
833 di << ")";
834 return 0;
835 }
836 di << "Usage: DumpRelation (DF, entry)" << "\n";
837 return 1;
838}
839
840#include <TFunction_Function.hxx>
841//=======================================================================
842//function : SetFunction (DF, entry, guid, failure)
843//=======================================================================
844static Standard_Integer DDataStd_SetFunction (Draw_Interpretor& di,
845 Standard_Integer nb, const char** arg)
846{
847 if (nb == 5)
848 {
849 Handle(TDF_Data) DF;
850 if (!DDF::GetDF(arg[1],DF)) return 1;
851 TDF_Label label;
852 DDF::AddLabel(DF, arg[2], label);
853
854 Standard_GUID guid (arg[3]);
855 Handle(TFunction_Function) aF = TFunction_Function::Set(label, guid);
856
857 int fail = atoi(arg[4]);
858 aF->SetFailure(fail);
859
860 return 0;
861 }
862
863 di << "Wrong arguments" << "\n";
864 return 1;
865}
866
867//=======================================================================
868//function : GetFunction (DF, entry, guid(out), failure(out))
869//=======================================================================
870static Standard_Integer DDataStd_GetFunction (Draw_Interpretor& di,
871 Standard_Integer nb, const char** arg)
872{
873 if (nb == 5)
874 {
875 Handle(TDF_Data) DF;
876 if (!DDF::GetDF(arg[1],DF)) return 1;
877 TDF_Label label;
878 if (!DDF::FindLabel(DF, arg[2], label))
879 {
880 di << "No label for entry" << "\n";
881 return 1;
882 }
883
884 Handle(TFunction_Function) aF;
885 if (!label.FindAttribute(TFunction_Function::GetID(), aF))
886 {
887 di << "No TFunction_Function Attribute on label" << "\n";
888 }
889 else
890 {
891 char *aStrGUID = new char[37];
892 aF->GetDriverGUID().ToCString(aStrGUID);
893 Draw::Set(arg[3],aStrGUID);
894
895 Draw::Set(arg[4],TCollection_AsciiString(aF->GetFailure()).ToCString());
896 }
897 return 0;
898 }
899
900 di << "Wrong arguments" << "\n";
901 return 1;
902}
903
904//=======================================================================
905//function : SetExtStringArray (DF, entry , isDelta, From, To, elmt1, elmt2, ...
906//=======================================================================
907static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
908 Standard_Integer,
909 const char** arg)
910{
911
912
913 Handle(TDF_Data) DF;
914 if (!DDF::GetDF(arg[1],DF)) return 1;
915 TDF_Label label;
916 DDF::AddLabel(DF, arg[2], label);
917 Standard_Integer isDelta = atoi(arg[3]);
918
919 Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j;
920 di << "Array of ExtString with bounds from = " << From << " to = " << To << "\n";
921 Handle(TDataStd_ExtStringArray) A = TDataStd_ExtStringArray::Set(label, From, To, isDelta);
922
923 j = 6;
924 for(Standard_Integer i = From; i<=To; i++) {
925 A->SetValue(i, arg[j] );
926 j++;
927 }
928
929 return 0;
930}
931
932//=======================================================================
933//function : GetExtStringArray (DF, entry )
934//=======================================================================
935static Standard_Integer DDataStd_GetExtStringArray (Draw_Interpretor& di,
936 Standard_Integer,
937 const char** arg)
938{
939
940
941 Handle(TDF_Data) DF;
942 if (!DDF::GetDF(arg[1],DF)) return 1;
943 TDF_Label label;
944 if( !DDF::FindLabel(DF, arg[2], label) ) {
945 di << "No label for entry" << "\n";
946 return 1;
947 }
948
949 Handle(TDataStd_ExtStringArray) A;
950 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
951 di << "There is no TDataStd_ExtStringArray under label" << "\n";
952 return 1;
953 }
954
955 TCollection_ExtendedString anExtendedString;
956 TCollection_AsciiString anAsciiString;
957 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
958 anExtendedString = A->Value(i);
959 anAsciiString = TCollection_AsciiString (A->Value(i),'?');
960 //cout << anAsciiString.ToCString() << endl;
961 di << anAsciiString.ToCString();
962 if(i<A->Upper())
963 di<<" ";
964 }
965 di<<"\n";
966 return 0;
967}
968
969//=======================================================================
970//function : ChangeExtStrArray (DF, entry, indx, val )
971//=======================================================================
972static Standard_Integer DDataStd_ChangeExtStrArray (Draw_Interpretor& di,
973 Standard_Integer nb,
974 const char** arg)
975{
976
977 if( nb == 5 ) {
978 Handle(TDF_Data) DF;
979 if (!DDF::GetDF(arg[1],DF)) return 1;
980 TDF_Label label;
981 if( !DDF::FindLabel(DF, arg[2], label) ) {
982 di << "No label for entry" << "\n";
983 return 1;
984 }
985
986 Handle(TDataStd_ExtStringArray) A;
987 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
988 di << "There is no TDataStd_ExtStringArray at label" << "\n";
989 return 1;
990 }
991 Standard_Integer indx = atoi(arg[3]);
992 TCollection_ExtendedString val(arg[4]);
993 Standard_Integer low = A->Lower(), up = A->Upper();
994 if(low <= indx && indx <= up)
995 A->SetValue(indx, val);//TColStd_HArray1OfExtendedString
996 else {
997 Handle(TColStd_HArray1OfExtendedString) Arr = A->Array();
998 Handle(TColStd_HArray1OfExtendedString) arr;
999 Standard_Integer i;
1000 if(indx > up) {
1001 up = indx;
1002 arr = new TColStd_HArray1OfExtendedString(low, up);
1003 for(i=low; i<= Arr->Upper(); i++)
1004 arr->SetValue(i, Arr->Value(i));
1005 for(i=Arr->Upper()+1; i<= up; i++) {
1006 if(i == up)
1007 arr->SetValue(i, val);
1008 else
1009 arr->SetValue(i, 0);
1010 }
1011 } else if(indx < up) {//clip array : indx to be negative
1012 up = abs(indx);
1013 arr = new TColStd_HArray1OfExtendedString(low, up);
1014 for(i=low; i< up; i++)
1015 arr->SetValue(i, Arr->Value(i));
1016 arr->SetValue(up, val);
1017 }
1018 A->ChangeArray(arr);
1019 }
1020 return 0;
1021 }
1022 di << "DDataStd_ChangeExtStringArray: Error" << "\n";
1023 return 0;
1024}
1025
1026
1027//=======================================================================
1028//function : DDataStd_KeepUTF
1029//purpose : SetUTFName (DF, fatherEntry, fileName)
1030//=======================================================================
1031static Standard_Integer DDataStd_KeepUTF (Draw_Interpretor& di,
1032 Standard_Integer nb,
1033 const char** arg)
1034{
1035 if (nb == 4) {
1036 Handle(TDF_Data) DF;
1037 if (!DDF::GetDF(arg[1],DF)) return 1;
1038 TDF_Label L;
1039 DDF::AddLabel(DF, arg[2], L);
1040 Standard_CString aFileName(arg[3]);
1041
1042#ifdef WNT
1043 ifstream anIS (aFileName, ios::in | ios::binary);
1044#else
1045 ifstream anIS (aFileName);
1046#endif
1047 if (!anIS) {
1048 // Can not open file
1049 cout << "Error: can't open file " << aFileName <<endl;;
1050 return 1;
1051 }
1052 char buf[1024];
1053 char *p;
1054 anIS.getline(buf, 1023,'\n');
1055 // 0xEFBBBF - prefix of UTF8
1056 p = &buf[3]; //skip prefix
1057 TCollection_ExtendedString aES1(p, Standard_True);
1058 TDataStd_Name::Set(L.NewChild(), aES1);
1059
1060
1061 while (anIS.good() && !anIS.eof()) {
1062 anIS.getline(buf, 1023,'\n');
1063 TCollection_ExtendedString aES2(buf, Standard_True);
1064 const TDF_Label& aLab = L.NewChild();
1065 TDataStd_Name::Set(aLab, aES2);
1066 }
1067 return 0;
1068 }
1069 di << "SetUTFName : String is not kept in DF" << "\n";
1070 return 1;
1071}
1072
1073//=======================================================================
1074//function : DDataStd_GetUTFtoFile
1075//purpose : GetUTF (DF, fatherEntry, fileName)
1076// : all strings from sub-labels of the <fatherEntry> concatenated
1077// : in one, converted to UTF8 and kept in the file
1078//=======================================================================
1079static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di,
1080 Standard_Integer nb,
1081 const char** arg)
1082{
1083 if (nb == 4) {
1084 Handle(TDF_Data) DF;
1085 if (!DDF::GetDF(arg[1],DF)) return 1;
1086 TDF_Label L;
1087 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
1088
1089 TCollection_ExtendedString aES;
1090 Standard_Boolean aF = Standard_False;
1091 TDF_ChildIterator anIt(L);
1092 for(;anIt.More();anIt.Next()) {
1093 const TDF_Label& aLab = anIt.Value();
1094 if(!aLab.IsNull()) {
1095 Handle(TDataStd_Name) anAtt;
1096 if(aLab.FindAttribute(TDataStd_Name::GetID(), anAtt)) {
1097 if(anAtt->Get().Length()) {
1098 if (aF)
1099 aES +='\n';
1100 aES +=anAtt->Get();
1101 aF = Standard_True;
1102 }
1103 }
1104 }
1105 }
1106
1107 if(!aES.Length()) {
1108 cout << "Data is not found in the Document" <<endl;
1109 return 1;
1110 }
1111
1112 Standard_CString aFileName(arg[3]);
1113
1114#ifdef WNT
1115 ofstream anOS (aFileName, ios::in | ios::binary | ios::ate);
1116#else
1117 ofstream anOS (aFileName, ios::ate);
1118#endif
1119 if (!anOS) {
1120 // A problem with the stream
1121#ifdef DEB
1122 cout << "Error: problem with the file stream, rdstate = " <<anOS.rdstate() <<endl;
1123#endif
1124 }
1125 char prefix[4] = {0xEF,0xBB,0xBF, 0x00};
1126 anOS.write( (char*)&prefix[0], 3);
1127 Standard_Integer n = aES.LengthOfCString();
1128 Standard_PCharacter aCstr = (Standard_PCharacter) Standard::Allocate(ROUNDMEM(n+1));
1129 n = aES.ToUTF8CString(aCstr);
1130 anOS.write( (char*)&aCstr[0], n);
1131 anOS.close();
1132 return 0;
1133 }
1134 di << "GetUTF : Data is not extracted to the specified file " <<"\n";
1135 return 1;
1136}
1137
1138//=======================================================================
1139//function : SetByteArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )
1140//=======================================================================
1141static Standard_Integer DDataStd_SetByteArray (Draw_Interpretor& di,
1142 Standard_Integer nb,
1143 const char** arg)
1144{
1145
1146 if (nb > 6) {
1147 Handle(TDF_Data) DF;
1148 if (!DDF::GetDF(arg[1],DF)) return 1;
1149 TDF_Label label;
1150 DDF::AddLabel(DF, arg[2], label);
1151 Standard_Integer isDelta = atoi(arg[3]);
1152 Standard_Integer From = atoi(arg[4]), To = atoi( arg[5] ), j;
1153 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
1154 Handle(TDataStd_ByteArray) A = TDataStd_ByteArray::Set(label, From, To, isDelta);
1155
1156 j = 6;
1157 for(Standard_Integer i = From; i<=To; i++) {
1158 Standard_Integer ival = atoi(arg[j]);
1159 if(ival > 255) {
1160 cout << "Bad value = " << ival<< endl;
1161 return 1;
1162 }
1163 A->SetValue(i, (unsigned)ival);
1164 j++;
1165 }
1166 return 0;
1167 }
1168 di << "DDataStd_SetByteArray: Error" << "\n";
1169 return 1;
1170}
1171
1172//=======================================================================
1173//function : GetByteArray (DF, entry )
1174//=======================================================================
1175static Standard_Integer DDataStd_GetByteArray (Draw_Interpretor& di,
1176 Standard_Integer,
1177 const char** arg)
1178{
1179
1180
1181 Handle(TDF_Data) DF;
1182 if (!DDF::GetDF(arg[1],DF)) return 1;
1183 TDF_Label label;
1184 if( !DDF::FindLabel(DF, arg[2], label) ) {
1185 di << "No label for entry" << "\n";
1186 return 1;
1187 }
1188
1189 Handle(TDataStd_ByteArray) A;
1190 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
1191 di << "There is no TDataStd_ByteArray at label" << "\n";
1192 return 1;
1193 }
1194
1195 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
1196 //cout << A->Value(i) << endl;
1197 di << A->Value(i);
1198 if(i<A->Upper())
1199 di<<" ";
1200 }
1201 di<<"\n";
1202 return 0;
1203}
1204
1205//=======================================================================
1206//function : ChangeByteArray (DF, entry, indx, val )
1207//=======================================================================
1208static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di,
1209 Standard_Integer nb,
1210 const char** arg)
1211{
1212
1213 if( nb == 5 ) {
1214 Handle(TDF_Data) DF;
1215 if (!DDF::GetDF(arg[1],DF)) return 1;
1216 TDF_Label label;
1217 if( !DDF::FindLabel(DF, arg[2], label) ) {
1218 di << "No label for entry" << "\n";
1219 return 1;
1220 }
1221
1222 Handle(TDataStd_ByteArray) A;
1223 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
1224 di << "There is no TDataStd_ByteArray at label" << "\n";
1225 return 1;
1226 }
1227 Standard_Integer indx = atoi(arg[3]);
1228 Standard_Integer ival = atoi(arg[4]);
1229 if (ival > 255 || ival < 0) {
1230 di << "DDataStd_ChangeByteArray: Bad value = " <<ival << "\n";
1231 return 1;
1232 }
1233 Standard_Integer low = A->Lower(), up = A->Upper();
1234 if(low <= indx && indx <= up)
1235 A->SetValue(indx, (unsigned)ival);
1236 else {
1237 Handle(TColStd_HArray1OfByte) Arr = A->InternalArray();
1238 Handle(TColStd_HArray1OfByte) arr;
1239 Standard_Integer i;
1240 if(indx > up) {
1241 up = indx;
1242 arr = new TColStd_HArray1OfByte(low, up);
1243 for(i=low; i<= Arr->Upper(); i++)
1244 arr->SetValue(i, Arr->Value(i));
1245 for(i=Arr->Upper()+1; i<= up; i++) {
1246 if(i == up)
1247 arr->SetValue(i, (unsigned)ival);
1248 else
1249 arr->SetValue(i, 0);
1250 }
1251 } else if(indx < up) {//clip array : indx to be negative
1252 up = abs(indx);
1253 arr = new TColStd_HArray1OfByte(low, up);
1254 for(i=low; i< up; i++)
1255 arr->SetValue(i, Arr->Value(i));
1256 arr->SetValue(up, (unsigned)ival);
1257 }
1258 A->ChangeArray(arr);
1259 }
1260 return 0;
1261 }
1262 di << "DDataStd_ChangeByteArray: Error" << "\n";
1263 return 1;
1264}
1265//=======================================================================
1266//function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
1267//=======================================================================
1268
1269static Standard_Integer DDataStd_SetIntPackedMap (Draw_Interpretor& di,
1270 Standard_Integer nb,
1271 const char** arg)
1272{
1273
1274 if (nb > 4) {
1275 Handle(TDF_Data) DF;
1276 if (!DDF::GetDF(arg[1],DF)) return 1;
1277 TDF_Label aLabel;
1278 DDF::AddLabel(DF, arg[2], aLabel);
1279 Standard_Integer isDelta = atoi(arg[3]);
1280 Standard_Integer aNum = nb - 4;
1281 Handle(TDataStd_IntPackedMap) anAtt;
1282 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
1283 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
1284 if(anAtt.IsNull()) {
1285 di << "IntPackedMap attribute is not found or not set" << "\n";
1286 return 1;}
1287
1288 Standard_Integer j = 4;
1289 TColStd_PackedMapOfInteger aMap;
1290 for(Standard_Integer i = 1; i<=aNum; i++) {
1291 aMap.Add (atoi(arg[j]));
1292 j++;
1293 }
1294 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
1295 anAtt->ChangeMap(aHMap);
1296 cout << "Map extent = " << anAtt->Extent()<<endl;
1297 return 0;
1298 }
1299 di << "DDataStd_SetIntPackedMap : Error" << "\n";
1300 return 1;
1301}
1302
1303//=======================================================================
1304//function : GetIntPackedMap (DF, entry )
1305//=======================================================================
1306
1307static Standard_Integer DDataStd_GetIntPackedMap (Draw_Interpretor& di,
1308 Standard_Integer nb,
1309 const char** arg)
1310{
1311
1312 if (nb == 3) {
1313 Handle(TDF_Data) DF;
1314 if (!DDF::GetDF(arg[1],DF)) return 1;
1315 TDF_Label aLabel;
1316 DDF::AddLabel(DF, arg[2], aLabel);
1317 Handle(TDataStd_IntPackedMap) anAtt;
1318 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt)) {
1319 di << "IntPackedMap attribute is not found or not set" << "\n";
1320 return 1;}
1321//
1322 const TColStd_PackedMapOfInteger& aMap = anAtt->GetMap();
1323 TColStd_MapIteratorOfPackedMapOfInteger itr(aMap);
1324 for (Standard_Integer j = 1; itr.More(); itr.Next(),j++){
1325 Standard_Integer aKey(itr.Key());
1326 cout << "Key ("<< j <<")"<<" = " << aKey << endl;;
1327 }
1328 return 0;
1329 }
1330 di << "DDataStd_GetIntPackedMap : Error" << "\n";
1331 return 1;
1332}
1333
1334
1335//=======================================================================
1336//function : ChangeIntPackedMap_Add (DF, entry, Key1, Key2,... )
1337//=======================================================================
1338static Standard_Integer DDataStd_ChangeIntPackedMap_Add (Draw_Interpretor& di,
1339 Standard_Integer nb,
1340 const char** arg)
1341{
1342
1343 if( nb >= 4 ) {
1344 Handle(TDF_Data) DF;
1345 if (!DDF::GetDF(arg[1],DF)) return 1;
1346 TDF_Label label;
1347 if( !DDF::FindLabel(DF, arg[2], label) ) {
1348 di << "No label for entry" << "\n";
1349 return 1;
1350 }
1351
1352 Handle(TDataStd_IntPackedMap) A;
1353 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
1354 di << "There is no TDataStd_IntPackedMap at label" << "\n";
1355 return 1;
1356 }
1357
1358 Standard_Integer i, aNum = nb - 3;
1359 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
1360 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
1361 if(!aHMap.IsNull()) {
1362 ahMap->ChangeMap().Assign(aHMap->Map());
1363 for(i=1; i<=aNum;i++) {
1364 Standard_Integer val = atoi(arg[i+2]);
1365 if(!ahMap->Map().Contains(val))
1366 ahMap->ChangeMap().Add(val);
1367 }
1368
1369 A->ChangeMap(ahMap);
1370 }
1371 return 0;
1372 }
1373 di << "DDataStd_ChangeIntPackedMap_Add: Error" << "\n";
1374 return 0;
1375}
1376
1377
1378//=======================================================================
1379//function : ChangeIntPackedMap_Rem (DF, entry, Key1, Key2,... )
1380//=======================================================================
1381static Standard_Integer DDataStd_ChangeIntPackedMap_Rem (Draw_Interpretor& di,
1382 Standard_Integer nb,
1383 const char** arg)
1384{
1385
1386 if( nb >= 4 ) {
1387 Handle(TDF_Data) DF;
1388 if (!DDF::GetDF(arg[1],DF)) return 1;
1389 TDF_Label label;
1390 if( !DDF::FindLabel(DF, arg[2], label) ) {
1391 di << "No label for entry" << "\n";
1392 return 1;
1393 }
1394
1395 Handle(TDataStd_IntPackedMap) A;
1396 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
1397 di << "There is no TDataStd_IntPackedMap at label" << "\n";
1398 return 1;
1399 }
1400
1401 Standard_Integer i, aNum = nb - 3;
1402 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
1403 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
1404 if(!aHMap.IsNull()) {
1405 ahMap->ChangeMap().Assign(aHMap->Map());
1406 for(i=1; i<=aNum;i++) {
1407 Standard_Integer val = atoi(arg[i+2]);
1408 if(ahMap->Map().Contains(val))
1409 ahMap->ChangeMap().Remove(val);
1410 }
1411
1412 A->ChangeMap(ahMap);
1413 }
1414 return 0;
1415 }
1416 di << "DDataStd_ChangeIntPackedMap_Rem: Error" << "\n";
1417 return 0;
1418}
1419
1420//=======================================================================
1421//function : ChangeIntPackedMap_AddRem (DF, entry, Key1, Key2,... )
1422// : if Keyi exist in map - remove it, if no - add
1423//=======================================================================
1424static Standard_Integer DDataStd_ChangeIntPackedMap_AddRem (Draw_Interpretor& di,
1425 Standard_Integer nb,
1426 const char** arg)
1427{
1428
1429 if( nb >= 4 ) {
1430 Handle(TDF_Data) DF;
1431 if (!DDF::GetDF(arg[1],DF)) return 1;
1432 TDF_Label label;
1433 if( !DDF::FindLabel(DF, arg[2], label) ) {
1434 di << "No label for entry" << "\n";
1435 return 1;
1436 }
1437
1438 Handle(TDataStd_IntPackedMap) A;
1439 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
1440 di << "There is no TDataStd_IntPackedMap at label" << "\n";
1441 return 1;
1442 }
1443
1444 Standard_Integer i, aNum = nb - 3;
1445 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
1446 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
1447 if(!aHMap.IsNull()) {
1448 ahMap->ChangeMap().Assign(aHMap->Map());
1449 for(i=1; i<=aNum;i++) {
1450 Standard_Integer val = atoi(arg[i+2]);
1451 if(!ahMap->Map().Contains(val))
1452 ahMap->ChangeMap().Add(val);
1453 else
1454 ahMap->ChangeMap().Remove(val);
1455 }
1456
1457 A->ChangeMap(ahMap);
1458 }
1459 return 0;
1460 }
1461 di << "DDataStd_ChangeIntPackedMap_AddRem: Error" << "\n";
1462 return 0;
1463}
1464
1465//=======================================================================
1466//function : SetIntPHugeMap (DF, entry, isDelta Num)
1467//=======================================================================
1468
1469static Standard_Integer DDataStd_SetIntPHugeMap (Draw_Interpretor& di,
1470 Standard_Integer nb,
1471 const char** arg)
1472{
1473
1474 if (nb > 4) {
1475 Handle(TDF_Data) DF;
1476 if (!DDF::GetDF(arg[1],DF)) return 1;
1477 TDF_Label aLabel;
1478 DDF::AddLabel(DF, arg[2], aLabel);
1479 Standard_Integer isDelta = atoi(arg[3]);
1480 Standard_Integer aNum = atoi(arg[4]);
1481 Handle(TDataStd_IntPackedMap) anAtt;
1482 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
1483 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
1484 if(anAtt.IsNull()) {
1485 di << "IntPackedMap attribute is not found or not set" << "\n";
1486 return 1;}
1487
1488 TColStd_PackedMapOfInteger aMap;
1489 for(Standard_Integer i = 1; i<=aNum; i++) {
1490 aMap.Add (i);
1491 }
1492 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
1493 anAtt->ChangeMap(aHMap);
1494 cout << "Map extent = " << anAtt->Extent()<<endl;
1495 return 0;
1496 }
1497 di << "DDataStd_SetIntPHugeMap : Error" << "\n";
1498 return 1;
1499}
1500
1501//=======================================================================
1502//function : SetNDataIntegers (DF, entry , Num
1503//=======================================================================
1504
1505static Standard_Integer DDataStd_SetNDataIntegers2 (Draw_Interpretor& di,
1506 Standard_Integer nb,
1507 const char** arg)
1508{
1509
1510 if (nb ==4) {
1511 Handle(TDF_Data) DF;
1512 if (!DDF::GetDF(arg[1],DF)) return 1;
1513 TDF_Label aLabel;
1514 DDF::AddLabel(DF, arg[2], aLabel);
1515 Standard_Integer aNumP = atoi(arg[3]), j;
1516 Handle(TDataStd_NamedData) anAtt;
1517 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1518 anAtt = TDataStd_NamedData::Set(aLabel);
1519 if(anAtt.IsNull()) {
1520 di << "NamedData attribute is not found or not set" << "\n";
1521 return 1;}
1522
1523 j = 1111;
1524 TCollection_ExtendedString aKey("Key_");
1525 for(Standard_Integer i = 1; i<=aNumP; i++) {
1526 TCollection_ExtendedString key = aKey + i;
1527 Standard_Integer aVal = j+i;
1528 anAtt->SetInteger(key, aVal);
1529 j +=1;
1530 }
1531 return 0;
1532 }
1533 di << "DDataStd_SetNDataIntegers2 : Error" << "\n";
1534 return 1;
1535}
1536//================
1537//=======================================================================
1538//function : SetNDataIntArrays2 (DF, entry , key, NumOfArElem )
1539//=======================================================================
1540
1541static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di,
1542 Standard_Integer nb,
1543 const char** arg)
1544{
1545
1546 if (nb == 5) {
1547 Handle(TDF_Data) DF;
1548 if (!DDF::GetDF(arg[1],DF)) return 1;
1549 TDF_Label aLabel;
1550 DDF::AddLabel(DF, arg[2], aLabel);
1551
1552 Standard_Integer j;
1553 TCollection_ExtendedString aKey(arg[3]);
1554 Standard_Integer aNum = atoi(arg[4]);
1555 if (aNum <= 0) return 1;
1556 Handle(TDataStd_NamedData) anAtt;
1557 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1558 anAtt = TDataStd_NamedData::Set(aLabel);
1559 if(anAtt.IsNull()) {
1560 cout<< "NamedData attribute is not found or not set" << endl;
1561 return 1;}
1562
1563 j = 15;
1564 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
1565 for(Standard_Integer i = 1; i<=aNum; i++) {
1566 Standard_Integer aVal = j++;
1567 anArr->SetValue(i, aVal);
1568 j++;
1569 }
1570 anAtt->SetArrayOfIntegers(aKey, anArr);
1571 return 0;
1572 }
1573 di << "DDataStd_SetNDataIntArrays2 : Error" << "\n";
1574 return 1;
1575}
1576
1577
1578//=======================================================================
1579//function : SetAsciiString(DF, entry , String)
1580//=======================================================================
1581
1582static Standard_Integer DDataStd_SetAsciiString (Draw_Interpretor& di,
1583 Standard_Integer nb,
1584 const char** arg)
1585{
1586
1587 if (nb ==4) {
1588 Handle(TDF_Data) DF;
1589 if (!DDF::GetDF(arg[1],DF)) return 1;
1590 TDF_Label aLabel;
1591 DDF::AddLabel(DF, arg[2], aLabel);
1592 TCollection_AsciiString aString(arg[3]);
1593 Handle(TDataStd_AsciiString) anAtt;
1594 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1595 anAtt = TDataStd_AsciiString::Set(aLabel, aString);
1596 if(anAtt.IsNull()) {
1597 di << "AsciiString attribute is not found or not set" << "\n";
1598 return 1;}
1599
1600// anAtt->Set(aString);
1601 cout << "String = " << anAtt->Get().ToCString() << " is kept in DF" << endl;
1602 return 0;
1603 }
1604 di << "DDataStd_SetAsciiString : Error" << "\n";
1605 return 1;
1606}
1607//
1608//=======================================================================
1609//function : GetAsciiString(DF, entry )
1610//=======================================================================
1611
1612static Standard_Integer DDataStd_GetAsciiString (Draw_Interpretor& di,
1613 Standard_Integer nb,
1614 const char** arg)
1615{
1616
1617 if (nb ==3) {
1618 Handle(TDF_Data) DF;
1619 if (!DDF::GetDF(arg[1],DF)) return 1;
1620 TDF_Label aLabel;
1621 DDF::AddLabel(DF, arg[2], aLabel);
1622 Handle(TDataStd_AsciiString) anAtt;
1623 if(!aLabel.FindAttribute(TDataStd_AsciiString::GetID(), anAtt)) {
1624 cout << "AsciiString attribute is not found or not set" << endl;
1625 return 1;
1626 }
1627 cout << "String = " <<anAtt->Get().ToCString() << endl;
1628 return 0;
1629 }
1630 di << "DDataStd_GetAsciiString : Error" << "\n";
1631 return 1;
1632}
1633
1634//=======================================================================
1635//function : SetNDataIntegers (DF, entry , Num, key1, val1, ...
1636//=======================================================================
1637
1638static Standard_Integer DDataStd_SetNDataIntegers (Draw_Interpretor& di,
1639 Standard_Integer nb,
1640 const char** arg)
1641{
1642
1643 if (nb >=6) {
1644 Handle(TDF_Data) DF;
1645 if (!DDF::GetDF(arg[1],DF)) return 1;
1646 TDF_Label aLabel;
1647 DDF::AddLabel(DF, arg[2], aLabel);
1648//
1649// TCollection_ExtendedString aString("123456789 0_abcde");
1650// Standard_Integer aPos = aString.Search(" ");
1651// cout << "From Start = " <<aPos<<endl;
1652// aPos = aString.SearchFromEnd(" ");
1653// cout << "From Start = " <<aPos<<endl;
1654// TCollection_ExtendedString aValue = aString.Split(aPos);
1655// cout << "Value = |"<<aValue<<endl;
1656// cout << "aKey = " << aString << "|"<<endl;
1657//
1658 Standard_Integer aNumP = atoi(arg[3]), j;
1659 Handle(TDataStd_NamedData) anAtt;
1660 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1661 anAtt = TDataStd_NamedData::Set(aLabel);
1662 if(anAtt.IsNull()) {
1663 di << "NamedData attribute is not found or not set" << "\n";
1664 return 1;}
1665
1666 j = 4;
1667 for(Standard_Integer i = 1; i<=aNumP; i++) {
1668 TCollection_ExtendedString aKey(arg[j]);
1669 Standard_Integer aVal = atoi(arg[j+1]);
1670 anAtt->SetInteger(aKey, aVal);
1671 j +=2;
1672 }
1673 return 0;
1674 }
1675 di << "DDataStd_SetNDataIntegers : Error" << "\n";
1676 return 1;
1677}
1678
1679
1680//=======================================================================
1681//function : GetNDIntegers(DF, entry )
1682//=======================================================================
1683static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
1684 Standard_Integer nb,
1685 const char** arg)
1686{
1687
1688 if (nb == 3) {
1689 Handle(TDF_Data) DF;
1690 if (!DDF::GetDF(arg[1],DF)) return 1;
1691 TDF_Label aLabel;
1692 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1693
1694
1695 Handle(TDataStd_NamedData) anAtt;
1696 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1697 cout << "NamedData attribute is not found or not set" << endl;
1698 return 1;}
1699 cout <<endl;
1700 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1701 const TColStd_DataMapOfStringInteger& aMap = anAtt->GetIntegersContainer();
1702 TColStd_DataMapIteratorOfDataMapOfStringInteger itr(aMap);
1703 for (; itr.More(); itr.Next()){
1704 TCollection_ExtendedString aKey(itr.Key());
1705 TCollection_AsciiString aStr(aKey,'?');
1706 Standard_Integer aValue = itr.Value();
1707 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;;
1708 }
1709
1710 return 0;
1711 }
1712 di << "DDataStd_GetNDIntegers : Error" << "\n";
1713 return 1;
1714}
1715
1716//=======================================================================
1717//function : GetNDInteger(DF, entry, key [drawname])
1718//=======================================================================
1719static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
1720 Standard_Integer nb,
1721 const char** arg)
1722{
1723
1724 if (nb >=4) {
1725 Handle(TDF_Data) DF;
1726 if (!DDF::GetDF(arg[1],DF)) return 1;
1727 TDF_Label aLabel;
1728 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1729
1730
1731 Handle(TDataStd_NamedData) anAtt;
1732 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1733 cout << "NamedData attribute is not found or not set" << endl;
1734 return 1;}
1735
1736 cout <<endl;
1737 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1738 if(!anAtt->HasInteger(arg[3])) {
1739 cout << "There is no data specified by Key = "<< arg[3] << endl;
1740 return 1;
1741 } else {
1742 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<endl;
1743 if(nb == 5)
1744 Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
1745 return 0;
1746 }
1747 }
1748 di << "DDataStd_SetNDataIntegers : Error" << "\n";
1749 return 1;
1750}
1751
1752//========================== REALS ======================================
1753//=======================================================================
1754//function : SetNDataReals (DF, entry , Num, key1, val1, ...
1755//=======================================================================
1756
1757static Standard_Integer DDataStd_SetNDataReals (Draw_Interpretor& di,
1758 Standard_Integer nb,
1759 const char** arg)
1760{
1761
1762 if (nb >=6) {
1763 Handle(TDF_Data) DF;
1764 if (!DDF::GetDF(arg[1],DF)) return 1;
1765 TDF_Label aLabel;
1766 DDF::AddLabel(DF, arg[2], aLabel);
1767
1768 Standard_Integer aNumP = atoi(arg[3]), j;
1769 Handle(TDataStd_NamedData) anAtt;
1770 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1771 anAtt = TDataStd_NamedData::Set(aLabel);
1772 if(anAtt.IsNull()) {
1773 cout << "NamedData attribute is not found or not set" << endl;;
1774 return 1;}
1775
1776 j = 4;
1777 for(Standard_Integer i = 1; i<=aNumP; i++) {
1778 TCollection_ExtendedString aKey(arg[j]);
1779 Standard_Real aVal = atof(arg[j+1]);
1780 anAtt->SetReal(aKey, aVal);
1781 j +=2;
1782 }
1783 return 0;
1784 }
1785 di << "DDataStd_SetNDataReals : Error" << "\n";
1786 return 1;
1787}
1788
1789//=======================================================================
1790//function : GetNDReals(DF, entry )
1791//=======================================================================
1792static Standard_Integer DDataStd_GetNDReals (Draw_Interpretor& di,
1793 Standard_Integer nb,
1794 const char** arg)
1795{
1796
1797 if (nb == 3) {
1798 Handle(TDF_Data) DF;
1799 if (!DDF::GetDF(arg[1],DF)) return 1;
1800 TDF_Label aLabel;
1801 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1802
1803 cout <<endl;
1804 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1805 Handle(TDataStd_NamedData) anAtt;
1806 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1807 cout << "NamedData attribute is not found or not set" << endl;
1808 return 1;}
1809
1810 const TDataStd_DataMapOfStringReal& aMap = anAtt->GetRealsContainer();
1811 TDataStd_DataMapIteratorOfDataMapOfStringReal itr(aMap);
1812 for (; itr.More(); itr.Next()){
1813 TCollection_ExtendedString aKey(itr.Key());
1814 TCollection_AsciiString aStr(aKey,'?');
1815 Standard_Real aValue = itr.Value();
1816 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
1817 }
1818 return 0;
1819 }
1820 di << "DDataStd_GetNDReals : Error" << "\n";
1821 return 1;
1822}
1823
1824//=======================================================================
1825//function : GetNDReal(DF, entry, key [drawname])
1826//=======================================================================
1827static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
1828 Standard_Integer nb,
1829 const char** arg)
1830{
1831
1832 if (nb >=4) {
1833 Handle(TDF_Data) DF;
1834 if (!DDF::GetDF(arg[1],DF)) return 1;
1835 TDF_Label aLabel;
1836 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1837
1838
1839 Handle(TDataStd_NamedData) anAtt;
1840 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1841 cout << "NamedData attribute is not found or not set" << endl;
1842 return 1;}
1843
1844 cout <<endl;
1845 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1846 if(!anAtt->HasReal(arg[3])) {
1847 cout << "There is no data specified by Key = "<< arg[3] << endl;
1848 return 1;
1849 } else {
1850 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<endl;
1851 if(nb == 5)
1852 Draw::Set(arg[4], anAtt->GetReal(arg[3]));
1853 return 0;
1854 }
1855 }
1856 di << "DDataStd_GetNDReal : Error" << "\n";
1857 return 1;
1858}
1859
1860//======================= Strings =======================================
1861//=======================================================================
1862//function : SetNDataStrings (DF, entry , Num, key1, val1, ...
1863//=======================================================================
1864
1865static Standard_Integer DDataStd_SetNDataStrings (Draw_Interpretor& di,
1866 Standard_Integer nb,
1867 const char** arg)
1868{
1869
1870 if (nb >=6) {
1871 Handle(TDF_Data) DF;
1872 if (!DDF::GetDF(arg[1],DF)) return 1;
1873 TDF_Label aLabel;
1874 DDF::AddLabel(DF, arg[2], aLabel);
1875
1876 Standard_Integer aNumP = atoi(arg[3]), j;
1877 Handle(TDataStd_NamedData) anAtt;
1878 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1879 anAtt = TDataStd_NamedData::Set(aLabel);
1880 if(anAtt.IsNull()) {
1881 di << "NamedData attribute is not found or not set" << "\n";
1882 return 1;}
1883
1884 j = 4;
1885 for(Standard_Integer i = 1; i<=aNumP; i++) {
1886 TCollection_ExtendedString aKey(arg[j]);
1887 TCollection_ExtendedString aVal(arg[j+1]);
1888 anAtt->SetString(aKey, aVal);
1889 j +=2;
1890 }
1891 return 0;
1892 }
1893 di << "DDataStd_SetNDataStrings : Error" << "\n";
1894 return 1;
1895}
1896
1897//=======================================================================
1898//function : GetNDStrings(DF, entry )
1899//=======================================================================
1900static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
1901 Standard_Integer nb,
1902 const char** arg)
1903{
1904
1905 if (nb == 3) {
1906 Handle(TDF_Data) DF;
1907 if (!DDF::GetDF(arg[1],DF)) return 1;
1908 TDF_Label aLabel;
1909 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1910
1911
1912 Handle(TDataStd_NamedData) anAtt;
1913 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1914 cout << "NamedData attribute is not found or not set" << endl;
1915 return 1;}
1916 cout <<endl;
1917 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1918 const TDataStd_DataMapOfStringString& aMap = anAtt->GetStringsContainer();
1919 TDataStd_DataMapIteratorOfDataMapOfStringString itr(aMap);
1920 for (; itr.More(); itr.Next()){
1921 TCollection_ExtendedString aKey(itr.Key());
1922 TCollection_AsciiString aStr(aKey,'?');
1923 TCollection_ExtendedString aVal(itr.Value());
1924 TCollection_AsciiString aStrValue(aVal,'?');
1925 cout << "Key = " << aStr.ToCString() << " Value = " <<aStrValue.ToCString()<< endl;
1926 }
1927 return 0;
1928 }
1929 di << "DDataStd_GetNDStrings : Error" << "\n";
1930 return 1;
1931}
1932
1933//=======================================================================
1934//function : GetNDString(DF, entry, key [drawname])
1935//=======================================================================
1936static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
1937 Standard_Integer nb,
1938 const char** arg)
1939{
1940
1941 if (nb >=4) {
1942 Handle(TDF_Data) DF;
1943 if (!DDF::GetDF(arg[1],DF)) return 1;
1944 TDF_Label aLabel;
1945 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
1946
1947
1948 Handle(TDataStd_NamedData) anAtt;
1949 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
1950 di << "NamedData attribute is not found or not set" << "\n";
1951 return 1;}
1952
1953 cout <<endl;
1954 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
1955 if(!anAtt->HasString(arg[3])) {
1956 cout << "There is no data specified by Key = "<< arg[3] << endl;
1957 return 1;
1958 } else {
1959 TCollection_AsciiString aValue (anAtt->GetString(arg[3]), '?');
1960 cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << endl;
1961 if(nb == 5)
1962 Draw::Set(arg[4], aValue.ToCString());
1963 return 0;
1964 }
1965 }
1966 di << "DDataStd_GetNDString : Error" << "\n";
1967 return 1;
1968}
1969
1970//=========================== Bytes =====================================
1971//=======================================================================
1972//function : SetNDataBytes (DF, entry , Num, key1, val1, ...
1973//=======================================================================
1974
1975static Standard_Integer DDataStd_SetNDataBytes (Draw_Interpretor& di,
1976 Standard_Integer nb,
1977 const char** arg)
1978{
1979
1980 if (nb >=6) {
1981 Handle(TDF_Data) DF;
1982 if (!DDF::GetDF(arg[1],DF)) return 1;
1983 TDF_Label aLabel;
1984 DDF::AddLabel(DF, arg[2], aLabel);
1985
1986 Standard_Integer aNumP = atoi(arg[3]), j;
1987 Handle(TDataStd_NamedData) anAtt;
1988 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
1989 anAtt = TDataStd_NamedData::Set(aLabel);
1990 if(anAtt.IsNull()) {
1991 cout << "NamedData attribute is not found or not set" << endl;
1992 return 1;}
1993
1994 j = 4;
1995 for(Standard_Integer i = 1; i<=aNumP; i++) {
1996 TCollection_ExtendedString aKey(arg[j]);
1997 Standard_Byte aVal = (Standard_Byte)atoi(arg[j+1]);
1998 anAtt->SetByte(aKey, aVal);
1999 j +=2;
2000 }
2001 return 0;
2002 }
2003 di << "DDataStd_SetNDataBytes : Error" << "\n";
2004 return 1;
2005}
2006
2007//=======================================================================
2008//function : GetNDBytes(DF, entry )
2009//=======================================================================
2010static Standard_Integer DDataStd_GetNDBytes (Draw_Interpretor& di,
2011 Standard_Integer nb,
2012 const char** arg)
2013{
2014
2015 if (nb == 3) {
2016 Handle(TDF_Data) DF;
2017 if (!DDF::GetDF(arg[1],DF)) return 1;
2018 TDF_Label aLabel;
2019 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2020
2021
2022 Handle(TDataStd_NamedData) anAtt;
2023 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2024 cout << "NamedData attribute is not found or not set" << endl;
2025 return 1;}
2026 cout <<endl;
2027 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2028 const TDataStd_DataMapOfStringByte& aMap = anAtt->GetBytesContainer();
2029 TDataStd_DataMapIteratorOfDataMapOfStringByte itr(aMap);
2030 for (; itr.More(); itr.Next()){
2031 TCollection_ExtendedString aKey(itr.Key());
2032 TCollection_AsciiString aStr(aKey,'?');
2033 Standard_Byte aValue = itr.Value();
2034 cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<endl;
2035 }
2036 return 0;
2037 }
2038 di << "DDataStd_GetNDBytes : Error" << "\n";
2039 return 1;
2040}
2041
2042//=======================================================================
2043//function : GetNDByte(DF, entry, key [drawname])
2044//=======================================================================
2045static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
2046 Standard_Integer nb,
2047 const char** arg)
2048{
2049
2050 if (nb >=4) {
2051 Handle(TDF_Data) DF;
2052 if (!DDF::GetDF(arg[1],DF)) return 1;
2053 TDF_Label aLabel;
2054 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2055
2056
2057 Handle(TDataStd_NamedData) anAtt;
2058 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2059 cout << "NamedData attribute is not found or not set" << endl;
2060 return 1;}
2061
2062 cout <<endl;
2063 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2064 if(!anAtt->HasByte(arg[3])) {
2065 cout << "There is no data specified by Key = "<< arg[3] << endl;
2066 return 1;
2067 } else {
2068 cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< endl;
2069 if(nb == 5)
2070 Draw::Set(arg[4], anAtt->GetByte(arg[3]));
2071 return 0;
2072 }
2073 }
2074 di << "DDataStd_GetNDByte : Error" << "\n";
2075 return 1;
2076}
2077//======================== IntArrays ====================================
2078//=======================================================================
2079//function : SetNDataIntArrays (DF, entry , key, NumOfArElem, val1, val2,... )
2080//=======================================================================
2081
2082static Standard_Integer DDataStd_SetNDataIntAr (Draw_Interpretor& di,
2083 Standard_Integer nb,
2084 const char** arg)
2085{
2086
2087 if (nb >=6) {
2088 Handle(TDF_Data) DF;
2089 if (!DDF::GetDF(arg[1],DF)) return 1;
2090 TDF_Label aLabel;
2091 DDF::AddLabel(DF, arg[2], aLabel);
2092
2093 Standard_Integer j;
2094 TCollection_ExtendedString aKey(arg[3]);
2095 Standard_Integer aNum = atoi(arg[4]);
2096 if (aNum <= 0) return 1;
2097 Handle(TDataStd_NamedData) anAtt;
2098 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2099 anAtt = TDataStd_NamedData::Set(aLabel);
2100 if(anAtt.IsNull()) {
2101 cout<< "NamedData attribute is not found or not set" << endl;
2102 return 1;}
2103
2104 j = 5;
2105 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
2106 for(Standard_Integer i = 1; i<=aNum; i++) {
2107 Standard_Integer aVal = atoi(arg[j]);
2108 anArr->SetValue(i, aVal);
2109 j++;
2110 }
2111 anAtt->SetArrayOfIntegers(aKey, anArr);
2112 return 0;
2113 }
2114 di << "DDataStd_SetNDataIntArrays : Error" << "\n";
2115 return 1;
2116}
2117
2118
2119//=======================================================================
2120//function : GetNDIntArrays(DF, entry )
2121//=======================================================================
2122static Standard_Integer DDataStd_GetNDIntArrays (Draw_Interpretor& di,
2123 Standard_Integer nb,
2124 const char** arg)
2125{
2126
2127 if (nb == 3) {
2128 Handle(TDF_Data) DF;
2129 if (!DDF::GetDF(arg[1],DF)) return 1;
2130 TDF_Label aLabel;
2131 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2132
2133
2134 Handle(TDataStd_NamedData) anAtt;
2135 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2136 cout << "NamedData attribute is not found or not set" << endl;
2137 return 1;}
2138 cout <<endl;
2139 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2140 const TDataStd_DataMapOfStringHArray1OfInteger& aMap = anAtt->GetArraysOfIntegersContainer();
2141 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger itr(aMap);
2142 for (; itr.More(); itr.Next()){
2143 TCollection_ExtendedString aKey(itr.Key());
2144 TCollection_AsciiString aStr(aKey,'?');
2145 cout << "Key = " << aStr.ToCString()<< endl;
2146 Handle(TColStd_HArray1OfInteger) anArrValue = itr.Value();
2147 if(!anArrValue.IsNull()) {
2148 Standard_Integer lower = anArrValue->Lower();
2149 Standard_Integer upper = anArrValue->Upper();
2150 for(Standard_Integer i = lower; i<=upper;i++) {
2151 Standard_Integer aValue = anArrValue->Value(i);
2152 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2153 }
2154 } else
2155 cout << "\tthe specified array is Null "<<endl;
2156 }
2157 return 0;
2158 }
2159 di << "DDataStd_GetNDIntArrays : Error" << "\n";
2160 return 1;
2161}
2162
2163//=======================================================================
2164//function : GetNDIntArray(DF, entry, key )
2165//=======================================================================
2166static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
2167 Standard_Integer nb,
2168 const char** arg)
2169{
2170
2171 if (nb >=4) {
2172 Handle(TDF_Data) DF;
2173 if (!DDF::GetDF(arg[1],DF)) return 1;
2174 TDF_Label aLabel;
2175 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2176
2177
2178 Handle(TDataStd_NamedData) anAtt;
2179 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2180 cout << "NamedData attribute is not found or not set" << endl;
2181 return 1;}
2182
2183 cout <<endl;
2184 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2185 if(!anAtt->HasArrayOfIntegers(arg[3])) {
2186 cout << "There is no data specified by Key = "<< arg[3] << endl;
2187 return 1;
2188 } else {
2189 cout << "Key = " << arg[3] <<endl;
2190
2191 Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
2192 if(!anArrValue.IsNull()) {
2193 Standard_Integer lower = anArrValue->Lower();
2194 Standard_Integer upper = anArrValue->Upper();
2195 for(Standard_Integer i = lower; i<=upper;i++) {
2196 Standard_Integer aValue = anArrValue->Value(i);
2197 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2198 }
2199 } else
2200 cout << "\tthe specified array is Null or not found"<<endl;
2201 return 0;
2202 }
2203 }
2204 di << "DDataStd_SetNDataIntArray : Error" << "\n";
2205 return 1;
2206}
2207//============================= RealArrays ==============================
2208//=======================================================================
2209//function : SetNDataRealArrays (DF entry key NumOfArElem val1 val2... )
2210//=======================================================================
2211
2212static Standard_Integer DDataStd_SetNDataRealAr (Draw_Interpretor& di,
2213 Standard_Integer nb,
2214 const char** arg)
2215{
2216
2217 if (nb >=6) {
2218 Handle(TDF_Data) DF;
2219 if (!DDF::GetDF(arg[1],DF)) return 1;
2220 TDF_Label aLabel;
2221 DDF::AddLabel(DF, arg[2], aLabel);
2222
2223 Standard_Integer j;
2224 TCollection_ExtendedString aKey(arg[3]);
2225 Standard_Integer aNum = atoi(arg[4]);
2226 if (aNum <= 0) return 1;
2227 Handle(TDataStd_NamedData) anAtt;
2228 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
2229 anAtt = TDataStd_NamedData::Set(aLabel);
2230 if(anAtt.IsNull()) {
2231 cout << "NamedData attribute is not found or not set" << endl;
2232 return 1;}
2233
2234 j = 5;
2235 Handle(TColStd_HArray1OfReal) anArr = new TColStd_HArray1OfReal(1, aNum);
2236 for(Standard_Integer i = 1; i<=aNum; i++) {
2237 Standard_Real aVal = atof(arg[j]);
2238 anArr->SetValue(i, aVal);
2239 j++;
2240 }
2241 anAtt->SetArrayOfReals(aKey, anArr);
2242 return 0;
2243 }
2244 di << "DDataStd_SetNDataRealArrays : Error" << "\n";
2245 return 1;
2246}
2247
2248
2249//=======================================================================
2250//function : GetNDRealArrays(DF, entry )
2251//=======================================================================
2252static Standard_Integer DDataStd_GetNDRealArrays (Draw_Interpretor& di,
2253 Standard_Integer nb,
2254 const char** arg)
2255{
2256
2257 if (nb == 3) {
2258 Handle(TDF_Data) DF;
2259 if (!DDF::GetDF(arg[1],DF)) return 1;
2260 TDF_Label aLabel;
2261 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2262
2263
2264 Handle(TDataStd_NamedData) anAtt;
2265 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2266 cout << "NamedData attribute is not found or not set" << endl;
2267 return 1;}
2268 cout <<endl;
2269 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2270 const TDataStd_DataMapOfStringHArray1OfReal& aMap = anAtt->GetArraysOfRealsContainer();
2271 TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal itr(aMap);
2272 for (; itr.More(); itr.Next()){
2273 TCollection_ExtendedString aKey(itr.Key());
2274 TCollection_AsciiString aStr(aKey,'?');
2275 cout << "Key = " << aStr.ToCString()<<endl;
2276 Handle(TColStd_HArray1OfReal) anArrValue = itr.Value();
2277 if(!anArrValue.IsNull()) {
2278 Standard_Integer lower = anArrValue->Lower();
2279 Standard_Integer upper = anArrValue->Upper();
2280 for(Standard_Integer i = lower; i<=upper;i++) {
2281 Standard_Real aValue = anArrValue->Value(i);
2282 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2283 }
2284 } else
2285 cout << "\tthe specified array is Null "<<endl;
2286 }
2287 return 0;
2288 }
2289 di << "DDataStd_GetNDRealArrays : Error" << "\n";
2290 return 1;
2291}
2292
2293//=======================================================================
2294//function : GetNDRealArray(DF, entry, key )
2295//=======================================================================
2296static Standard_Integer DDataStd_GetNDRealArray (Draw_Interpretor& di,
2297 Standard_Integer nb,
2298 const char** arg)
2299{
2300
2301 if (nb >=4) {
2302 Handle(TDF_Data) DF;
2303 if (!DDF::GetDF(arg[1],DF)) return 1;
2304 TDF_Label aLabel;
2305 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
2306
2307
2308 Handle(TDataStd_NamedData) anAtt;
2309 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt)) {
2310 di << "NamedData attribute is not found or not set" << "\n";
2311 return 1;}
2312
2313 cout <<endl;
2314 cout <<"NamedData attribute at Label = " << arg[2] <<endl;
2315 if(!anAtt->HasArrayOfReals(arg[3])) {
2316 cout << "There is no data specified by Key = "<< arg[3] << endl;
2317 return 1;
2318 } else {
2319 cout << "Key = " << arg[3] <<endl;
2320
2321 Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(arg[3]);
2322 if(!anArrValue.IsNull()) {
2323 Standard_Integer lower = anArrValue->Lower();
2324 Standard_Integer upper = anArrValue->Upper();
2325 for(Standard_Integer i = lower; i<=upper;i++) {
2326 Standard_Real aValue = anArrValue->Value(i);
2327 cout << "\tValue("<<i<<")"<<" = " <<aValue<<endl;
2328 }
2329 } else
2330 cout << "\tthe specified array is Null or not found"<<endl;
2331 return 0;
2332 }
2333 }
2334 di << "DDataStd_SetNDataRealArray : Error" << "\n";
2335 return 1;
2336}
2337
2338//=======================================================================
2339//function : BasicCommands
2340//purpose :
2341//=======================================================================
2342
2343void DDataStd::BasicCommands (Draw_Interpretor& theCommands)
2344{
2345
2346 static Standard_Boolean done = Standard_False;
2347 if (done) return;
2348 done = Standard_True;
2349
2350 const char* g = "DData : Standard Attribute Commands";
2351
2352
2353 // SET
2354
2355 theCommands.Add ("SetInteger",
2356 "SetInteger (DF, entry, value)",
2357 __FILE__, DDataStd_SetInteger, g);
2358
2359 theCommands.Add ("SetIntArray",
2360 "SetIntArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )",
2361 __FILE__, DDataStd_SetIntArray, g);
2362
2363 theCommands.Add ("SetReal",
2364 "SetReal (DF, entry, value)",
2365 __FILE__, DDataStd_SetReal, g);
2366
2367 theCommands.Add ("SetRealArray",
2368 "SetRealArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )",
2369 __FILE__, DDataStd_SetRealArray, g);
2370
2371 theCommands.Add ("SetByteArray",
2372 "SetByteArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )",
2373 __FILE__, DDataStd_SetByteArray, g);
2374
2375 theCommands.Add ("SetExtStringArray",
2376 "SetExtStringArray (DF, entry, isDelta, From, To, elmt1, elmt2, ... )",
2377 __FILE__, DDataStd_SetExtStringArray, g);
2378
2379 theCommands.Add ("SetIntPackedMap",
2380 "SetIntPackedMap (DF, entry, isDelta, key1, key2, ... )",
2381 __FILE__, DDataStd_SetIntPackedMap, g);
2382
2383 theCommands.Add ("SetReference",
2384 "SetReference (DF, entry, reference)",
2385 __FILE__, DDataStd_SetReference, g);
2386
2387 theCommands.Add ("SetComment",
2388 "SetComment (DF, entry, comment)",
2389 __FILE__, DDataStd_SetComment, g);
2390
2391 theCommands.Add ("SetUAttribute",
2392 "SetUAttribute (DF, entry, LocalID)",
2393 __FILE__, DDataStd_SetUAttribute, g);
2394
2395 theCommands.Add ("SetVariable",
2396 "SetVariable (DF, entry, isConstant[0/1], units)",
2397 __FILE__, DDataStd_SetVariable, g);
2398
2399 theCommands.Add ("SetAsciiString",
2400 "SetAsciiString (DF, entry, String )",
2401 __FILE__, DDataStd_SetAsciiString, g);
2402
2403
2404 // GET
2405
2406 theCommands.Add ("GetAsciiString",
2407 "GetAsciiString (DF, entry )",
2408 __FILE__, DDataStd_GetAsciiString, g);
2409
2410 theCommands.Add ("GetInteger",
2411 "GetInteger (DF, entry, [drawname])",
2412 __FILE__, DDataStd_GetInteger, g);
2413
2414 theCommands.Add ("GetIntArray",
2415 "GetIntArray (DF, entry )",
2416 __FILE__, DDataStd_GetIntArray, g);
2417
2418 theCommands.Add ("GetRealArray",
2419 "GetRealArray (DF, entry )",
2420 __FILE__, DDataStd_GetRealArray, g);
2421
2422
2423 theCommands.Add ("GetByteArray",
2424 "GetByteArray (DF, entry )",
2425 __FILE__, DDataStd_GetByteArray, g);
2426
2427 theCommands.Add ("GetExtStringArray",
2428 "GetExtStringArray (DF, entry )",
2429 __FILE__, DDataStd_GetExtStringArray, g);
2430
2431 theCommands.Add ("GetIntPackedMap",
2432 "GetIntPackedMap (DF, entry )",
2433 __FILE__, DDataStd_GetIntPackedMap, g);
2434
2435 theCommands.Add ("GetReal",
2436 "GetReal (DF, entry, [drawname])",
2437 __FILE__, DDataStd_GetReal, g);
2438
2439 theCommands.Add ("GetReference",
2440 "GetReference (DF, entry)",
2441 __FILE__, DDataStd_GetReference, g);
2442
2443
2444 theCommands.Add ("GetComment",
2445 "GetComment (DF, entry)",
2446 __FILE__, DDataStd_GetComment, g);
2447
2448 theCommands.Add("Self",
2449 "Self(document, entry)",
2450 __FILE__, DDataStd_Self, g);
2451
2452 theCommands.Add ("GetUAttribute",
2453 "GetUAttribute (DF, entry)",
2454 __FILE__, DDataStd_GetUAttribute, g);
2455
2456 theCommands.Add ("GetVariable",
2457 "GetVariable (DF, entry, [isConstant], [units])",
2458 __FILE__, DDataStd_GetVariable, g);
2459
2460 theCommands.Add ("SetRelation",
2461 "SetRelation (DF, entry, expression, var1[, var2, ...])",
2462 __FILE__, DDataStd_SetRelation, g);
2463
2464
2465 theCommands.Add ("DumpRelation",
2466 "DumpRelation (DF, entry)",
2467 __FILE__, DDataStd_DumpRelation, g);
2468
2469
2470
2471// ========================= UTF =====================================
2472 const char* ggg = "UTF Commands";
2473
2474 theCommands.Add ("SetUTFName",
2475 "SetUTFName (DF, entry, fileName)",
2476 __FILE__, DDataStd_KeepUTF, ggg);
2477
2478 theCommands.Add ("GetUTF",
2479 "GetUTF (DF, entry, fileName)",
2480 __FILE__, DDataStd_GetUTFtoFile, ggg);
2481
2482 //======================= NData Commands ========================
2483
2484 const char* gN = "NData Commands";
2485 theCommands.Add ("SetNDataIntegers",
2486 "SetNDataIntegers (DF, entry, NumPairs, key1, val1, ... )",
2487 __FILE__, DDataStd_SetNDataIntegers, gN);
2488
2489 theCommands.Add ("SetNDataReals",
2490 "SetNDataReals (DF, entry, NumPairs, key1, val1, ... )",
2491 __FILE__, DDataStd_SetNDataReals, gN);
2492
2493 theCommands.Add ("SetNDataStrings",
2494 "SetNDataStrings (DF, entry, NumPairs, key1, val1, ... )",
2495 __FILE__, DDataStd_SetNDataStrings, gN);
2496
2497 theCommands.Add ("SetNDataBytes",
2498 "SetNDataBytes (DF, entry, NumPairs, key1, val1, ... )",
2499 __FILE__, DDataStd_SetNDataBytes, gN);
2500
2501 theCommands.Add ("SetNDataIntArrays",
2502 "SetNDataIntArrays (DF entry entry key NumOfArrElems val1 val2... )",
2503 __FILE__, DDataStd_SetNDataIntAr, gN);
2504
2505 theCommands.Add ("SetNDataRealArrays",
2506 "SetNDataRealArrays (DF entry key NumOfArrElems val1 val2... )",
2507 __FILE__, DDataStd_SetNDataRealAr, gN);
2508
2509 // GET
2510
2511 theCommands.Add ("GetNDIntegers",
2512 "GetNDIntegers (DF, entry )",
2513 __FILE__, DDataStd_GetNDIntegers, g);
2514
2515 theCommands.Add ("GetNDInteger",
2516 "GetNDInteger (DF entry key [drawname])",
2517 __FILE__, DDataStd_GetNDInteger, g);
2518
2519 theCommands.Add ("GetNDReals",
2520 "GetNDReals (DF entry )",
2521 __FILE__, DDataStd_GetNDReals, g);
2522
2523 theCommands.Add ("GetNDReal",
2524 "GetNDReal (DF entry key [drawname])",
2525 __FILE__, DDataStd_GetNDReal, g);
2526
2527 theCommands.Add ("GetNDStrings",
2528 "GetNDStrings (DF entry )",
2529 __FILE__, DDataStd_GetNDStrings, g);
2530
2531 theCommands.Add ("GetNDString",
2532 "GetNDString (DF entry key [drawname])",
2533 __FILE__, DDataStd_GetNDString, g);
2534
2535 theCommands.Add ("GetNDBytes",
2536 "GetNDBytes (DF entry )",
2537 __FILE__, DDataStd_GetNDBytes, g);
2538
2539 theCommands.Add ("GetNDByte",
2540 "GetNDByte (DF entry key [drawname])",
2541 __FILE__, DDataStd_GetNDByte, g);
2542
2543 theCommands.Add ("GetNDIntArrays",
2544 "GetNDIntArrays (DF, entry )",
2545 __FILE__, DDataStd_GetNDIntArrays, g);
2546
2547 theCommands.Add ("GetNDIntArray",
2548 "GetNDIntArray (DF entry key )",
2549 __FILE__, DDataStd_GetNDIntArray, g);
2550
2551 theCommands.Add ("GetNDRealArrays",
2552 "GetNDRealArrays (DF entry )",
2553 __FILE__, DDataStd_GetNDRealArrays, g);
2554
2555 theCommands.Add ("GetNDRealArray",
2556 "GetNDRealArray (DF entry key )",
2557 __FILE__, DDataStd_GetNDRealArray, g);
2558
2559//====================== Change =======================
2560 theCommands.Add ("ChangeByteArray",
2561 "ChangeByteArray (DF, entry, indx, value )",
2562 __FILE__, DDataStd_ChangeByteArray, g);
2563
2564 theCommands.Add ("ChangeIntArray",
2565 "ChangeIntArray (DF, entry, indx, value )",
2566 __FILE__, DDataStd_ChangeIntArray, g);
2567
2568 theCommands.Add ("ChangeRealArray",
2569 "ChangeRealArray (DF, entry, indx, value )",
2570 __FILE__, DDataStd_ChangeRealArray, g);
2571
2572 theCommands.Add ("ChangeExtStrArray",
2573 "ChangeExtStrArray (DF, entry, indx, value )",
2574 __FILE__, DDataStd_ChangeExtStrArray, g);
2575
2576 theCommands.Add ("ChangeIntPackedMap_Add",
2577 "ChangeIntPackedMAp_Add (DF, entry, key[,key [...]] )",
2578 __FILE__, DDataStd_ChangeIntPackedMap_Add, g);
2579
2580 theCommands.Add ("ChangeIntPackedMap_Rem",
2581 "ChangeIntPackedMAp_Rem (DF, entry, key[,key [...]] )",
2582 __FILE__, DDataStd_ChangeIntPackedMap_Rem, g);
2583
2584 theCommands.Add ("ChangeIntPackedMap_AddRem",
2585 "ChangeIntPackedMAp_AddRem (DF, entry, key[,key [...]] )",
2586 __FILE__, DDataStd_ChangeIntPackedMap_AddRem, g);
2587
2588//=========================================================
2589 // TFunction commands
2590 const char* gg = "DFunction Commands";
2591
2592 theCommands.Add ("SetFunction",
2593 "SetFunction (DF, entry, guid, failure)",
2594 __FILE__, DDataStd_SetFunction, gg);
2595
2596 theCommands.Add ("GetFunction",
2597 "GetFunction (DF, entry, guid(out), failure(out))",
2598 __FILE__, DDataStd_GetFunction, gg);
2599
2600//=========================================================
2601
2602
2603//======================================================================
2604//======= for internal use
2605
2606 theCommands.Add ("SetNDataIntegers2",
2607 "SetNDataIntegers2 (DF, entry, NumPair )",
2608 __FILE__, DDataStd_SetNDataIntegers2, gN);
2609
2610 theCommands.Add ("SetNDataIntArrays2",
2611 "SetNDataIntArrays2 (DF entry entry key NumOfArrElems)",
2612 __FILE__, DDataStd_SetNDataIntAr2, gN);
2613
2614 theCommands.Add ("SetIntArrayT",
2615 "SetIntArrayT (DF, entry, isDelta, From, To )",
2616 __FILE__, DDataStd_SetIntArrayTest, g);
2617
2618 theCommands.Add ("SetIntPHugeMap",
2619 "SetIntPHugeMap (DF, entry, isDelta Num)",
2620 __FILE__, DDataStd_SetIntPHugeMap, g);
2621
2622//=======
2623
2624}