]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelHighAPI/ModelHighAPI_Double.cpp
Salome HOME
ca1f661a9ca44f518c4361263d252302b77df48b
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Double.cpp
1 // Name   : ModelHighAPI_Double.cpp
2 // Purpose: 
3 //
4 // History:
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ModelHighAPI_Double.h"
9
10 #include <ModelAPI_AttributeDouble.h>
11 //--------------------------------------------------------------------------------------
12
13 //--------------------------------------------------------------------------------------
14 ModelHighAPI_Double::ModelHighAPI_Double()
15 {
16 }
17
18 ModelHighAPI_Double::ModelHighAPI_Double(double theValue)
19 : myValue(theValue)
20 {
21 }
22
23 ModelHighAPI_Double::ModelHighAPI_Double(const std::string & theValue)
24 : myValue(theValue)
25 {
26 }
27
28 ModelHighAPI_Double::ModelHighAPI_Double(const char * theValue)
29 : myValue(theValue)
30 {
31 }
32
33 ModelHighAPI_Double::~ModelHighAPI_Double()
34 {
35 }
36
37 //--------------------------------------------------------------------------------------
38 struct fill_visitor : boost::static_visitor<void>
39 {
40   mutable std::shared_ptr<ModelAPI_AttributeDouble> myAttribute;
41
42   fill_visitor(std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
43   : myAttribute(theAttribute) {}
44
45   void operator()(double theValue) const { myAttribute->setValue(theValue); }
46   void operator()(const std::string & theValue) const { myAttribute->setText(theValue); }
47 };
48
49 void ModelHighAPI_Double::fillAttribute(
50     std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute) const
51 {
52   boost::apply_visitor(fill_visitor(theAttribute), myValue);
53 }