public IndexDefinition(IndexType indexType, IList<IndexColumnName> columns, IList<IndexOption> options) { IndexType = indexType; if (columns == null || columns.IsEmpty()) { throw new ArgumentException("columns is null or empty"); } Columns = columns; Options = options == null || options.IsEmpty() ? new List<IndexOption>(0) : options; }
/// <summary> /// Constructor. /// </summary> ///<param name="manager"></param> ///<param name="type">Type of index (16 or 32 bit).</param> /// <param name="numIndices">Number of indices to create in this buffer.</param> /// <param name="usage">Buffer usage.</param> /// <param name="useSystemMemory">Create in system memory?</param> /// <param name="useShadowBuffer">Use a shadow buffer for reading/writing?</param> public HardwareIndexBuffer( HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, bool useSystemMemory, bool useShadowBuffer ) : base( usage, useSystemMemory, useShadowBuffer ) { this.type = type; this.numIndices = numIndices; this.Manager = manager; // calc the index buffer size sizeInBytes = numIndices; if ( type == IndexType.Size32 ) { indexSize = Marshal.SizeOf( typeof( int ) ); } else { indexSize = Marshal.SizeOf( typeof( short ) ); } sizeInBytes *= indexSize; // create a shadow buffer if required if ( useShadowBuffer ) { shadowBuffer = new DefaultHardwareIndexBuffer( Manager, type, numIndices, BufferUsage.Dynamic ); } }
public void ShouldCreateIndex( IndexFor indexFor, IndexProvider indexProvider, IndexType indexType, string createEndpoint, string createJson) { //Arrange using (var testHarness = new RestTestHarness { { MockRequest.PostJson(createEndpoint, createJson), MockResponse.Http(201) } }) { var graphClient = testHarness.CreateAndConnectGraphClient(); var indexConfiguration = new IndexConfiguration { Provider = indexProvider, Type = indexType }; graphClient.CreateIndex("foo", indexConfiguration, indexFor); } }
public GLESHardwareIndexBuffer( HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer ) : base( manager, type, numIndices, usage, false, useShadowBuffer ) { if ( type == IndexType.Size32 ) { throw new AxiomException( "32 bit hardware buffers are not allowed in OpenGL ES." ); } if ( !useShadowBuffer ) { throw new AxiomException( "Only support with shadowBuffer" ); } OpenGL.GenBuffers( 1, ref this._bufferId ); GLESConfig.GlCheckError( this ); if ( this._bufferId == 0 ) { throw new AxiomException( "Cannot create GL index buffer" ); } OpenGL.BindBuffer( All.ElementArrayBuffer, this._bufferId ); GLESConfig.GlCheckError( this ); OpenGL.BufferData( All.ElementArrayBuffer, new IntPtr( sizeInBytes ), IntPtr.Zero, GLESHardwareBufferManager.GetGLUsage( usage ) ); GLESConfig.GlCheckError( this ); }
public IndexOption(IndexType indexType) { KeyBlockSize = null; IndexType = indexType; ParserName = null; Comment = null; }
public IndexSchema (IndexSchema index) : base (index) { this.tableName = index.tableName; this.type = index.type; this.columns = index.columns; }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="result">The search result was found.</param> public SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, SearchResult result) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; this.SearchResult = result; }
public override HardwareIndexBuffer CreateIndexBuffer( IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer ) { var buffer = new GLHardwareIndexBuffer( this, type, numIndices, usage, useShadowBuffer ); lock ( IndexBuffersMutex ) indexBuffers.Add( buffer ); return buffer; }
public ValidityIndex(IndexType indexType) { IndexType = indexType; m_PreviousValue = 0; CurrentValue = 0; m_IsRising = true; m_LocalMaximums = new List<double>(); }
public override HardwareIndexBuffer CreateIndexBuffer( IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer ) { var indexBuffer = new GLESHardwareIndexBuffer( this, type, numIndices, usage, true ); lock ( IndexBuffersMutex ) { indexBuffers.Add( indexBuffer ); } return indexBuffer; }
public Index(DirectoryInfo indexDirectory) { if (indexDirectory == null) throw new ArgumentNullException("indexDirectory", "indexDirectory cannot be null"); if (!indexDirectory.Exists) indexDirectory.Create(); this.directory = indexDirectory; this.structure = IndexLibrary.IndexType.SingleIndex; }
public DeleteIndexRequest(string designDoc, string name, IndexType type = IndexType.Json) { Ensure.That(designDoc, "designDoc").IsNotNullOrWhiteSpace(); Ensure.That(name, "name").IsNotNullOrWhiteSpace(); DesignDoc = designDoc; Name = name; Type = type; }
/// <summary> /// Initializes a new instance of the <see cref="SearcherEventArgs"/> class. /// </summary> /// <param name="indexName">Name of the index that is being searched.</param> /// <param name="structure">The structure of the index that is being searched.</param> /// <param name="methodType">The search method type that is being used.</param> /// <param name="location">The location within the method body where this event was fired from.</param> /// <param name="field">The field name to create a SearchResult instance from.</param> /// <param name="value">The value of the field to create a SearchResult instance from.</param> /// <param name="boost">The amount of relevance applied to the search result.</param> internal SearcherEventArgs(string indexName, IndexType structure, SearchMethodType methodType, SearchMethodLocation location, string field, string value, float boost) { this.indexName = indexName; this.structure = structure; this.SearchMethodType = methodType; this.SearchMethodLocation = location; Dictionary<string, string> values = new Dictionary<string, string>(); values.Add(field, value); this.SearchResult = new SearchResult(values, this.indexName, boost); }
private static IndexType Validate(IndexType type) { #if SILVERLIGHT if (type != IndexType.Size16) LogManager.Instance.Write("WARNING!!! Requested 32 bit indexes but Reach profile on only allows 16 bit indexes"); return IndexType.Size16; #else return type; #endif }
public SqlCreateIndexExpression(string indexName, SqlTableExpression table, bool unique, bool lowercaseIndex, IndexType indexType, bool ifNotExist, IReadOnlyList<SqlIndexedColumnExpression> columns) : base(typeof(void)) { this.IndexName = indexName; this.Table = table; this.Unique = unique; this.LowercaseIndex = lowercaseIndex; this.IndexType = indexType; this.IfNotExist = ifNotExist; this.Columns = columns; }
public void createIndex(String indexName, String binName, IndexType indexType) { // drop index client.DropIndex(null, TestQueryEngine.NAMESPACE, SET, indexName); Thread.Sleep(150); // create index IndexTask task = client.CreateIndex(null, TestQueryEngine.NAMESPACE, SET, indexName, binName, indexType, IndexCollectionType.LIST); task.Wait(); }
/// <summary> /// </summary> /// <param name="idxType"> </param> /// <param name="numIndexes"> </param> /// <param name="usage"> </param> public GLES2DefaultHardwareIndexBuffer( IndexType idxType, int numIndexes, BufferUsage usage ) : base( null, idxType, numIndexes, usage, true, false ) // always software, never shadowed { if ( idxType == IndexType.Size32 ) { throw new AxiomException( "32 bit hardware buffers are not allowed in OpenGL ES." ); } this._data = new byte[ sizeInBytes ]; this._dataPtr = BufferBase.Wrap( this._data ); }
public IList<Record> GetInRange(IndexType type, DateTimeIntervals intervalType, IndexBarInfo barInfo, int startIndex, int count) { switch (type) { case IndexType.None: break; case IndexType.OEE: switch (barInfo.Level) { case 0: return GetOEEByDateTime(intervalType, startIndex, count); case 1: return GetOEEByMachines(barInfo, startIndex, count); } break; case IndexType.Performance: if (barInfo.Level == 0) { return GetPerformanceByDateTime(intervalType, startIndex, count); } switch (barInfo.Filter) { case IndexFilter.ByProduct: return GetPerformanceByProducts(barInfo, startIndex, count); case IndexFilter.ByStation: return GetPerformanceByStations(barInfo, startIndex, count); case IndexFilter.ByActivity: return GetPerformanceByActivities(barInfo, startIndex, count); case IndexFilter.ByOperator: return GetPerformanceByOperators(barInfo, startIndex, count); default: return new List<Record>(); } case IndexType.InternalPPM: switch (barInfo.Level) { case 0: return GetPPMByDateTime(intervalType, startIndex, count); } break; case IndexType.RemainingCapacity: switch (barInfo.Level) { case 0: return GetCapacityByDateTime(intervalType, startIndex, count); } break; default: throw new ArgumentOutOfRangeException("type"); } return new List<Record>(); }
public IndexTool(UserSettings settings, string filename, IndexType indexType) : base() { try { this.settings = settings; this.filename = filename; this.indexType = indexType; if (indexType == IndexType.ffmsindex) { if (settings.deleteIndex || isOlder(filename + ".ffindex", filename)) { if (File.Exists(filename + ".ffindex")) { try { File.Delete(filename + ".ffindex"); } catch (Exception) { } } } Path = settings.ffmsindexPath; Parameter = "\"" + filename + "\""; } else if (indexType == IndexType.dgindex) { string output = System.IO.Path.ChangeExtension(filename, "dgi"); if (settings.deleteIndex || isOlder(output, filename)) { if (File.Exists(output)) { try { File.Delete(output); } catch (Exception) { } } } Path = settings.dgindexnvPath; Parameter = "-i \"" + filename + "\" -o \"" + output + "\" -e"; } } catch (Exception) { } }
public RunWorkPlan( DataSet dataSet, Cardinality cardinality, IndexType indexType, ReservationBufferSize reservationBufferSize, CacheSize cacheSize, Drive drive, CacheType cacheType, WorkPlan workPlan) : base(dataSet, cardinality, indexType, reservationBufferSize, cacheType, cacheSize) { Drive = drive; WorkPlan = workPlan; }
public Experiment( DataSet dataSet, Cardinality cardinality, IndexType indexType, ReservationBufferSize reservationBufferSize, CacheType cacheType, CacheSize cacheSize) { DataSet = dataSet; Cardinality = cardinality; IndexType = indexType; ReservationBufferSize = reservationBufferSize; CacheType = cacheType; CacheSize = cacheSize; }
public decimal[] this[int index, IndexType type] { get { // TODO Test Row(row) & Column(column) switch (type) { case IndexType.Row: return _data[index]; case IndexType.Column: return _data.Where((r, i) => i % index == 0).Select(r => r[index]).ToArray(); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } } }
unsafe public XnaHardwareIndexBuffer( HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, XFG.GraphicsDevice device, bool useSystemMemory, bool useShadowBuffer ) : base( manager, type, numIndices, usage, useSystemMemory, useShadowBuffer ) { _bufferType = ( type == IndexType.Size16 ) ? XFG.IndexElementSize.SixteenBits : XFG.IndexElementSize.ThirtyTwoBits; // create the buffer if (usage == BufferUsage.Dynamic || usage == BufferUsage.DynamicWriteOnly) { _xnaBuffer = new XFG.IndexBuffer(device, _bufferType, numIndices, XnaHelper.Convert(usage)); } else _xnaBuffer = new XFG.IndexBuffer(device, _bufferType, numIndices, XFG.BufferUsage.None); _bufferBytes = new byte[ sizeInBytes ]; _bufferBytes.Initialize(); }
public static IIndex CreateIndex(DirectoryInfo directory, IndexType type) { if (directory == null) throw new ArgumentNullException("directory", "directory cannot be null"); directory.Refresh(); if (!directory.Exists) directory.Create(); switch (type) { case IndexType.SingleIndex: return Index.Create(directory); case IndexType.DoubleIndex: return DoubleIndex.Create(directory); case IndexType.CyclicalIndex: return CyclicalIndex.Create(directory); default: throw new NotSupportedException(type.ToString() + " not supported"); } }
/// <summary> /// Constructor. /// </summary> /// <param name="type">Index type (16 or 32 bit).</param> /// <param name="numIndices">Number of indices in the buffer.</param> /// <param name="usage">Usage flags.</param> /// <param name="useShadowBuffer">Should this buffer be backed by a software shadow buffer?</param> public GLHardwareIndexBuffer(IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer) : base(type, numIndices, usage, false, useShadowBuffer) { // generate the buffer Gl.glGenBuffersARB(1, out bufferID); if(bufferID == 0) throw new Exception("Cannot create GL index buffer"); Gl.glBindBufferARB(Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID); // initialize this buffer. we dont have data yet tho Gl.glBufferDataARB( Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, sizeInBytes, IntPtr.Zero, GLHelper.ConvertEnum(usage)); }
public static IIndexResolver GetIndexResolver(IndexType indexType, string databaseName) { if (indexType == IndexType.DataIndex && String.IsNullOrEmpty(databaseName)) { Log.Error("Parameter 'Database name' must not be empty", typeof(ResolverFactory)); throw new ArgumentNullException("databaseName", "Parameter 'Database name' must not be empty"); } switch (indexType) { case IndexType.SearchIndex : return new SearchIndexResolver(); case IndexType.DataIndex: return new DataIndexResolver(databaseName); } return null; }
/// <summary> /// Constructor. /// </summary> /// <param name="manager"> the HardwareBufferManager instance that created this buffer. </param> /// <param name="type"> Index type (16 or 32 bit). </param> /// <param name="numIndices"> Number of indices in the buffer. </param> /// <param name="usage"> Usage flags. </param> /// <param name="useShadowBuffer"> Should this buffer be backed by a software shadow buffer? </param> public GLHardwareIndexBuffer( HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer ) : base( manager, type, numIndices, usage, false, useShadowBuffer ) { // generate the buffer Gl.glGenBuffersARB( 1, out this._bufferId ); if ( this._bufferId == 0 ) { throw new Exception( "OGL: Cannot create GL index buffer" ); } Gl.glBindBufferARB( Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, this._bufferId ); // initialize this buffer. we dont have data yet tho Gl.glBufferDataARB( Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, new IntPtr( sizeInBytes ), IntPtr.Zero, GLHelper.ConvertEnum( usage ) ); LogManager.Instance.Write( "OGL: Created IndexBuffer[{0}].", this._bufferId ); }
public IIndexerTask CreateTask(IndexType indexType) { switch (indexType) { case IndexType.Block: return(new BlockTask(_storageClient, _settings)); case IndexType.Summary: return(new BlockSummaryTask(_storageClient, _settings)); case IndexType.Transaction: return(new TransactionTask(_storageClient, _settings)); case IndexType.Address: return(new AddressTask(_network, _blockRepository, _storageClient, _settings)); default: throw new ArgumentOutOfRangeException(nameof(indexType), indexType, null); } }
protected async Task <IResult> Index(T value, IndexType indexType) { var indexClient = await _searchIndexClientProvider.Get <T>(indexType); var batch = IndexBatch.MergeOrUpload <T>(new List <T> { value }); try { await indexClient.Documents.IndexAsync <T>(batch); return(new SuccessfulResult()); } catch (IndexBatchException) { _logger.LogError($"Indexing failed for ${value.Id} in index {indexClient.IndexName}"); return(new FailedResult()); } }
public IndexReadOperation(Index index, LuceneVoronDirectory directory, IndexSearcherHolder searcherHolder, Transaction readTransaction) : base(index.Name, LoggingSource.Instance.GetLogger <IndexReadOperation>(index._indexStorage.DocumentDatabase.Name)) { try { _analyzer = CreateAnalyzer(() => new LowerCaseKeywordAnalyzer(), index.Definition.MapFields, forQuerying: true); } catch (Exception e) { throw new IndexAnalyzerException(e); } _indexType = index.Type; _indexHasBoostedFields = index.HasBoostedFields; _actualMaxIndexOutputsPerDocument = index.ActualMaxNumberOfIndexOutputs; _maxIndexOutputsPerDocument = index.MaxNumberOfIndexOutputs; _releaseReadTransaction = directory.SetTransaction(readTransaction); _releaseSearcher = searcherHolder.GetSearcher(readTransaction, out _searcher); }
private static BaseItem UnknownItem(IndexType indexType) { const string unknown = "<Unknown>"; switch (indexType) { case IndexType.Director: case IndexType.Actor: return(Person.GetPerson(unknown)); case IndexType.Studio: return(Studio.GetStudio(unknown)); case IndexType.Year: return(Year.GetYear(unknown)); default: return(Genre.GetGenre(unknown)); } }
/// <summary> /// Resolves the managed type of an index for a given index type. /// </summary> /// <param name="indexType">The index type.</param> /// <returns>The resolved managed index type..</returns> public static Type GetManagedIndexType(this IndexType indexType) { switch (indexType) { case IndexType.Index1D: return(typeof(Index1)); case IndexType.Index2D: return(typeof(Index2)); case IndexType.Index3D: return(typeof(Index3)); case IndexType.KernelConfig: return(typeof(KernelConfig)); default: throw new ArgumentOutOfRangeException(nameof(indexType)); } }
/// <summary> /// Constructor. /// </summary> /// <param name="type">Index type (16 or 32 bit).</param> /// <param name="numIndices">Number of indices in the buffer.</param> /// <param name="usage">Usage flags.</param> /// <param name="useShadowBuffer">Should this buffer be backed by a software shadow buffer?</param> public GLHardwareIndexBuffer(IndexType type, int numIndices, BufferUsage usage, bool useShadowBuffer) : base(type, numIndices, usage, false, useShadowBuffer) { // generate the buffer Gl.glGenBuffersARB(1, out bufferID); if (bufferID == 0) { throw new Exception("Cannot create GL index buffer"); } Gl.glBindBufferARB(Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID); // initialize this buffer. we dont have data yet tho Gl.glBufferDataARB( Gl.GL_ELEMENT_ARRAY_BUFFER_ARB, sizeInBytes, IntPtr.Zero, GLHelper.ConvertEnum(usage)); }
public void CreateIndex(string tn, IndexType t, string?rt, params string[] key) { asy.Write(Types.SCreateIndex); asy.PutString(tn); asy.WriteByte((byte)t); if (rt == null) { asy.PutInt(0); } else { asy.PutString(rt); } asy.PutInt(key.Length); foreach (var s in key) { asy.PutString(s); } var b = asy.Receive(); }
private static void ReadBuffer(HardwareIndexBuffer idxBuffer, int maxIndex, IndexType indexType, ref int[,] data) { IntPtr indices = idxBuffer.Lock(BufferLocking.ReadOnly); int faceCount = data.GetLength(0); if (indexType == IndexType.Size32) { // read the ints from the buffer data unsafe { int *pInts = (int *)indices.ToPointer(); for (int i = 0; i < faceCount; ++i) { for (int j = 0; j < 3; ++j) { Debug.Assert(i * 3 + j < maxIndex, "Read off end of index buffer"); data[i, j] = pInts[i * 3 + j]; } } } } else { // read the shorts from the buffer data unsafe { short *pShorts = (short *)indices.ToPointer(); for (int i = 0; i < faceCount; ++i) { for (int j = 0; j < 3; ++j) { Debug.Assert(i * 3 + j < maxIndex, "Read off end of index buffer"); data[i, j] = pShorts[i * 3 + j]; } } } } // unlock the buffer idxBuffer.Unlock(); }
/// <summary> /// Read and decode an index value From the reader. /// </summary> /// <param name="reader">The reader to read From.</param> /// <param name="index">The index type to read.</param> /// <returns>The index value.</returns> private TokenTypes ReadIndexValue(BinaryReader reader, IndexType index) { int width = GetIndexSize(index); TokenTypes value = (TokenTypes)(2 == width ? (0xffff & (int)reader.ReadInt16()) : reader.ReadInt32()); // Do we need to decode a coded index? if (index < IndexType.CodedIndexCount) { int bits = IndexBits[(int)index]; int mask = 1; for (int i = 1; i < bits; i++) { mask = (mask << 1) | 1; } // Get the table int table = (int)value & mask; // Correct the value value = (TokenTypes)(((int)value >> bits) | IndexTables[(int)index][table]); } else { switch (index) { case IndexType.StringHeap: value |= TokenTypes.String; break; case IndexType.GuidHeap: value |= TokenTypes.Guid; break; case IndexType.BlobHeap: value |= TokenTypes.Blob; break; } } return(value); }
public GeometryBucket(MaterialBucket parent, string formatString, VertexData vData, IndexData iData) { // Clone the structure from the example this.parent = parent; this.formatString = formatString; vertexData = vData.Clone(false); indexData = iData.Clone(false); vertexData.vertexCount = 0; vertexData.vertexStart = 0; indexData.indexCount = 0; indexData.indexStart = 0; indexType = indexData.indexBuffer.Type; queuedGeometry = new List<QueuedGeometry>(); // Derive the max vertices if (indexType == IndexType.Size32) maxVertexIndex = int.MaxValue; else maxVertexIndex = ushort.MaxValue; // Check to see if we have blend indices / blend weights // remove them if so, they can try to blend non-existent bones! VertexElement blendIndices = vertexData.vertexDeclaration.FindElementBySemantic(VertexElementSemantic.BlendIndices); VertexElement blendWeights = vertexData.vertexDeclaration.FindElementBySemantic(VertexElementSemantic.BlendWeights); if (blendIndices != null && blendWeights != null) { Debug.Assert(blendIndices.Source == blendWeights.Source, "Blend indices and weights should be in the same buffer"); // Get the source ushort source = blendIndices.Source; Debug.Assert(blendIndices.Size + blendWeights.Size == vertexData.vertexBufferBinding.GetBuffer(source).VertexSize, "Blend indices and blend buffers should have buffer to themselves!"); // Unset the buffer vertexData.vertexBufferBinding.UnsetBinding(source); // Remove the elements vertexData.vertexDeclaration.RemoveElement(VertexElementSemantic.BlendIndices); vertexData.vertexDeclaration.RemoveElement(VertexElementSemantic.BlendWeights); } }
public AccelerationStructureGeometryTrianglesDataKHR ( StructureType sType = StructureType.AccelerationStructureGeometryTrianglesDataKhr, void *pNext = default, Format vertexFormat = default, DeviceOrHostAddressConstKHR vertexData = default, ulong vertexStride = default, IndexType indexType = default, DeviceOrHostAddressConstKHR indexData = default, DeviceOrHostAddressConstKHR transformData = default ) { SType = sType; PNext = pNext; VertexFormat = vertexFormat; VertexData = vertexData; VertexStride = vertexStride; IndexType = indexType; IndexData = indexData; TransformData = transformData; }
/// <summary> /// Searches the alinks- or klinks-index for a specific keyword/associative /// </summary> /// <param name="search">keyword/associative to search</param> /// <param name="typeOfIndex">type of index to search</param> /// <returns>Returns an list which contains IndexTopic items or null if nothing was found</returns> public HtmlHelpIndexItem SearchIndex(string search, IndexType typeOfIndex) { IList <HtmlHelpIndexItem> _index = null; switch (typeOfIndex) { case IndexType.AssiciativeLinks: _index = _aLinks; break; case IndexType.KeywordLinks: _index = _kLinks; break; } int insertIdx = 0; HtmlHelpIndexItem foundItem = BinSearch(0, _index.Count, _index, search, true, true, ref insertIdx); return(foundItem); }
public AccelerationStructureCreateGeometryTypeInfoKHR ( StructureType sType = StructureType.AccelerationStructureCreateGeometryTypeInfoKhr, void *pNext = default, GeometryTypeKHR geometryType = default, uint maxPrimitiveCount = default, IndexType indexType = default, uint maxVertexCount = default, Format vertexFormat = default, Bool32 allowsTransforms = default ) { SType = sType; PNext = pNext; GeometryType = geometryType; MaxPrimitiveCount = maxPrimitiveCount; IndexType = indexType; MaxVertexCount = maxVertexCount; VertexFormat = vertexFormat; AllowsTransforms = allowsTransforms; }
public void SetIndexData(BufferView buffer, int byteOffset, IndexType encoding, int count) { Guard.NotNull(buffer, nameof(buffer)); Guard.MustShareLogicalParent(this, buffer, nameof(buffer)); if (buffer.DeviceBufferTarget.HasValue) { Guard.IsTrue(buffer.DeviceBufferTarget.Value == BufferMode.ELEMENT_ARRAY_BUFFER, nameof(buffer)); } Guard.MustBeGreaterThanOrEqualTo(byteOffset, 0, nameof(byteOffset)); Guard.MustBeGreaterThan(count, 0, nameof(count)); this._bufferView = buffer.LogicalIndex; this._componentType = encoding.ToComponent(); this._type = ElementType.SCALAR; this._normalized = null; this._byteOffset = byteOffset; this._count = count; _UpdateBounds(1); }
public static void Main(string[] args) { var indexable = new MyFooIndexableObject(); var index1 = new IndexType(0); var index2 = new IndexType(1); ValueType someValue; //do someValue = indexable[index1] someValue = indexable.FooGet(index1); //do indexable[index1] = new ValueType() indexable.FooSet(index1, new ValueType()); //this does not make sense will not work //do Swap( out indexable[index1], out indexable[index2] ) //just look how you would try to do this Swap(ref indexable.FooGet(index1), ref indexable.FooGet(index2)); //Swap is looking for reference to a location in memory //but the method is returning the value of an object reference //which you can store in a variable with a location in memory //but has yet been assigned to one //Please note the whole idea of "location in memory" is abstract //it does not technically mean an actual location in physical //memory but probably an abstraction handled by .NET, //don't try to hard to make sure you have the technical part //100% correct, you are significantly detached from the metal //when coding at this level...the basic idea is the same //as physical memory locations on a machine //However, you can accomplish the same things that you would //want to accomplish with "out" and "ref" by creating methods //that take the indexed object and an index, such as the //SwapValueAtIndex method indexable.SwapValueAtIndex(index1, index2); //While precisely what SwapValueAtIndex does may //not translate to what Swap does logically //it is the same thing, which is good enough for us }
public IIndex <TKey, TSource> BuildIndex(IEnumerable <TSource> source, IndexType indexType, bool recalculateIndex = false) { if (this.indexType == indexType) { if (IndexCollection == null || recalculateIndex) { Func <TSource, TKey> keySelectorExecutable = KeySelector.Compile(); IIndex <TKey, TSource> indexCollection = null; if (indexType == IndexType.EqualIndex) { indexCollection = source.IndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable); } else { indexCollection = source.UnequalIndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable); } IndexCollection = indexCollection; } return(IndexCollection); } else { if (IndexCollection == null || recalculateIndex) { this.indexType = indexType; Func <TSource, TKey> keySelectorExecutable = KeySelector.Compile(); IIndex <TKey, TSource> indexCollection = null; if (indexType == IndexType.EqualIndex) { indexCollection = source.IndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable); } else { indexCollection = source.UnequalIndexSpecificationToIndex <TSource, TKey>(keySelectorExecutable); } IndexCollection = indexCollection; } return(IndexCollection); } }
public static SparseMatrix <indexT1, dataT1> CreateCooAoS <indexT1, dataT1>( long rows, long cols, long nnz, CudaDeviceVariable <indexT1> cooInd, CudaDeviceVariable <dataT1> cooValues, IndexBase idxBase) where indexT1 : struct where dataT1 : struct { cusparseSpMatDescr descr = new cusparseSpMatDescr(); IndexType typeIndices = IndexTypeTranslator.GetType(typeof(indexT1)); cudaDataType typeData = CudaDataTypeTranslator.GetType(typeof(dataT1)); cusparseStatus res = CudaSparseNativeMethods.cusparseCreateCooAoS(ref descr, rows, cols, nnz, cooInd.DevicePointer, cooValues.DevicePointer, typeIndices, idxBase, typeData); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateCooAoS", res)); if (res != cusparseStatus.Success) { throw new CudaSparseException(res); } return(new SparseMatrix <indexT1, dataT1>(descr, rows, cols, nnz, idxBase, typeIndices, typeData)); }
/// <summary> /// /// </summary> public void CsrGet(out CudaDeviceVariable <indexT> csrRowOffsets, out CudaDeviceVariable <indexT> csrColInd, out CudaDeviceVariable <dataT> csrValues) { CUdeviceptr ptrRowOffsets = new CUdeviceptr(); CUdeviceptr ptrColIdx = new CUdeviceptr(); CUdeviceptr ptrValues = new CUdeviceptr(); IndexType indexTypeOffset = IndexType.Index32I; res = CudaSparseNativeMethods.cusparseCsrGet(descr, ref rows, ref cols, ref nnz, ref ptrRowOffsets, ref ptrColIdx, ref ptrValues, ref indexTypeOffset, ref typeIndices, ref idxBase, ref typeData); Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCsrGet", res)); if (res != cusparseStatus.Success) { throw new CudaSparseException(res); } csrRowOffsets = new CudaDeviceVariable <indexT>(ptrRowOffsets); csrColInd = new CudaDeviceVariable <indexT>(ptrColIdx); csrValues = new CudaDeviceVariable <dataT>(ptrValues); }
/// <summary> /// Extention method to turn a string into a <see cref="IndexType"/> enum /// </summary> /// <param name="type">Index type enum, automatically passed in</param> /// <param name="indexType">Index type string to turn into the enum</param> /// <returns></returns> public static IndexType FromString(this IndexType type, string indexType) { IndexType returnType = IndexType.NONUNIQUE; if (indexType != null && indexType != "") { if (indexType == "PRIMARY") { returnType = IndexType.PRIMARY; } else if (indexType == "UNIQUE") { returnType = IndexType.UNIQUE; } else if (indexType == "FOREIGN") { returnType = IndexType.FOREIGN; } } return(returnType); }
public Loan(Date startDate, Date maturityDate, Date firstPaymentDate, double notional, int numOfPayment, IDayCount dayCount, Frequency frequency, double coupon, Date resetDate, bool isFloatingRate, IndexType indexType, double floatingRateMultiplier, AmortizationType amortizationType, CurrencyCode currency = CurrencyCode.CNY, IMortgageCalculator mortgageCalculator = null, double taxRate = 0.0 ) { StartDate = startDate; UnderlyingMaturityDate = maturityDate; FirstPaymentDate = firstPaymentDate; NumOfPayment = numOfPayment; Notional = notional; DayCount = dayCount; Frequency = frequency; Coupon = coupon; TaxRate = taxRate; ResetDate = resetDate; IsFloatingRate = isFloatingRate; IndexType = indexType; FloatingRateMultiplier = floatingRateMultiplier; Currency = currency; _implicitAccStartDate = Frequency.GetTerm().Prev(FirstPaymentDate); AmortizationType = amortizationType; MortgageCalculator = mortgageCalculator ?? new SimpleMortgageCalculator(new Psa(), new Sda()); Accruals = new Schedule(_implicitAccStartDate, UnderlyingMaturityDate, Frequency.GetTerm(), Stub.ShortEnd).ToArray(); _numPastPayment = NumOfPayment - (Accruals.Length - 1); }
public void ResetAbst(AbstractType abstractType = AbstractType.RegName, IndexType indexType = IndexType.Index) { switch (indexType) { default: case IndexType.Index: abst = Index; break; case IndexType.Name: abst = Name; Index = Name; break; case IndexType.RegName: abst = RegName; Index = RegName; break; } switch (abstractType) { default: case AbstractType.RegName: abst += " " + RegName; break; case AbstractType.Name: abst += " " + Name; break; case AbstractType.UIName: abst += " " + UIName; break; case AbstractType.IndexOnly: abst += ""; break; } }
private Token ReadMetadataToken(BinaryReader reader, IndexType index) { int value = (GetIndexSize(index) == 2) ? (0x0000FFFF & (int)reader.ReadInt16()) : reader.ReadInt32(); Debug.Assert(index < IndexType.CodedIndexCount); int bits = IndexBits[(int)index]; int mask = 1; for (int i = 1; i < bits; i++) { mask = (mask << 1) | 1; } // Get the table int table = (int)value & mask; // Correct the value value = ((int)value >> bits); return(new Token((TableType)IndexTables[(int)index][table], value)); }
public D3DHardwareIndexBuffer( HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, D3D.Device device, bool useSystemMemory, bool useShadowBuffer ) : base( manager, type, numIndices, usage, useSystemMemory, useShadowBuffer ) { #if !NO_AXIOM_D3D_MANAGE_BUFFERS d3dPool = useSystemMemory ? D3D.Pool.SystemMemory : // If not system mem, use managed pool UNLESS buffer is discardable // if discardable, keeping the software backing is expensive ( ( usage & BufferUsage.Discardable ) != 0 ) ? D3D.Pool.Default : D3D.Pool.Managed; #else d3dPool = useSystemMemory ? Pool.SystemMemory : Pool.Default; #endif device = D3DRenderSystem.ActiveD3D9Device; // temp hack (update to 1.7) // create the buffer d3dBuffer = new D3D.IndexBuffer( device, sizeInBytes, D3DHelper.ConvertEnum( usage ), d3dPool, type == IndexType.Size16 ); }
/// <summary> /// Gets the number of index items for a specific type /// </summary> /// <param name="typeOfIndex">type of index</param> /// <returns>Returns the number of index items for a specific type</returns> public int Count(IndexType typeOfIndex) { IList <HtmlHelpIndexItem> _index = null; switch (typeOfIndex) { case IndexType.AssiciativeLinks: _index = _aLinks; break; case IndexType.KeywordLinks: _index = _kLinks; break; } if (_index != null) { return(_index.Count); } return(0); }
public D3D9HardwareIndexBuffer(HardwareBufferManagerBase manager, IndexType type, int numIndices, BufferUsage usage, bool useSystemMemory, bool useShadowBuffer) : base(manager, type, numIndices, usage, useSystemMemory, useShadowBuffer) { //Entering critical section this.LockDeviceAccess(); this._mapDeviceToBufferResources = new Dictionary <D3D9.Device, BufferResources>(); #if AXIOM_D3D_MANAGE_BUFFERS var eResourcePool = useSystemMemory ? D3D9.Pool.SystemMemory : // If not system mem, use managed pool UNLESS buffer is discardable // if discardable, keeping the software backing is expensive ((usage & BufferUsage.Discardable) != 0) ? D3D9.Pool.Default : D3D9.Pool.Managed; #else var eResourcePool = useSystemMemory ? D3D9.Pool.SystemMemory : D3D9.Pool.Default; #endif // Set the desired memory pool. this._bufferDesc.Pool = eResourcePool; // Allocate the system memory buffer. this._systemMemoryBuffer = BufferBase.Wrap(new byte[sizeInBytes]); // Case we have to create this buffer resource on loading. if (D3D9RenderSystem.ResourceManager.CreationPolicy == D3D9ResourceManager.ResourceCreationPolicy.CreateOnAllDevices) { foreach (var d3d9Device in D3D9RenderSystem.ResourceCreationDevices) { CreateBuffer(d3d9Device, this._bufferDesc.Pool); } } D3D9RenderSystem.ResourceManager.NotifyResourceCreated(this); //Leaving critical section this.UnlockDeviceAccess(); }
/// <summary> /// 获得指数的日期规则 /// </summary> /// <param name="index">指数</param> /// <returns>日期规则</returns> public static IDayCount DayCount(this IndexType index) { switch (index) { case IndexType.Depo1Y: case IndexType.Depo3M: case IndexType.Depo6M: case IndexType.Depo2Y: case IndexType.Depo3Y: case IndexType.Depo5Y: return(new B30360()); case IndexType.Shibor1D: case IndexType.Shibor1W: case IndexType.Shibor2W: case IndexType.Shibor1M: case IndexType.Shibor3M: case IndexType.Shibor6M: case IndexType.Shibor9M: case IndexType.Shibor1Y: return(new Act360()); case IndexType.Fr001: case IndexType.Fr007: return(new Act365()); case IndexType.B1M: case IndexType.B1W: case IndexType.B2W: case IndexType.B_1M: case IndexType.B_1W: case IndexType.B_2W: return(new Act365()); default: return(new Act365()); } }
/// <summary> /// 获得指数的日期规则名称 /// </summary> /// <param name="index">指数</param> /// <returns>日期规则</returns> public static string DayCountEnum(this IndexType index) { switch (index) { case IndexType.Depo1Y: case IndexType.Depo3M: case IndexType.Depo6M: case IndexType.Depo2Y: case IndexType.Depo3Y: case IndexType.Depo5Y: return("B30360"); case IndexType.Shibor1D: case IndexType.Shibor1W: case IndexType.Shibor2W: case IndexType.Shibor1M: case IndexType.Shibor3M: case IndexType.Shibor6M: case IndexType.Shibor9M: case IndexType.Shibor1Y: return("Act360"); case IndexType.Fr001: case IndexType.Fr007: return("Act365"); case IndexType.B1M: case IndexType.B1W: case IndexType.B2W: case IndexType.B_1M: case IndexType.B_1W: case IndexType.B_2W: return("Act365"); default: return("Act365"); } }
/// <summary> /// Delete an index /// </summary> /// <returns>A Task</returns> /// <param name="indexName">name of the index</param> /// <param name="designDocId">ID of the design doc</param> /// <param name="indexType">The type of index to delete</param> public async Task DeleteIndexAsync(String indexName, String designDocId, IndexType indexType) { if (string.IsNullOrWhiteSpace(indexName)) { throw new ArgumentException("The indexName parameter may not be null, empty or contain only whitespace."); } if (string.IsNullOrWhiteSpace(designDocId)) { throw new ArgumentException("The designDocId parameter may not be null, empty or contain only whitespace."); } String indexTypeString = indexType.ToString(); Uri indexUri = new Uri( dbNameUrlEncoded + "/_index/" + designDocId + "/" + indexTypeString + "/" + indexName, UriKind.Relative); var response = await client.httpHelper.DeleteAsync(indexUri, null).ConfigureAwait(continueOnCapturedContext: false); if (response.StatusCode == HttpStatusCode.OK) { return; } else if (response.StatusCode == HttpStatusCode.NotFound) { throw new DataException( DataException.Database_IndexModificationFailure, string.Format( "Index with name [{0}] and design doc [{1}] does not exist.", indexName, designDocId)); } else { throw new DataException(DataException.Database_IndexModificationFailure, string.Format("Error deleting index: {0}", await response.Content.ReadAsStringAsync())); } }
/// <summary> /// Call this method to build the help-index and fill the internal list box /// </summary> /// <param name="index">Index instance extracted from the chm file(s)</param> /// <param name="typeOfIndex">type of index to display</param> /// <param name="filter">information type/category filter</param> public void BuildIndex(Index index, IndexType typeOfIndex, InfoTypeCategoryFilter filter) { switch (typeOfIndex) { case IndexType.AssiciativeLinks: _arrIndex = index.ALinks; break; case IndexType.KeywordLinks: _arrIndex = index.KLinks; break; } lbIndex.Items.Clear(); foreach (IndexItem curItem in _arrIndex) { bool bAdd = true; if (filter != null) { bAdd = false; if (curItem.InfoTypeStrings.Count <= 0) { bAdd = true; } else { for (int i = 0; i < curItem.InfoTypeStrings.Count; i++) { bAdd |= filter.Match(curItem.InfoTypeStrings[i].ToString()); } } } if (bAdd) { lbIndex.Items.Add(curItem.IndentKeyWord); } } }
public string ScriptCreate() { switch (Type) { case "CHECK": var notForReplicationOption = _isNotForReplication ? "NOT FOR REPLICATION" : ""; return($"CONSTRAINT [{Name}] CHECK {notForReplicationOption} {_checkConstraintExpression}"); case "INDEX": var sql = $"CREATE{UniqueText}{IndexType.Space()} INDEX [{Name}] ON [{Table.Owner}].[{Table.Name}] ({string.Join(", ", Columns.Select(c => c.Script()).ToArray())})"; if (IncludedColumns.Count > 0) { sql += $" INCLUDE ([{string.Join("], [", IncludedColumns.ToArray())}])"; } if (!string.IsNullOrEmpty(Filter)) { sql += $" WHERE {Filter}"; } return(sql); } return((Table.IsType ? string.Empty : $"CONSTRAINT [{Name}] ") + $"{Type}{IndexType.Space()} ({string.Join(", ", Columns.Select(c => c.Script()).ToArray())})"); }
public static string IndexTypeToString(IndexType indexType) { switch (indexType) { case IndexType.CapConstraint: return("cap"); case IndexType.Hash: return("hash"); case IndexType.Skiplist: return("skiplist"); case IndexType.Geo: return("geo"); case IndexType.Fulltext: return("fulltext"); default: throw new InvalidOperationException($"IndexTypeToString {indexType} binding not found, this is a client bug"); } }
protected void SetSingleValue<T>(SignatureTag tag, IndexType type, T value) { IndexRecord record = new IndexRecord() { Header = new IndexHeader() { Count = 1, Offset = 0, Tag = (uint)tag, Type = type }, Value = value }; if (!this.Package.Signature.Records.ContainsKey(tag)) { this.Package.Signature.Records.Add(tag, record); } else { this.Package.Signature.Records[tag] = record; } }
public D3DHardwareIndexBuffer(IndexType type, int numIndices, BufferUsage usage, D3D.Device device, bool useSystemMemory, bool useShadowBuffer) : base(type, numIndices, usage, useSystemMemory, useShadowBuffer) { #if !NO_OGRE_D3D_MANAGE_BUFFERS d3dPool = useSystemMemory? Pool.SystemMemory : // If not system mem, use managed pool UNLESS buffer is discardable // if discardable, keeping the software backing is expensive ((usage & BufferUsage.Discardable) != 0) ? Pool.Default : Pool.Managed; #else d3dPool = useSystemMemory ? Pool.SystemMemory : Pool.Default; #endif Type bufferType = (type == IndexType.Size16) ? typeof(short) : typeof(int); // create the buffer d3dBuffer = new IndexBuffer( bufferType, //sizeInBytes, // sizeInBytes is wrong, because the D3D API is expecting the number of indices numIndices, device, D3DHelper.ConvertEnum(usage), d3dPool); }