|
1679 |
var = UniformVariable (a, b); |
1679 |
var = UniformVariable (a, b); |
1680 |
} |
1680 |
} |
1681 |
} |
1681 |
} |
|
|
1682 |
else if (type == "Normal" || type == "Gaussian") |
1683 |
{ |
1684 |
if (value.size () == 0) |
1685 |
{ |
1686 |
var = NormalVariable (); |
1687 |
} |
1688 |
else |
1689 |
{ |
1690 |
tmp = value.find (":"); |
1691 |
if (tmp == value.npos) |
1692 |
{ |
1693 |
NS_FATAL_ERROR ("bad Normal/Gaussian value: " << value); |
1694 |
} |
1695 |
std::string::size_type tmp2; |
1696 |
std::string sub = value.substr (tmp + 1, value.npos); |
1697 |
tmp2 = sub.find (":"); |
1698 |
if (tmp2 == value.npos) |
1699 |
{ |
1700 |
istringstream issA (value.substr (0, tmp)); |
1701 |
istringstream issB (sub); |
1702 |
double a, b; |
1703 |
issA >> a; |
1704 |
issB >> b; |
1705 |
var = NormalVariable (a, b); |
1706 |
} |
1707 |
else |
1708 |
{ |
1709 |
istringstream issA (value.substr (0, tmp)); |
1710 |
istringstream issB (sub.substr (0, tmp2)); |
1711 |
istringstream issC (sub.substr (tmp2 + 1, value.npos)); |
1712 |
double a, b, c; |
1713 |
issA >> a; |
1714 |
issB >> b; |
1715 |
issC >> c; |
1716 |
std::cerr << "NormalVariable ("<<a<<", "<<b<<", "<<c<<");" << std::endl; |
1717 |
var = NormalVariable (a, b, c); |
1718 |
} |
1719 |
} |
1720 |
} |
1682 |
else |
1721 |
else |
1683 |
{ |
1722 |
{ |
1684 |
NS_FATAL_ERROR ("RandomVariable deserialization not implemented for " << type); |
1723 |
NS_FATAL_ERROR ("RandomVariable deserialization not implemented for " << type); |