2using System.Collections.Generic;
19 static CultureInfo cultureUS =
null;
37 if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator ==
"." ||
string.IsNullOrEmpty(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
38 return double.Parse(strVal);
40 if (strVal.Contains(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
41 return double.Parse(strVal);
43 if (cultureUS ==
null)
44 cultureUS = CultureInfo.CreateSpecificCulture(
"en-US");
46 return double.Parse(strVal, cultureUS);
57 public static bool TryParse(
string strVal, out
double df)
59 if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator ==
"." ||
string.IsNullOrEmpty(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
60 return double.TryParse(strVal, out df);
62 if (strVal.Contains(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
63 return double.TryParse(strVal, out df);
65 if (cultureUS ==
null)
66 cultureUS = CultureInfo.CreateSpecificCulture(
"en-US");
68 return double.TryParse(strVal, NumberStyles.Any, cultureUS, out df);
80 if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator ==
"." ||
string.IsNullOrEmpty(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
81 return float.Parse(strVal);
83 if (strVal.Contains(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
84 return float.Parse(strVal);
86 if (cultureUS ==
null)
87 cultureUS = CultureInfo.CreateSpecificCulture(
"en-US");
89 return float.Parse(strVal, cultureUS);
100 public static bool TryParse(
string strVal, out
float f)
102 if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator ==
"." ||
string.IsNullOrEmpty(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
103 return float.TryParse(strVal, out f);
105 if (strVal.Contains(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator))
106 return float.TryParse(strVal, out f);
108 if (cultureUS ==
null)
109 cultureUS = CultureInfo.CreateSpecificCulture(
"en-US");
111 return float.TryParse(strVal, NumberStyles.Any, cultureUS, out f);
The BaseParameter class is the base class for all other parameter classes.
static float ParseFloat(string strVal)
Parse float values using the US culture if the decimal separator = '.', then using the native culture...
static bool TryParse(string strVal, out double df)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
BaseParameter()
Constructor for the parameter.
static double ParseDouble(string strVal)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
abstract RawProto ToProto(string strName)
Convert the parameter into a RawProto.
static bool TryParse(string strVal, out float f)
Parse doufloatble values using the US culture if the decimal separator = '.', then using the native c...
virtual bool Compare(BaseParameter p)
Compare this parameter to another parameter.
The RawProto class is used to parse and output Google prototxt file data.
override string ToString()
Returns the RawProto as its full prototxt string.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...