|
http://www.sim.no http://www.coin3d.org |
#include <Inventor/Xt/SoXtObject.h>
Inheritance diagram for SoXtObject:

The purpose of making this class the superclass of all SoXt device, component and viewer classes is to be able to do run-time type checking of the SoXt objects.
You can place the macro SOXT_OBJECT_HEADER(classname,parentname) within a class definition header for SoXt extension components to automatically make the necessary definitions for setting up a run-time type system for your extension classes:
#ifndef MYSPECIALVIEWER_H #define MYSPECIALVIEWER_H class MySpecialViewer : public SoXtExaminerViewer { SOXT_OBJECT_HEADER(MySpecialViewer, SoXtExaminerViewer); // [rest of class definition follows] }; #endif // !MYSPECIALVIEWER_H
Then put the SOXT_OBJECT_SOURCE(classname) macro within the actual implementation sourcecode file to include the necessary code for the run-time type system:
#include <MySpecialViewer.h> SOQT_OBJECT_SOURCE(MySpecialViewer); // [rest of class implementation]
See also the documentation of the SoType class in Coin or Inventor.
Public Member Functions | |
| virtual SoType | getTypeId (void) const =0 |
| SbBool | isOfType (SoType type) const |
Static Public Member Functions | |
| static void | initClass (void) |
| static SoType | getClassTypeId (void) |
| static void | init (void) |
| void SoXtObject::initClass | ( | void | ) | [static] |
Sets up initialization for data common to all instances of this class, submitting necessary information to the internal SoXt type system.
| SoType SoXtObject::getClassTypeId | ( | void | ) | [static] |
This static method returns the SoType object associated with objects of this class.
| SoType SoXtObject::getTypeId | ( | void | ) | const [pure virtual] |
Returns the type identification of an object derived from a class inheriting SoXtObject. This is used for run-time type checking and "downward" casting.
Usage example:
void foo(SoXtViewer * comp) { if (comp->getTypeId() == SoXtExaminerViewer::getClassTypeId()) { // safe downward cast, knows the type SoXtExaminerViewer * exviewer = (SoXtExaminerViewer *)comp; } else if (comp->getTypeId().isOfType(SoXtFlyViewer::getClassTypeId())) { // safe downward cast, knows the type SoXtFlyViewer * flyviewer = (SoXtFlyViewer *)comp; // then something else } }
| SbBool SoXtObject::isOfType | ( | SoType | type | ) | const |
Returns TRUE if the type of this object is either of the same type or inherited from type.
| void SoXtObject::init | ( | void | ) | [static] |
Initialize the type system of SoXtObject, all SoXt device classes and all SoXt components (including viewers).
Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.
Generated on Tue Dec 2 23:15:46 2008 for SoXt by Doxygen. 1.4.7