OpenCascade.js
API ReferenceFoundationClassesTKernel

Standard

OCCT package Standard: Handle_Standard_Type, Standard, Standard_ArrayStreamBuffer, Standard_CLocaleSentry, and 36 more bound classes.

Standard

The package Standard provides global memory allocator and other basic services used by other OCCT components.

Constructors(1)

Static methods(2)

  • GetAllocatorType(): Standard_AllocatorType

    Returns default allocator type.

  • Purge(): number

    Deallocates the storage retained on the free list and clears the list. Returns non-zero if some memory has been actually freed.

Standard_ArrayStreamBuffer

streambuf

Custom buffer object implementing STL interface std::streambuf for streamed reading from allocated memory block. Implements minimal sub-set of methods for passing buffer to std::istream, including seek support.
This class can be used for creating a seekable input stream in cases, when the source data does not satisfies Reader requirements (non-seekable stream, compressed data) or represents an in-memory resource.
The memory itself is NOT managed by this class - it is up to the caller to ensure that passed memory pointer is not released during Standard_ArrayStreamBuffer lifetime.
Usage example:

constchar*theBuffer; constsize_ttheBufferLength; Standard_ArrayStreamBufferaStreamBuffer(theBuffer,theBufferLength); std::istreamaStream(&aStreamBuffer); TopoDS_ShapeaShape; BRep_BuilderaBuilder; BRepTools::Read(aShape,aStream,aBuilder);

Constructors(1)

  • constructor(theBegin: string, theSize: number): Standard_ArrayStreamBuffer

    Main constructor. Passed pointer is stored as is (memory is NOT copied nor released with destructor).

    Parameters (2)
    • theBegin
      pointer to the beginning of pre-allocated buffer
    • theSize
      length of pre-allocated buffer

Instance methods(2)

  • Init(theBegin: string, theSize: number): void

    (Re)-initialize the stream. Passed pointer is stored as is (memory is NOT copied nor released with destructor).

    Parameters (2)
    • theBegin
      pointer to the beginning of pre-allocated buffer
    • theSize
      length of pre-allocated buffer
  • xsgetn(thePtr: string, theCount: number): number

    Read a bunch of bytes at once.

    Parameters (2)
    • thePtr
    • theCount

Standard_CLocaleSentry

We check _GNU_SOURCE for glibc extensions here and it is always defined by g++ compiler.
This class intended to temporary switch C locale and logically equivalent to setlocale(LC_ALL, "C"). It is intended to format text regardless of user locale settings (for import/export functionality). Thus following calls to Sprintf, atoi and other functions will use "C" locale. Destructor of this class will return original locale.
Notice that this functionality is platform dependent and intended only to workaround alien code that doesn't setup locale correctly.
Internally you should prefer more portable C++ locale interfaces or OCCT wrappers to some C functions like Sprintf, Atof, Strtod.

Constructors(1)

Static methods(1)

  • GetCLocale(): unknown
    Returns

    locale "C" instance (locale_t within xlocale or _locale_t within Windows) to be used for _l functions with locale argument.

Standard_Condition

This is boolean flag intended for communication between threads. One thread sets this flag to TRUE to indicate some event happened and another thread either waits this event or checks periodically its state to perform job.
This class provides interface similar to WinAPI Event objects.

Constructors(1)

Instance methods(6)

  • Set(): void

    Set event into signaling state.

  • Reset(): void

    Reset event (unset signaling state).

  • Wait(): void

    Wait for Event (infinity).

  • Wait(theTimeMilliseconds: number): boolean

    Wait for signal requested time.

    Parameters (1)
    • theTimeMilliseconds
      wait limit in milliseconds
    Returns

    true if get event

  • Check(): boolean

    Do not wait for signal - just test it state.

    Returns

    true if get event

  • CheckReset(): boolean

    Method perform two steps at-once - reset the event object and returns true if it was in signaling state.

    Returns

    true if event object was in signaling state.

Standard_Failure

exception

Forms the root of the entire exception hierarchy. Inherits from std::exception and implements what() interface.

Constructors(4)

Static methods(2)

Instance methods(4)

  • what(): string

    Returns error message (implements std::exception interface). Returns empty string "" if no message was set.

  • Returns error message.

    Deprecated
  • ExceptionType(): string

    Returns the exception type name. Default implementation returns "Standard_Failure". Derived classes override this to return their own type name.

  • GetStackString(): string

    Returns the stack trace string (empty string if not available).

Standard_GUID

Constructors(4)

Static methods(1)

  • CheckGUIDFormat(aGuid: string): boolean

    Check the format of a GUID string. It checks the size, the position of the '-' and the correct size of fields.

    Parameters (1)
    • aGuid

Instance methods(7)

  • ToCString(aStrGuid: string): void

    translate the GUID into ascii string the aStrGuid is allocated by user. the guid have the following format:
    "00000000-0000-0000-0000-000000000000"

    Parameters (1)
    • aStrGuid
  • ToExtString(aStrGuid: string): void

    translate the GUID into unicode string the aStrGuid is allocated by user. the guid have the following format:
    "00000000-0000-0000-0000-000000000000"

    Parameters (1)
    • aStrGuid
  • Converts to Standard_UUID.

  • IsSame(uid: Standard_GUID): boolean

    Returns true if this GUID is equal to uid.

    Parameters (1)
    • uid
  • IsNotSame(uid: Standard_GUID): boolean

    Returns true if this GUID is not equal to uid.

    Parameters (1)
    • uid
  • Assign(uid: Standard_GUID): void

    Assigns uid to this GUID.

    Parameters (1)
    • uid
  • Assign(uid: Standard_UUID): void

    Assigns uid to this GUID.

    Parameters (1)
    • uid

Standard_HMutex

