# TK_Instance

## Functions

| `TK_Instance`
`TK_Status` | `Read`
`TK_Status` | `Write`
`TK_Status` | `Clone`
`TK_Status` | `ReadAscii`
`TK_Status` | `WriteAscii`
void | `Reset`

## Detailed Description

class TK_Instance : public BBaseOpcodeHandler

  Handles the TKE_Repeat_Object opcode.

  As its name implies, the TKE_Repeat_Object is an instruction to make a copy of a previously given object. Given an index and a modelling matrix, make a copy of an object, transform the points and reinsert. If you would like to ignore it, you can just implement a subclass that just returns TK_Normal on TK_Instance::Execute(). Of course, a better solution is to provide a real implementation, so that there will be no missing geometry. An example of such an implementation is provided in source form in HTK_Instance::Execute, which currently lives in HOpcodeHandler.cpp.

  Subclassed by HTK_Instance

  Public Functions

  TK_Instance(int from_index = 0, int from_variant = 0, int to_index = 0, int to_variant = 0, int options = 0, float const xform[] = 0)

    constructor

  virtual TK_Status Read(BStreamFileToolkit &tk)

    Reads data from the toolkit buffer, decodes/decompresses it, and maps it to the opcode handlers data members. User-defined classes which need to write out custom data should utilize one of the available GetData() methods.

    Parameters

      tk – A reference to the BStreamFileToolkit object.

    Returns

      The result of the function call.

  virtual TK_Status Write(BStreamFileToolkit &tk)

    Encodes/compresses data and writes data to the toolkit buffer. User-defined classes which need to write out custom data should utilize one of the available PutData() methods, and first write out the opcode associated with the group of binary data followed by the data itself.

    Parameters

      tk – A reference to the BStreamFileToolkit object.

    Returns

      The result of the function call.

  virtual TK_Status Clone(BStreamFileToolkit &tk, BBaseOpcodeHandler **handler) const

    Copies the opcode handler

    Parameters

      - tk – A reference to the BStreamFileToolkit object.

      - handler – A pointer to the opcode handler object. Passed by reference.

    Returns

      The result of the function call.

  TK_Status ReadAscii(BStreamFileToolkit &tk)

    Deprecated.

  TK_Status WriteAscii(BStreamFileToolkit &tk)

    Deprecated.

  virtual void Reset()

    Resets the current opcode handler. This is called by the toolkit when it is done processing an opcode. This method reinitializes any opcode handler variables and frees up temporary data.