public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { _valuesInfo = new FasterDictionaryNode <TKey> [size]; _values = allocationStrategy; _values.Alloc(size); DBC.Common.Check.Ensure(_values.capacity == _valuesInfo.Length, "invalid buffer size"); _buckets = new int[HashHelpers.GetPrime((int)size)]; }
public bool Initialize(LockStepInitializeInfo initInfo, IBufferStrategy bufferStrategy) { // just want to initialize Gcloud IGCloud gcloud = IGCloud.Instance; ADebug.Log("Initialize" + (gcloud == null)); if (initInfo != null) { this.initInfo = initInfo; byte[] buffer; if (initInfo.Encode(out buffer) && buffer != null) { bool ret = gcloud_lockstep_init(buffer, buffer.Length); if (!ret) { return(false); } } else { ADebug.LogError("LockStep Initialize Encode error"); return(false); } } else { ADebug.LogError("LockStep Initialize is null"); return(true); } if (bufferStrategy != null) { this.bufferStrategy = bufferStrategy; } else { this.bufferStrategy = new DefaultBufferStrategy(); } if (this.bufferStrategy != null) { this.bufferStrategy.Steper = this; } return(true); }
public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { //AllocationStrategy must be passed external for TValue because SveltoDictionary doesn't have struct //constraint needed for the NativeVersion if (UnmanagedTypeExtensions.IsUnmanaged <TKey>() == false || UnmanagedTypeExtensions.IsUnmanaged <TValue>() == false) { _valuesInfo = new ManagedStrategy <FasterDictionaryNode <TKey> >(size); } else { _valuesInfo = new NativeStrategy <FasterDictionaryNode <TKey> >(size); } _buckets = new int[HashHelpers.GetPrime((int)size)]; _values = allocationStrategy; _values.Alloc(size); }
public SveltoDictionary(IBufferStrategy <TValue> allocationStrategy) : this(1, allocationStrategy) { }