Template defining a class derived from the specified base class and Standard_Transient, and supporting OCCT RTTI.
This provides possibility to use Handes for types not initially intended to be dynamically allocated.
Current limitation is that only copy and constructors with 1-3 arguments are defined, calling those of the argument class (default constructor must be available). It can be improved when perfect forwarding of template arguments is supported by all compilers used for OCCT.
The intent is similar to std::make_shared<> in STL, except that this implementation defines a separate type.

Constructors(1)

Standard_JsonKey

Properties(8)

Standard_OutOfMemory

Standard_OutOfMemory exception is defined explicitly and not by macro DEFINE_STANDARD_EXCEPTION, to avoid necessity of dynamic memory allocations during throwing and stack unwinding:

  • message string is stored as field, not allocated dynamically (storable message length is limited by buffer size)
    The reason is that in out-of-memory condition any memory allocation can fail, thus use of operator new for allocation of new exception instance is dangerous (can cause recursion until stack overflow, see #24836).

Constructors(1)

  • constructor(theMessage?: string): Standard_OutOfMemory

    Constructor is kept public for backward compatibility.

    Parameters (1)
    • theMessage
      optional error message

Instance methods(3)

  • what(): string

    Returns error message (implements std::exception interface).

  • ExceptionType(): string

    Returns the exception type name.

  • SetMessageString(theMessage: string): void

    Sets error message.

    Parameters (1)
    • theMessage
      error message (can be nullptr)

Standard_ReadBuffer

Auxiliary tool for buffered reading from input stream within chunks of constant size.

Constructors(1)

  • constructor(theDataLen: number, theChunkLen: number, theIsPartialPayload?: boolean): Standard_ReadBuffer

    Constructor with initialization.

    Parameters (3)
    • theDataLen
    • theChunkLen
    • theIsPartialPayload

Instance methods(2)

  • Init(theDataLen: number, theChunkLen: number, theIsPartialPayload?: boolean): void

    Initialize the buffer.

    Parameters (3)
    • theDataLen
      the full length of input data to read from stream.
    • theChunkLen
      the length of single chunk to read
    • theIsPartialPayload
      when FALSE, theDataLen will be automatically aligned to the multiple of theChunkLen; when TRUE, last chunk will be read from stream exactly till theDataLen allowing portion of chunk to be uninitialized (useful for interleaved data)
  • IsDone(): boolean

    Return TRUE if amount of read bytes is equal to requested length of entire data.

Standard_ReadLineBuffer

Auxiliary tool for buffered reading of lines from input stream.

Constructors(1)

  • constructor(theMaxBufferSizeBytes: number): Standard_ReadLineBuffer

    Constructor with initialization.

    Parameters (1)
    • theMaxBufferSizeBytes
      the length of buffer to read (in bytes)

Instance methods(4)

  • Clear(): void

    Clear buffer and cached values.

  • IsMultilineMode(): boolean

    Returns TRUE when the Multiline Mode is on; FALSE by default. Multiline modes joins several lines in file having \ at the end of line:

    Linestartshere,\//linecontinuationcharacterwithoutthiscomment continues\//linecontinuationcharacterwithoutthiscomment andends.
  • Put gap space while merging lines within multiline syntax, so that the following sample:

    1/2/3\//linecontinuationcharacterwithoutthiscomment 4/5/6

    Will become "1/2/3 4/5/6" when flag is TRUE, and "1/2/35/5/6" otherwise.

  • SetMultilineMode(theMultilineMode: boolean, theToPutGap?: boolean): void

    Sets or unsets the multi-line mode.

    Parameters (2)
    • theMultilineMode
      multiline mode flag
    • theToPutGap
      put gap space while connecting lines (no gap otherwise)

Standard_Transient

Abstract class which forms the root of the entire Transient class hierarchy.

Constructors(2)

Static methods(2)

Instance methods(12)

Standard_Type

This class provides legacy interface (type descriptor) to run-time type information (RTTI) for OCCT classes inheriting from Standard_Transient.
In addition to features provided by standard C++ RTTI (type_info), Standard_Type allows passing descriptor as an object and using it for analysis of the type:

  • get descriptor of a parent class
  • get user-defined name of the class
  • get size of the object
    Use static template method Instance() to get descriptor for a given type. Objects supporting OCCT RTTI return their type descriptor by method DynamicType().
    To be usable with OCCT type system, the class should provide:
  • typedef base_type to its base class in the hierarchy
  • method get_type_name() returning programmer-defined name of the class (as a statically allocated constant C string or string literal)
    Note that user-defined name is used since typeid.name() is usually mangled in compiler-dependent way.
    Only single chain of inheritance is supported, with a root base class Standard_Transient.

Static methods(3)

  • Register(theInfo: unknown, theName: string, theSize: number, theParent: Standard_Type): Standard_Type

    Register a type; returns either new or existing descriptor.
    Note that this function is intended for use by STANDARD_RTTIEXT macros only.

    Parameters (4)
    • theInfo
      object stores system name of the class
    • theName
      name of the class to be stored in Name field
    • theSize
      size of the class instance
    • theParent
      base class in the Transient hierarchy
  • get_type_name(): string

Instance methods(7)

  • SystemName(): string

    Returns the system type name of the class (typeinfo.name).

  • Name(): string

    Returns the given name of the class type (get_type_name).

  • Size(): number

    Returns the size of the class instance in bytes.

  • Returns descriptor of the base class in the hierarchy.

  • SubType(theOther: Standard_Type): boolean

    Returns True if this type is the same as theOther, or inherits from theOther. Note that multiple inheritance is not supported.

    Parameters (1)
    • theOther
  • SubType(theOther: string): boolean

    Returns True if this type is the same as theOther, or inherits from theOther. Note that multiple inheritance is not supported.

    Parameters (1)
    • theOther