973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <MoniTool_OptValue.hxx> |
16 | #include <MoniTool_Profile.hxx> |
17 | #include <Standard_Transient.hxx> |
7fd59977 |
18 | |
b311480e |
19 | MoniTool_OptValue::MoniTool_OptValue (const Standard_CString opt) |
7fd59977 |
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 | //======================================================================= |
e6f550da |
59 | //function : ~MoniTool_OptValue |
7fd59977 |
60 | //purpose : |
61 | //======================================================================= |
62 | |
e6f550da |
63 | MoniTool_OptValue::~MoniTool_OptValue() |
7fd59977 |
64 | {} |