23 #include "Calcium_Ports.hh"
29 using namespace YACS::ENGINE;
37 Port(node),_depend(
"TIME_DEPENDENCY"),_schema(
"TI_SCHEM"),_delta(-1.),_level(-1),_alpha(0.),
38 _interp(
"L1_SCHEM"),_extrap(
"UNDEFINED_EXTRA_SCHEM")
44 Port(other,newHelder),_depend(other._depend),_schema(other._schema),_delta(other._delta),_level(other._level),
45 _alpha(other._alpha),_interp(other._interp),_extrap(other._extrap)
58 throw Exception(
"Can not modify DependencyType property on a connected port");
60 if(depend !=
"TIME_DEPENDENCY" && depend !=
"ITERATION_DEPENDENCY")
62 throw Exception(
"DependencyType property must be TIME_DEPENDENCY or ITERATION_DEPENDENCY");
69 if(schema !=
"TI_SCHEM" && schema !=
"TF_SCHEM" && schema !=
"ALPHA_SCHEM")
71 throw Exception(
"DateCalSchem property must be TI_SCHEM, TF_SCHEM or ALPHA_SCHEM");
77 DEBTRACE(
"InputCalStreamPort::setLevel: " << value);
78 std::istringstream iss(value);
80 if (!(iss >> temp)|| temp<1)
81 throw Exception(
"StorageLevel property must be an integer > 0");
86 std::istringstream iss(value);
88 if (!(iss >> temp)||temp<0. || temp >1.)
89 throw Exception(
"Alpha property must be a float > 0 and < 1");
94 std::istringstream iss(value);
96 if (!(iss >> temp)||temp<0. || temp >1.)
97 throw Exception(
"DeltaT property must be > 0 and < 1");
102 if(value !=
"L0_SCHEM" && value !=
"L1_SCHEM")
104 throw Exception(
"InterpolationSchem property must be L0_SCHEM or L1_SCHEM");
110 if(value !=
"E0_SCHEM" && value !=
"E1_SCHEM")
112 throw Exception(
"ExtrapolationSchem property must be E0_SCHEM or E1_SCHEM");
119 DEBTRACE(
"InputCalStreamPort::setProperty: " << name <<
" " << value);
120 if(name ==
"DependencyType")
122 else if(name ==
"DateCalSchem")
124 else if(name ==
"StorageLevel")
126 else if(name ==
"Alpha")
128 else if(name ==
"DeltaT")
130 else if(name ==
"InterpolationSchem")
132 else if(name ==
"ExtrapolationSchem")
142 Engines::Superv_Component_var compo=Engines::Superv_Component::_narrow(objComponent);
143 Ports::PortProperties_var port_properties=compo->get_port_properties(
getName().c_str());
152 a <<= (CORBA::Long)
_level;
153 port_properties->set_property(prop.c_str(),
a);
160 a <<= Ports::Calcium_Ports::TF_SCHEM;
161 else if(
_schema ==
"ALPHA_SCHEM")
162 a <<= Ports::Calcium_Ports::ALPHA_SCHEM;
163 port_properties->set_property(prop.c_str(),
a);
170 port_properties->set_property(prop.c_str(),
a);
177 port_properties->set_property(prop.c_str(),
a);
181 prop=
"InterpolationSchem";
182 a <<= Ports::Calcium_Ports::L0_SCHEM;
183 port_properties->set_property(prop.c_str(),
a);
185 if(
_extrap !=
"UNDEFINED_EXTRA_SCHEM" )
187 prop=
"ExtrapolationSchem";
189 a <<= Ports::Calcium_Ports::E0_SCHEM;
190 else if(
_extrap ==
"E1_SCHEM" )
191 a <<= Ports::Calcium_Ports::E1_SCHEM;
192 port_properties->set_property(prop.c_str(),
a);
195 catch(Ports::NotDefined& ex)
217 Port(node),_depend(
"TIME_DEPENDENCY"),_schema(
"TI_SCHEM"),_level(-1)
224 Port(other,newHelder),
225 _depend(other._depend),_schema(other._schema),_level(other._level)
238 throw Exception(
"Can not modify DependencyType property on a connected port");
240 if(depend !=
"TIME_DEPENDENCY" && depend !=
"ITERATION_DEPENDENCY")
242 throw Exception(
"DependencyType property must be TIME_DEPENDENCY or ITERATION_DEPENDENCY");
249 if(schema !=
"TI_SCHEM" && schema !=
"TF_SCHEM" && schema !=
"ALPHA_SCHEM")
251 throw Exception(
"DateCalSchem property must be TI_SCHEM, TF_SCHEM or ALPHA_SCHEM");
257 _level =atoi(level.c_str());
262 if(name ==
"DependencyType")
264 else if(name ==
"DateCalSchem")
266 else if(name ==
"StorageLevel")
286 string what=
"not compatible type of port requested during building of link FROM ";
287 what+=NAME; what+=
" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
294 std::string what=
"incompatible DependencyType properties: "+_depend+
" != "+ port->
getDepend();
298 ret= edAddInputDataStreamPort(port);
305 DEBTRACE(
"OutputCalStreamPort::removeInPort");
308 string what=
"not compatible type of port requested during destruction of for link FROM ";
309 what+=NAME; what+=
" TO "; what+=inPort->getNameOfTypeOfCurrentInstance();
312 return edRemoveInputDataStreamPort(static_cast<InputDataStreamPort *>(inPort),forward);