import { ParseBuffer } from "../../dependencies/conway-geom/interface/parse_buffer.js"; import { Entity } from "../core/entity.js"; import { EntityDescription, EntityFieldsDescription } from "../core/entity_description.js"; import { EntityFieldDescription } from "../core/entity_field_description.js"; import { WasmModule } from "../core/native_types.js"; import { StepEntityConstructorAbstract } from "./step_entity_constructor.js"; import StepEntityInternalReference from "./step_entity_internal_reference.js"; import StepModelBase from "./step_model_base.js"; declare enum IfcTokenType { UNKNOWN = 0, STRING = 1, LABEL = 2, ENUM = 3, REAL = 4, REF = 5, EMPTY = 6, SET_BEGIN = 7, SET_END = 8, LINE_END = 9 } /** * The base type for entities parsed from STEP. */ export default abstract class StepEntityBase implements Entity { readonly localID: number; private readonly internalReference_; readonly model: StepModelBase; /** * Get the final type of this STEP entity. */ abstract get type(): EntityTypeIDs; /** * Get the reflecterd type info for this element/entity. * * @return {EntityDescription} The entity description for this. */ get typeInfo(): EntityDescription; /** * Get all the variants of this entity (including this) if it is an external * mapping with multiple variants. This allows the optional-mulitiple-inheritance * relationanships in STEP to be represented. * * @return {StepEntityBase[]} The variants of this entity. */ get variants(): StepEntityBase[] | undefined; findVariant, O extends InstanceType & StepEntityBase>(instanceType: T): O | undefined; /** * Get the reflected fields of this. * * @return {EntityFieldsDescription} */ get fields(): EntityFieldsDescription; /** * Get the reflected fields of this. * * @return {EntityFieldsDescription} */ get orderedFields(): [ string, EntityFieldDescription ][]; /** * Get the number of dimensions for this, some functions require every object to have this, * * The default value is 0. * * @return {number} The number of dimensions. */ get Dim(): number; /** * Get the express ID for this, note that if an element is inlined, * it will have not have an express ID. * * @return {number | undefined} The express ID of this or undefined if there isn't one. */ get expressID(): number | undefined; /** * Is this an inline element or fully specified? * * @return {boolean} Is this inline? */ get isInline(): boolean; /** * Convert this to a string (which is the equivalent to a reference or * '#inline' for inline elements). * * @return {string} Convert this to a string */ toString(): string; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Whether this is a potentially optional field * @return {number | null | undefined} The extracted number. */ extractNumber(offset: number, baseOffset: number, depth: number, optional: true): number | null; extractNumber(offset: number, baseOffset: number, depth: number, optional: false): number; /** * Extract a string at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Is this an optional field? * @return {string | null} The extracted string, or null if optional * and this value isn't specified. */ extractString(offset: number, baseOffset: number, depth: number, optional: true): string | null; extractString(offset: number, baseOffset: number, depth: number, optional: false): string; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Is this an optional field? * @return {boolean | null} The extracted logical or null for optionals. */ extractLogical(offset: number, baseOffset: number, depth: number, optional: true): boolean | null; extractLogical(offset: number, baseOffset: number, depth: number, optional: false): boolean; /** * Extract a reference from an offset, without type check. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Is this an optional field? * @return {StepEntityBase | undefined} Extracted entity or undefined. */ extractReference(offset: number, baseOffset: number, depth: number, optional: true): StepEntityBase | null; extractReference(offset: number, baseOffset: number, depth: number, optional: false): StepEntityBase; /** * * @param buffer * @param cursor * @return {{ data: string, length: number }} string and length */ readStringView(buffer: Uint8Array, cursor: number): { data: string; length: number; }; /** * * @param buffer * @param cursor * @param t ifc token type * @return {any} ifc token */ readValue(buffer: Uint8Array, cursor: number, t: IfcTokenType): { value: string; length: number; } | { value: number; length: number; } | { value: undefined; length: number; }; /** * * @return {Uint8Array} buffer containing line data up to the semicolon */ extractLineArguments(): Uint8Array; /** * Extract a reference from a buffer, without type check. * * @param buffer The buffer to extract from. * @param cursor The position in the buffer to extract from. * @param endCursor The ending cursor. * @return {StepEntityBase | undefined} Extracted entity or undefined. */ protected extractBufferReference(buffer: Uint8Array, cursor: number, endCursor: number): StepEntityBase | undefined; /** * Extract a flat array of references * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @return {Array} array of values */ extractArray(offset: number, baseOffset: number, depth: number): Array | undefined>; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * ExtractionType Type to be extracted * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param extractor The function to be used for extraction. * @param optional Is this an optional field? (true) * @return {ExtractionType | null} The extracted value or null for optionals. */ extractLambda(offset: number, baseOffset: number, depth: number, extractor: (buffer: Uint8Array, cursor: number, endCursor: number) => ExtractionType | null | undefined, optional: true): ExtractionType | null; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * ExtractionType Type to be extracted * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param extractor The function to be used for extraction. * @param optional Is this an optional field? (false) * @return {ExtractionType} The extracted value or null for optionals. */ extractLambda(offset: number, baseOffset: number, depth: number, extractor: (buffer: Uint8Array, cursor: number, endCursor: number) => ExtractionType | undefined, optional: false): ExtractionType; /** * Extract a string at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Is this an optional field? (true) * @return {StepEntityBase | null} The extracted element, or null if optional * and this value isn't specified. */ extractElement>(offset: number, baseOffset: number, depth: number, optional: true, entityConstructor: T): InstanceType | null; /** * Extract a string at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param baseOffset The base offset in the vtable to extract from * @param depth The depth of the vtable to extract from * @param optional Is this an optional field? (false) * @return {StepEntityBase} The extracted element. */ extractElement>(offset: number, baseOffset: number, depth: number, optional: false, entityConstructor: T): InstanceType; /** * Extract a string at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param buffer The buffer to extract from * @param cursor The cursor to extract from. * @param endCursor The end of the memory space to extract from. * @param entityConstructor The entity constructor to use for type checks. * @return {StepEntityBase | undefined } The extracted element, or null if optional * and this value isn't specified. */ protected extractBufferElement>(buffer: Uint8Array, cursor: number, endCursor: number, entityConstructor: T): InstanceType | undefined; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param optional Is this an optional field? * @return {boolean | null} The extracted number. */ extractBinary(offset: number, baseOffset: number, depth: number, optional: true): [ Uint8Array, number ] | null; extractBinary(offset: number, baseOffset: number, depth: number, optional: false): [ Uint8Array, number ]; /** * Make it so this particular object is not held in the cache. */ invalidate(): void; /** * Extract a parse buffer at a particular vtable offset. * * @param offset * @param baseOffset * @param depth * @param result * @param module * @param optional * @return {boolean} True if this extracts, false (usually because this is optional) */ extractParseBuffer(offset: number, baseOffset: number, depth: number, result: ParseBuffer, module: WasmModule, optional: boolean): boolean; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param optional Is this an optional field? (true) * @return {boolean | null} The extracted number or null if it's * not supplied. */ extractBoolean(offset: number, baseOffset: number, depth: number, optional: true): boolean | null; /** * Extract a number at the particular vtable offset (i.e. the position * in the matching step object). * * Used by other extraction methods with wrappers to perform * semantically correct extraction. * * @param offset The offset in the vtable to extract from * @param optional Is this an optional field? (false). * @return {boolean} The extracted number. */ extractBoolean(offset: number, baseOffset: number, depth: number, optional: false): boolean; /** * Get the backing buffer for this. Note this is only for internal * code-gen purposes, and is unsafe otherwise. * * @return {Uint8Array} The buffer for this. */ protected get buffer(): Uint8Array; /** * Get both the buffer offset and end cursor for * a particular vtable offset. * * @param offset The offset in the v-table to get the cursor for. * @param baseOffset The base offset of the class in the v-table. * @param depth The depth in the inheritence hierarchy. * @return {[number,number]} The cursor and end cursor in the read buffer. */ protected getOffsetAndEndCursor(offset: number, baseOffset: number, depth: number): [ number, number, Uint8Array ]; /** * Get the buffer cursor for a particular offset. * * @param offset The offset in the v-table to get the cursor for. * @param baseOffset The base offset of the class in the v-table. * @param depth The depth in the inheritence hierarchy. * @return {number} The cursor. */ protected getOffsetCursor(offset: number, baseOffset: number, depth: number): number; /** * Get the buffer cursor for a particular offset. * * @param offset The offset in the v-table. * @param internalReference The internal reference to use for the vtable. * @return {number} The cursor. */ protected getEndCursor(offset: number, internalReference: Required>): number; /** * Construct this with the local ID, internal reference and * the model. * * @param localID The local (dense) ID within the model, that acts as a reference. * @param internalReference_ The internal reference to model components etc. * @param model The model this came from. */ constructor(localID: number, internalReference_: StepEntityInternalReference, model: StepModelBase, _multiReference?: StepEntityInternalReference[]); protected multiReference_?: StepEntityInternalReference[]; /** * Guarantees the VTable of this has been parsed from the model so that values can be read out. * * @param {number} depth The depth in the inheritence hierarchy. * @return {StepEntityInternalReference} The internal reference for this. */ protected guaranteeVTable(depth: number): Required>; /** * Guarantees the VTable of this has been parsed from the model so that values can be read out. */ protected guaranteeBuffer(): void; } export {}; //# sourceMappingURL=step_entity_base.d.ts.map