0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / DDF / DDF_DataCommands.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 3dcda4b..254bb98
@@ -1,11 +1,22 @@
-// File:       DDF_DataCommands.cxx
+// Created by: DAUTRY Philippe
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
 //             --------------------
-// Author:     DAUTRY Philippe
-//             <fid@fox.paris1.matra-dtv.fr>
-// Copyright:  Matra Datavision 1997
 
 // Version:    0.0
-// History:    Version Date            Purpose
+//Version      Date            Purpose
 //             0.0     Sep 30 1997     Creation
 
 
@@ -55,7 +66,7 @@ static Standard_Integer MakeDF (Draw_Interpretor& di,
   if (!D.IsNull ()) {
     NewDDF = Handle(DDF_Data)::DownCast (D);
     if (!NewDDF.IsNull ()) {
-      di<<"DDF_BasicCommands::MakeDF - Sorry, this Data Framework already exists"<<"\n";
+      di<<"DDF_BasicCommands::MakeDF - Sorry, this Data Framework already exists\n";
       return 0;
     }
   }
@@ -97,7 +108,7 @@ static Standard_Integer ClearDF (Draw_Interpretor& di,
     }
   }
 
-  di<<"DDF_BasicCommands::MakeDF - Sorry, this Data Framework doesn't exist"<<"\n";
+  di<<"DDF_BasicCommands::MakeDF - Sorry, this Data Framework doesn't exist\n";
 
   return 0;
 }
@@ -144,7 +155,7 @@ static Standard_Integer CopyDF (Draw_Interpretor& /*di*/,
 
 
   Handle(TDF_DataSet) DataSet = new TDF_DataSet;
-  DataSet->AddRoot(Label1);
+  DataSet->AddLabel(Label1);
   TDF_ClosureTool::Closure(DataSet);
   Handle(TDF_RelocationTable) Reloc = new TDF_RelocationTable();
   Reloc->SetRelocation(Label1,Label2);
@@ -171,18 +182,18 @@ static Standard_Integer MiniDumpDF (Draw_Interpretor& di,
   D = Draw::Get(a[1]);
 
   if (D.IsNull ()) {
-    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist"<<"\n";
+    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist\n";
     return Standard_False;
   }
 
   DDF = Handle(DDF_Data)::DownCast (D);
 
   if (DDF.IsNull ()) {
-    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist"<<"\n";
+    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist\n";
     return Standard_False;
   }
 
-  di<<"*********** Dump of "<<a[1]<<" ***********"<<"\n";
+  di<<"*********** Dump of "<<a[1]<<" ***********\n";
 
   //DDF->DataFramework()->Dump(cout);
   Standard_SStream aSStream;
@@ -209,18 +220,18 @@ static Standard_Integer XDumpDF (Draw_Interpretor& di,
   D = Draw::Get(a[1]);
 
   if (D.IsNull ()) {
-    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist"<<"\n";
+    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist\n";
     return Standard_False;
   }
 
   DDF = Handle(DDF_Data)::DownCast (D);
 
   if (DDF.IsNull ()) {
-    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist"<<"\n";
+    di<<"DDF_BasicCommands : Sorry this Data Framework doesn't exist\n";
     return Standard_False;
   }
 
-  di<<"*********** Dump of "<<a[1]<<" ***********"<<"\n";
+  di<<"*********** Dump of "<<a[1]<<" ***********\n";
 
   TDF_IDFilter filter(Standard_False);
   //TDF_Tool::ExtendedDeepDump(cout,DDF->DataFramework(),filter);
@@ -246,7 +257,7 @@ static Standard_Integer CopyLabel_SCopy (Draw_Interpretor& di,Standard_Integer n
     if(!DDF::GetDF(a[1], DF)) return 1;
     if (!DDF::FindLabel(DF,a[2],SOURCE)) return 1;   
     if (DDF::FindLabel(DF,a[3],TARGET)) {
-      di << " target label is already setted "<< "\n";
+      di << " target label is already setted \n";
       return 1;
     }
     DDF::AddLabel(DF,a[3],TARGET);
@@ -254,10 +265,10 @@ static Standard_Integer CopyLabel_SCopy (Draw_Interpretor& di,Standard_Integer n
     cop.Load(SOURCE, TARGET);
     cop.Perform();
     if (!cop.IsDone()) 
-      di << "copy not done" << "\n";
+      di << "copy not done\n";
     return 0;
   }
-  di << "DDF_CopyLabel : Error" << "\n";
+  di << "DDF_CopyLabel : Error\n";
   return 1;  
 }
 
@@ -306,11 +317,7 @@ static Standard_Integer  DDF_CheckAttrs (Draw_Interpretor& di,Standard_Integer n
                }
                TDF_Tool::Entry(sAtt->Label(), entr1);
                //cout<<"\tAttribute dynamic type = "<<sAtt->DynamicType()<<",\tlocated on Label = "<<entr1<<endl;
-               di<<"\tAttribute dynamic type = ";
-               Standard_SStream aSStream;
-               sAtt->DynamicType()->Print(aSStream);
-               aSStream << ends;
-               di << aSStream;
+               di<<"\tAttribute dynamic type = " << sAtt->DynamicType()->Name();
                di<<",\tlocated on Label = "<<entr1.ToCString()<<"\n";
              }
          }
@@ -320,10 +327,10 @@ static Standard_Integer  DDF_CheckAttrs (Draw_Interpretor& di,Standard_Integer n
       ds1->Clear();
     }
     if(!Shar) 
-      di << "Shareable attributes not found" << "\n";
+      di << "Shareable attributes not found\n";
     return 0;
   }
