BBaseOpcodeHandler
Functions
void |
|
bool |
|
unsigned char |
|
unsigned char |
|
void |
|
int |
|
bool |
|
void |
|
bool |
|
void |
|
bool |
|
bool |
|
void |
|
void |
|
char const * |
|
char * |
|
void |
Detailed Description
-
class BBaseOpcodeHandler : public BControlledMemoryObject
The BBaseOpcodeHandler abstract class is used as a base for derived classes which manage logical pieces of HOOPS Stream File information
BBaseOpcodeHandler provides virtual functions which are implemented by derived classes to handle reading, writing, execution and interpretation of HOOPS Stream File information. Execution refers to the process of populating application-specific data structures with the information that has been read. Interpretation refers to the process of extracting application-specific data to prepare it for subsequent writing.
Each opcode handler manages opcodes which represent the various HOOPS/3dGS scene-graph objects which include segments, attributes, and geometric primitives.
The HSF file reading process involves reading the opcode at the start of each piece of binary information, and calling the Read method of the associated opcode handler. After the opcode handler reports that reading is complete, the Execute method should be called. (When using HoopsStream or BaseStream, the ParseBuffer method of the BStreamFileToolkit object encapsulates this process.)
The HSF file writing process involves determining the proper opcode for each piece of binary information, and calling the Interpret method of the associated opcode handler. After interpretation is complete, the Write method of the opcode handler should be called until writing is complete. (When using HoopsStream, the GenerateBuffer method of the HStreamFileToolkit encapsulates this process. However, if BaseStream is used, the Interpret/Write process must be performed manually.)
Subclassed by HTK_Color_Composite, HTK_Conditional_Actions, HTK_Custom_Shader_Definitions, HTK_Glyph_Definitions, HTK_Line_Styles, HTK_Named_Style_Defs, HTK_Shape_Definitions, HTK_Texture_Definitions, HT_NURBS_Trim, Lock_Masks, TK_Animation, TK_Area_Light, TK_Bounding, TK_Callback, TK_Camera, TK_Circle, TK_Clip_Rectangle, TK_Clip_Region, TK_Close_Segment, TK_Color, TK_Color_By_FIndex, TK_Color_By_Index, TK_Color_By_Value, TK_Color_Map, TK_Color_RGB, TK_Comment, TK_Complex_Clip_Region, TK_Compression, TK_Conditional_Action, TK_Conditions, TK_Custom_Shader, TK_Custom_Shader_Definition, TK_Custom_Shader_Sampler, TK_Custom_Shader_Texture, TK_Cutting_Plane, TK_Cylinder, TK_Default, TK_Delete_Object, TK_Dictionary, TK_Dictionary_Locater, TK_Ellipse, TK_Enumerated, TK_External_Reference, TK_External_Reference_Unicode, TK_File_Info, TK_Font, TK_Geometry_Attributes, TK_Geometry_Options, TK_Glyph_Definition, TK_Grid, TK_Header, TK_Heuristics, TK_Image, TK_Image_XRef, TK_Instance, TK_LOD, TK_Line, TK_Line_Style, TK_Linear_Pattern, TK_Material, TK_Matrix, TK_NURBS_Curve, TK_NURBS_Surface, TK_Named, TK_Named_Style_Def, TK_Open_Segment, TK_PBR, TK_Point, TK_PolyPolypoint, TK_Polyhedron, TK_Polypoint, TK_Reference, TK_Referenced_Segment, TK_Rendering_Options, TK_Renumber, TK_Reopen_Segment, TK_Selectability, TK_Shape_Definition, TK_Size, TK_Sphere, TK_Spot_Light, TK_Streaming, TK_Tag, TK_Terminator, TK_Text, TK_Text_Font, TK_Texture, TK_Thumbnail, TK_URL, TK_Unavailable, TK_Unicode_Options, TK_User_Data, TK_User_Index, TK_User_Index_Data, TK_User_Options, TK_User_Value, TK_Visibility, TK_Window, TK_XML
Public Functions
-
inline BBaseOpcodeHandler(int op)
Default constructor for an BBaseOpcodeHandler object
- Parameters
op – value denoting the opcode that the object supports. This is necessary for opcode handlers that support more than one opcode, such as TK_Polypoint, which supports both TKE_Polygon and TKE_Polyline opcodes.
-
virtual ~BBaseOpcodeHandler()
-
virtual TK_Status Read(BStreamFileToolkit &tk) = 0
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) = 0
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 Execute(BStreamFileToolkit &tk)
Processes the binary data that has been read for the current object, which involves passing the data to application-specific data structures.
- Parameters
tk – A reference to the BStreamFileToolkit object.
- Returns
The result of the function call.
-
virtual TK_Status Interpret(BStreamFileToolkit &tk, long key, int variant = 0)
Extracts graphics data (typically from the application’s scene-graph) and maps it to the opcode handler’s data members in preparation for writing out an object to the file.
- Parameters
tk – A reference to the BStreamFileToolkit object.
key – An identifier to the object (for example, the HOOPS key of a geometry item)
variant – optional specification of an alternate form, such as a Level-of-Detail representation
- Returns
The result of the function call.
-
virtual TK_Status Interpret(BStreamFileToolkit &tk, long key, char const *special)
Extracts graphics data (typically from the application’s scene-graph) and maps it to the opcode handler’s data members in preparation for writing out an object to the file.
- Parameters
tk – A reference to the BStreamFileToolkit object.
key – An identifier to the object (for example, the HOOPS key of a geometry item)
special – A string value of particular data
- Returns
The result of the function call.
-
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.
-
virtual bool Match_Instance(BStreamFileToolkit const &tk, Recorded_Instance *instance)
Determines whether a stored instance of an object is compatible with the current object, and if it is, prepares the object to write the instance instead.
-
inline unsigned char Opcode() const
Returns the current opcode
-
inline unsigned char General_Flags() const
Returns the current general flags
-
inline void Set_General_Flags(int f)
Sets the current general flags
-
inline int Pass(BStreamFileToolkit &tk) const
The toolkit makes multiple passes of objects which have LOD representations in the HOOPS database. This function returns the number of the pass which the toolkit is currently on.
-
inline TK_Status Tag(BStreamFileToolkit &tk, int variant = -1) const
Adds a Tag to the file for the current object, and also adds an entry to the toolkit’s tag table which stores an association between the tag (also called an ‘index’) and the current object’s HOOPS key
-
inline bool Tagging(BStreamFileToolkit &tk) const
Provides a simple interface to check if this object requires tagging or the toolkit is set for Force_Tags.
-
inline void SetNeedsTag(bool n)
Sets whether the object requests tagging
-
inline bool NeedsTag() const
Determine if the object is set to request tagging
-
inline void SetCollectionPart(bool n)
Sets whether the object is part of a collection
-
inline bool IsCollectionPart() const
Determine if the object is part of a collection
-
inline 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.
-
inline virtual bool NeedsContext(BStreamFileToolkit &tk) const
Allows the handler to specify if it needs the containing context to be reopened (currently only used for revisits on geometry references)
- Returns
The answer.
-
void SetLoggingString(char const *segment)
Set the debug string. Makes sure the buffer is big enough to hold the debug string, and copies it in
-
void SetLoggingString(int length)
Set the debug string. Makes sure the buffer is big enough to hold a string of ‘length’ characters
-
inline char const *GetLoggingString() const
Get the debug string. Returns a pointer to the current debug string
-
inline char *GetLoggingString()
Get the debug string buffer. Returns a pointer to the current debug string buffer which may then be modified directly
-
void LogDebug(BStreamFileToolkit &tk, char const *string = 0)
write out any logging string (provided or previously recorded) and reset
-
inline BBaseOpcodeHandler(int op)