Salome HOME
cf931d7028390f1bb88c0dbf299d44405c3bde5c
[modules/kernel.git] / src / DSC / DSC_User / Datastream / Calcium / calcium_port_factory.cxx
1 // Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : calcium_port_factory.cxx
24 //  Author : Eric Fayolle (EDF)
25 //  Module : KERNEL
26 // Modified by : $LastChangedBy$
27 // Date        : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $
28 // Id          : $Id$
29 //
30 #include "calcium_port_factory.hxx"
31 #include "Superv_Component_i.hxx"
32
33
34 calcium_port_factory::calcium_port_factory() {
35   Superv_Component_i::register_factory("CALCIUM",this);
36 }
37
38 calcium_port_factory::~calcium_port_factory() {}
39
40 provides_port *
41 calcium_port_factory::create_data_servant(std::string type) {
42   provides_port * rtn_port = NULL;
43
44   if ( type == "integer")
45     rtn_port = new calcium_integer_port_provides();
46   if ( type == "long")
47     rtn_port = new calcium_long_port_provides();
48   if ( type == "intc")
49     rtn_port = new calcium_intc_port_provides();
50   if ( type == "real")
51     rtn_port = new calcium_real_port_provides();
52   if ( type == "double")
53     rtn_port = new calcium_double_port_provides();
54   if ( type == "string")
55     rtn_port = new calcium_string_port_provides();
56   if ( type == "logical")
57     rtn_port = new calcium_logical_port_provides();
58   if ( type == "complex")
59     rtn_port = new calcium_complex_port_provides();
60
61   return rtn_port;
62 }
63
64 uses_port * 
65 calcium_port_factory::create_data_proxy(std::string type) {
66   uses_port * rtn_port = NULL;
67
68   if ( type == "integer")
69     rtn_port = new calcium_integer_port_uses();
70   if ( type == "long")
71     rtn_port = new calcium_long_port_uses();
72   if ( type == "intc")
73     rtn_port = new calcium_intc_port_uses();
74   if ( type == "real")
75     rtn_port = new calcium_real_port_uses();
76   if ( type == "double")
77     rtn_port = new calcium_double_port_uses();
78   if ( type == "string")
79     rtn_port = new calcium_string_port_uses();
80   if ( type == "logical")
81     rtn_port = new calcium_logical_port_uses();
82   if ( type == "complex")
83     rtn_port = new calcium_complex_port_uses();
84
85   return rtn_port;
86 }
87
88 static calcium_port_factory myfactory;