-  di << "DDF_CheckAttrs : Error" << "\n";
+  di << "DDF_CheckAttrs : Error\n";
   return 1;    
 }
 
@@ -345,21 +352,14 @@ static Standard_Integer  DDF_CheckLabel (Draw_Interpretor& di,Standard_Integer n
     for (TDF_AttributeIterator itr(SOURCE); itr.More(); itr.Next()) {
       itr.Value()->References(ds1);
       //cout<<"\tSource Attribute dynamic type = "<<itr.Value()->DynamicType()<<endl;
-      di<<"\tSource Attribute dynamic type = ";
-      Standard_SStream aSStream1;
-      itr.Value()->DynamicType()->Print(aSStream1);
-      aSStream1 << ends;
-      di << aSStream1 << "\n";
+      di<<"\tSource Attribute dynamic type = " << itr.Value()->DynamicType()->Name() << "\n";
       const TDF_AttributeMap& attMap = ds1->Attributes(); //attMap
       for (TDF_MapIteratorOfAttributeMap attMItr(attMap);attMItr.More(); attMItr.Next()) {
        Handle(TDF_Attribute) sAtt = attMItr.Key();
        TCollection_AsciiString entry;
        TDF_Tool::Entry(sAtt->Label(), entry);
        //cout<<"\t\tReferences attribute dynamic type = "<<sAtt->DynamicType()<<",\tLabel = "<<entry<<endl;
-       di<<"\t\tReferences attribute dynamic type = ";
-       Standard_SStream aSStream2;
-       sAtt->DynamicType()->Print(aSStream2);
-       di << aSStream2;
+       di<<"\t\tReferences attribute dynamic type = " << sAtt->DynamicType()->Name();
        di<<",\tLabel = "<<entry.ToCString()<<"\n";
       }
       ds1->Clear();
@@ -367,7 +367,7 @@ static Standard_Integer  DDF_CheckLabel (Draw_Interpretor& di,Standard_Integer n
 
     return 0;
   }
-  di << "DDF_ChecLabel : Error" << "\n";
+  di << "DDF_ChecLabel : Error\n";
   return 1;    
 }