0027067: Avoid use of virtual methods for implementation of destructors in legacy...
[occt.git] / src / MoniTool / MoniTool_OptValue.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <MoniTool_OptValue.hxx>
16 #include <MoniTool_Profile.hxx>
17 #include <Standard_Transient.hxx>
18
19 MoniTool_OptValue::MoniTool_OptValue (const Standard_CString opt)
20     : theopt (opt)
21 {
22 // CKY:   NO CALL TO A VIRTUAL METHOD WITHIN THE CONSTRUCTOR
23 //   Explicite Load must be done after creation
24 }
25
26     void  MoniTool_OptValue::Clear ()
27       {  theval.Nullify();  }
28
29     void  MoniTool_OptValue::SetValue
30   (const Handle(MoniTool_Profile)& prof,
31    const Standard_CString opt, const Standard_Boolean fast)
32 {
33   if (prof.IsNull()) return;
34   if (!opt || opt[0] == '\0') return;
35   Handle(Standard_Transient) val;
36   if (fast) prof->FastValue (opt,val);
37   else prof->Value (opt,val);
38   if (!val.IsNull()) theval = val;
39 }
40
41
42     Standard_Boolean  MoniTool_OptValue::IsLoaded () const
43       {  return (!theval.IsNull());  }
44
45     Handle(MoniTool_Profile)  MoniTool_OptValue::Prof () const
46 {
47   Handle(MoniTool_Profile) prof;
48   return prof;
49 }
50
51     void  MoniTool_OptValue::Load (const Standard_Boolean fast)
52       {  SetValue (Prof(),theopt.ToCString(),fast);  }
53
54
55     void  MoniTool_OptValue::Value (Handle(Standard_Transient)& val) const
56       {  val = theval;  }
57
58 //=======================================================================
59 //function : ~MoniTool_OptValue
60 //purpose  : 
61 //=======================================================================
62
63 MoniTool_OptValue::~MoniTool_OptValue() 
64 {}