Salome HOME
Use full attribute type name in INTERFACE_N
[modules/shaper.git] / src / ExchangeAPI / ExchangeAPI_Import.cpp
1 // Name   : ExchangeAPI_Import.cpp
2 // Purpose: 
3 //
4 // History:
5 // 07/06/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ExchangeAPI_Import.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ExchangeAPI_Import::ExchangeAPI_Import(
13     const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16   initialize();
17 }
18
19 ExchangeAPI_Import::ExchangeAPI_Import(
20     const std::shared_ptr<ModelAPI_Feature> & theFeature,
21     const std::string & theFilePath)
22 : ModelHighAPI_Interface(theFeature)
23 {
24   if (initialize())
25     setFilePath(theFilePath);
26 }
27
28 ExchangeAPI_Import::~ExchangeAPI_Import()
29 {
30
31 }
32
33 //--------------------------------------------------------------------------------------
34 void ExchangeAPI_Import::setFilePath(const std::string & theFilePath)
35 {
36   fillAttribute(theFilePath, myfilePath);
37
38   execute();
39 }
40
41 //--------------------------------------------------------------------------------------
42 // TODO(spo): make add* as static functions of the class
43 ImportPtr addImport(
44     const std::shared_ptr<ModelAPI_Document> & thePart,
45     const std::string & theFilePath)
46 {
47   // TODO(spo): check that thePart is not empty
48   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
49   return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));
50 }