public long GetOrAddId(string key) { FeatureIdPair pair; if (featureset_dict_.TryGetValue(key, out pair) == true && pair != null) { //Find its feature id System.Threading.Interlocked.Increment(ref pair.Value); } else { lock (thisLock) { if (featureset_dict_.TryGetValue(key, out pair) == true) { System.Threading.Interlocked.Increment(ref pair.Value); } else { var oldValue = Interlocked.Increment(ref maxid_) - 1; pair = new FeatureIdPair(oldValue, 1); featureset_dict_.Add(key, pair); } } } return(pair.Key); }
public FeatureItem(string s, FeatureIdPair item) { strFeature = s; feaIdPair = item; }