.TH "SoQtObject" 3 "Sun Dec 11 2011" "Version 1.5.0" "SoQt" \" -*- nroff -*- .ad l .nh .SH NAME SoQtObject \- .PP The \fBSoQtObject\fP class is the common superclass for all \fBSoQt\fP component classes\&. .PP The purpose of making this class the superclass of all \fBSoQt\fP device, component and viewer classes is to be able to do run-time type checking of the \fBSoQt\fP objects\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherited by \fBSoQtComponent\fP, and \fBSoQtDevice\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual SoType \fBgetTypeId\fP (void) const =0" .br .ti -1c .RI "SbBool \fBisOfType\fP (SoType type) const " .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static void \fBinitClass\fP (void)" .br .ti -1c .RI "static SoType \fBgetClassTypeId\fP (void)" .br .ti -1c .RI "static void \fBinit\fP (void)" .br .in -1c .SH "Detailed Description" .PP The \fBSoQtObject\fP class is the common superclass for all \fBSoQt\fP component classes\&. .PP The purpose of making this class the superclass of all \fBSoQt\fP device, component and viewer classes is to be able to do run-time type checking of the \fBSoQt\fP objects\&. You can place the macro SOQT_OBJECT_HEADER(classname,parentname) within a class definition header for \fBSoQt\fP extension components to automatically make the necessary definitions for setting up a run-time type system for your extension classes: .PP .PP .nf #ifndef MYSPECIALVIEWER_H #define MYSPECIALVIEWER_H class MySpecialViewer : public SoQtExaminerViewer { SOQT_OBJECT_HEADER(MySpecialViewer, SoQtExaminerViewer); // [rest of class definition follows] }; #endif // !MYSPECIALVIEWER_H .fi .PP .PP Then put the SOQT_OBJECT_SOURCE(classname) macro within the actual implementation sourcecode file to include the necessary code for the run-time type system: .PP .PP .nf #include SOQT_OBJECT_SOURCE(MySpecialViewer); // [rest of class implementation] .fi .PP .PP See also the documentation of the SoType class in Coin or Inventor\&. .SH "Member Function Documentation" .PP .SS "void \fBSoQtObject::initClass\fP (void)\fC [static]\fP"Sets up initialization for data common to all instances of this class, submitting necessary information to the internal \fBSoQt\fP type system\&. .PP Referenced by init(), SoQtDevice::initClasses(), and SoQtComponent::initClasses()\&. .SS "SoType \fBSoQtObject::getClassTypeId\fP (void)\fC [static]\fP"This static method returns the SoType object associated with objects of this class\&. .PP Referenced by SoQtViewer::setCameraType(), SoQtViewer::setSceneGraph(), SoQtRenderArea::sizeChanged(), SoQtViewer::SoQtViewer(), and SoQtViewer::toggleCameraType()\&. .SS "SoType \fBSoQtObject::getTypeId\fP (void) const\fC [pure virtual]\fP"Returns the type identification of an object derived from a class inheriting \fBSoQtObject\fP\&. This is used for run-time type checking and 'downward' casting\&. .PP Usage example: .PP .PP .nf void foo(SoQtViewer * comp) { if (comp->getTypeId() == SoQtExaminerViewer::getClassTypeId()) { // safe downward cast, knows the type SoQtExaminerViewer * exviewer = (SoQtExaminerViewer *)comp; } else if (comp->getTypeId()\&.isOfType(SoQtFlyViewer::getClassTypeId())) { // safe downward cast, knows the type SoQtFlyViewer * flyviewer = (SoQtFlyViewer *)comp; // then something else } } .fi .PP .PP Referenced by isOfType(), and SoQtRenderArea::sizeChanged()\&. .SS "SbBool \fBSoQtObject::isOfType\fP (SoTypetype) const"Returns \fCTRUE\fP if the type of this object is either of the same type or inherited from \fItype\fP\&. .PP References getTypeId()\&. .SS "void \fBSoQtObject::init\fP (void)\fC [static]\fP"Initialize the type system of \fBSoQtObject\fP, all \fBSoQt\fP device classes and all \fBSoQt\fP components (including viewers)\&. .PP References initClass(), SoQtDevice::initClasses(), and SoQtComponent::initClasses()\&. .SH "Author" .PP Generated automatically by Doxygen for SoQt from the source code\&.