0022627: Change OCCT memory management defaults
[occt.git] / src / Units / Units_ShiftedUnit.cxx
1 // File:        Units_ShiftedUnit.cxx
2 // Created:     Wed Nov  4 17:46:04 1992
3 // Author:      Gilles DEBARBOUILLE
4 //              <gde@bravox>
5
6
7 #include <Units_ShiftedUnit.ixx>
8 #include <Units_ShiftedToken.hxx>
9 #include <TCollection_AsciiString.hxx>
10 #include <TColStd_HSequenceOfHAsciiString.hxx>
11
12 //=======================================================================
13 //function : Units_ShiftedUnit
14 //purpose  : 
15 //=======================================================================
16
17 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname,
18                                      const Standard_CString asymbol,
19                                      const Standard_Real avalue,
20                                      const Standard_Real amove,
21                                      const Handle(Units_Quantity)& aquantity)
22      : Units_Unit(aname,asymbol,avalue,aquantity)
23 {
24   themove = amove;
25 }
26
27 //=======================================================================
28 //function : Units_ShiftedUnit
29 //purpose  : 
30 //=======================================================================
31
32 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname,
33                                      const Standard_CString asymbol)
34      : Units_Unit(aname,asymbol)
35 {}
36
37 //=======================================================================
38 //function : Units_ShiftedUnit
39 //purpose  : 
40 //=======================================================================
41
42 Units_ShiftedUnit::Units_ShiftedUnit(const Standard_CString aname)
43      : Units_Unit(aname)
44 {}
45
46 //=======================================================================
47 //function : Move
48 //purpose  : 
49 //=======================================================================
50
51 void Units_ShiftedUnit::Move(const Standard_Real amove)
52 {
53   themove = amove;
54 }
55
56 //=======================================================================
57 //function : Move
58 //purpose  : 
59 //=======================================================================
60
61 Standard_Real Units_ShiftedUnit::Move() const
62 {
63   return themove;
64 }
65
66 //=======================================================================
67 //function : Token
68 //purpose  : 
69 //=======================================================================
70
71 Handle(Units_Token) Units_ShiftedUnit::Token() const
72 {
73   TCollection_AsciiString string = SymbolsSequence()->Value(1)->String();
74   return new Units_ShiftedToken(string.ToCString()," ",Value(),themove,Quantity()->Dimensions());
75 }
76
77 //=======================================================================
78 //function : Dump
79 //purpose  : 
80 //=======================================================================
81
82 //void Units_ShiftedUnit::Dump(const Standard_Integer ashift,
83 //                           const Standard_Integer alevel) const
84 void Units_ShiftedUnit::Dump(const Standard_Integer ,
85                              const Standard_Integer ) const
86 {
87   Standard_Integer index;
88   TCollection_AsciiString string;
89
90 //  int i;
91 //  for(i=0; i<ashift; i++)cout<<"  ";
92   for(index=1;index<=thesymbolssequence->Length();index++)
93     {
94       string = thesymbolssequence->Value(index)->String();
95       if(index != 1) cout << " or " ;
96       cout<<"\""<<string.ToCString()<<"\"";
97     }
98   cout<< "              Name:  " <<Name().ToCString()<<"                (= *" << thevalue << " SI + " << themove << ")"<<endl;
99 }
100