Type system class Many of the classes in the FreeCAD must have their type information registered before any instances are created (including, but not limited to: App::Feature, App::Property, Gui::ViewProvider ). More...
#include <Type.h>
Public Types | |
typedef void *(* | instantiationMethod) () |
Public Member Functions | |
void * | createInstance () |
creates a instance of this type More... | |
unsigned int | getKey () const |
const char * | getName () const |
const Type | getParent () const |
bool | isBad () const |
bool | isDerivedFrom (const Type type) const |
bool | operator!= (const Type type) const |
bool | operator< (const Type type) const |
bool | operator<= (const Type type) const |
void | operator= (const Type type) |
bool | operator== (const Type type) const |
bool | operator> (const Type type) const |
bool | operator>= (const Type type) const |
Type () | |
A constructor. More... | |
Type (const Type &type) | |
Construction. More... | |
virtual | ~Type () |
Destruction. More... | |
Static Public Member Functions | |
static Type | badType () |
static void * | createInstanceByName (const char *TypeName, bool bLoadModule=false) |
creates a instance of the named type More... | |
static const Type | createType (const Type parent, const char *name, instantiationMethod method=nullptr) |
static void | destruct () |
static Type | fromKey (unsigned int key) |
static Type | fromName (const char *name) |
static int | getAllDerivedFrom (const Type type, std::vector< Type > &List) |
static int | getNumTypes () |
static Type | getTypeIfDerivedFrom (const char *name, const Type parent, bool bLoadModule=false) |
Returns the given named type if is derived from parent type, otherwise return bad type. More... | |
static void | importModule (const char *TypeName) |
static void | init () |
Static Protected Member Functions | |
static std::string | getModuleName (const char *ClassName) |
Type system class Many of the classes in the FreeCAD must have their type information registered before any instances are created (including, but not limited to: App::Feature, App::Property, Gui::ViewProvider ).
The use of Type to store this information provides lots of various functionality for working with class hierarchies, comparing class types, instantiating objects from classnames, etc etc.
It is for instance possible to do things like this:
A notable feature of the Type class is that it is only 16 bits long and therefore should be passed around by value for efficiency reasons.
One important note about the use of Type to register class information: super classes must be registered before any of their derived classes are.
typedef void *(* Base::Type::instantiationMethod) () |
Type::Type | ( | const Type & | type | ) |
Construction.
Referenced by ArchPanel.CommandPanelSheet::Activated(), ArchStructure.CommandStructuralSystem::Activated(), draftobjects.draft_annotation.DraftAnnotation::add_missing_properties_0v19(), ArchStructure.StructSelectionObserver::addSelection(), ArchSite.Compass::buildCoordinates(), ArchComponent.Component::execute(), draftobjects.layer.LayerContainer::execute(), ArchSchedule.CommandArchSchedule::IsActive(), draftobjects.layer.Layer::set_properties(), and ArchReference.ArchReference::setProperties().
Type::Type | ( | ) |
A constructor.
A more elaborate description of the constructor.
Referenced by ArchPanel.CommandPanelSheet::Activated(), ArchStructure.CommandStructuralSystem::Activated(), draftobjects.draft_annotation.DraftAnnotation::add_missing_properties_0v19(), ArchStructure.StructSelectionObserver::addSelection(), ArchSite.Compass::buildCoordinates(), ArchComponent.Component::execute(), draftobjects.layer.LayerContainer::execute(), ArchSchedule.CommandArchSchedule::IsActive(), draftobjects.layer.Layer::set_properties(), and ArchReference.ArchReference::setProperties().
|
virtual |
Destruction.
A destructor.
A more elaborate description of the destructor.
|
static |
Referenced by Gui::SelectionSingleton::countObjectsOfType(), createInstanceByName(), fromKey(), fromName(), Gui::SelectionSingleton::getObjectList(), Gui::SelectionSingleton::getObjectsOfType(), getTypeIfDerivedFrom(), Gui::DAG::FilterOrigin::goFilter(), Gui::DAG::FilterTyped::goFilter(), Base::BaseClass::init(), App::Extension::initExtensionSubclass(), Base::BaseClass::initSubclass(), and isDerivedFrom().
void * Type::createInstance | ( | ) |
creates a instance of this type
Referenced by App::DynamicProperty::addDynamicProperty(), Part::PropertyGeometryList::Restore(), TechDraw::PropertyCenterLineList::Restore(), TechDraw::PropertyCosmeticEdgeList::Restore(), TechDraw::PropertyCosmeticVertexList::Restore(), TechDraw::PropertyGeomFormatList::Restore(), App::ExtensionContainer::restoreExtensions(), and Sandbox::DocumentObjectProtectorPy::setattr().
|
static |
creates a instance of the named type
References badType(), fromName(), and importModule().
Referenced by MeshGui::DlgEvaluateMeshImp::addViewProvider(), Part::AttachExtension::changeAttacherType(), Gui::FreeCADGui_subgraphFromObject(), and App::PropertyPersistentObject::setValue().
|
static |
References getKey().
Referenced by Base::BaseClass::init(), App::Extension::initExtensionSubclass(), and Base::BaseClass::initSubclass().
|
static |
Referenced by App::Application::destruct().
|
static |
References badType().
Referenced by PartGui::Mirroring::accept(), StdCmdAlignment::activated(), Gui::Application::activateWorkbench(), FemGui::ViewProviderFemAnalysis::canDragObject(), Part::AttachExtension::changeAttacherType(), Part::FaceMaker::ConstructFromType(), Gui::SelectionSingleton::countObjectsOfType(), createInstanceByName(), Gui::Dialog::DlgAddProperty::DlgAddProperty(), Part::AttachExtension::extHandleChangedPropertyName(), PartGui::ViewProviderBoolean::getIcon(), Fem::FemPostFilter::getInputData(), Gui::SelectionSingleton::getObjectsOfType(), TechDrawGui::QGVPage::getStyleType(), getTypeIfDerivedFrom(), Gui::View3DInventorPy::getViewProvidersOfType(), Gui::DAG::FilterOrigin::goFilter(), Gui::DAG::FilterTyped::goFilter(), Fem::FemAnalysis::handleChangedPropertyName(), Part::Circle::handleChangedPropertyName(), Part::Ellipse::handleChangedPropertyName(), Part::BodyBase::handleChangedPropertyName(), PartDesign::Boolean::handleChangedPropertyName(), Surface::Extend::handleChangedPropertyName(), TechDraw::DrawViewBalloon::handleChangedPropertyName(), PartGui::ViewProvider2DObjectGrid::handleChangedPropertyType(), PartDesign::Transformed::handleChangedPropertyType(), Part::Primitive::handleChangedPropertyType(), App::Extension::initExtensionSubclass(), Base::BaseClass::initSubclass(), Gui::Node_Object::Node_Object(), Gui::View3DInventor::OnChange(), Gui::GraphicsView3D::OnChange(), FemGui::ViewProviderFemPostObject::onChanged(), Gui::NavigationStyle::openPopupMenu(), Gui::Dialog::find_placement::operator()(), Gui::Dialog::find_transform::operator()(), Fem::FemVTKTools::readResult(), Part::Geometry::Restore(), Part::PropertyGeometryList::Restore(), TechDraw::PropertyCenterLineList::Restore(), TechDraw::PropertyCosmeticEdgeList::Restore(), TechDraw::PropertyCosmeticVertexList::Restore(), TechDraw::PropertyGeomFormatList::Restore(), App::ExtensionContainer::restoreExtensions(), Gui::TreeView::rowsInserted(), Gui::Application::sActivateView(), Gui::Application::sActiveView(), Gui::View3DInventorPy::setNavigationType(), App::PropertyPersistentObject::setValue(), AttacherGui::AttacherGuiPy::sGetModeStrings(), InspectionGui::ViewProviderInspection::updateData(), App::PropertyLinkSubList::upgrade(), and InspectionGui::VisualInspection::VisualInspection().
unsigned int Base::Type::getKey | ( | ) | const |
Referenced by createType(), Gui::PropertyView::onTimer(), operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
|
staticprotected |
Referenced by importModule().
const char * Type::getName | ( | ) | const |
Referenced by PartDesignGui::TaskDlgFeatureParameters::accept(), StdCmdToggleSelectability::activated(), App::Document::addObject(), Gui::View3DInventor::customEvent(), Gui::DocumentObjectItem::displayStatusInfo(), Gui::ViewProvider::eventCallback(), Gui::View3DInventorPy::getNavigationType(), App::OriginGroupExtension::getOrigin(), AttacherGui::getUIStrings(), PartDesign::Fillet::handleChangedPropertyType(), Part::Part2DObject::handleChangedPropertyType(), PartDesign::Chamfer::handleChangedPropertyType(), TechDraw::DrawPage::handleChangedPropertyType(), TechDraw::DrawView::handleChangedPropertyType(), Gui::Dialog::DlgPropertyLink::init(), App::Extension::name(), Gui::ViewProviderLink::onChanged(), Base::XMLReader::readFiles(), App::PropertyLinkList::Restore(), Part::GeometryPersistenceExtension::Save(), Part::AttachExtension::setAttacher(), InspectionGui::ViewProviderInspection::setDistances(), and App::LinkBaseExtension::setProperty().
|
static |
const Type Type::getParent | ( | ) | const |
Referenced by Gui::Dialog::DlgPropertyLink::init(), and isDerivedFrom().
|
static |
Returns the given named type if is derived from parent type, otherwise return bad type.
References badType(), fromName(), and importModule().
Referenced by App::DynamicProperty::addDynamicProperty(), App::Document::addObject(), App::Document::addObjects(), Gui::WorkbenchManager::createWorkbench(), Gui::View3DInventorViewer::setNavigationType(), and Gui::Document::slotNewObject().
|
static |
|
static |
Referenced by App::Application::initTypes(), and DocumentObject.DocumentObject::onChanged().
bool Base::Type::isBad | ( | ) | const |
Referenced by App::DynamicProperty::addDynamicProperty(), Part::FaceMaker::ConstructFromType(), Gui::Dialog::DlgPropertyLink::init(), App::Extension::initExtension(), App::Extension::initExtensionType(), App::Extension::name(), App::ExtensionContainer::restoreExtensions(), and Gui::Document::setActiveView().
References badType(), and getParent().
Referenced by PartDesignGui::TaskDlgFeatureParameters::accept(), PartDesignGui::TaskDlgSketchBasedParameters::accept(), StdCmdGroup::activated(), Gui::Application::activateWorkbench(), MeshGui::DlgEvaluateMeshImp::addViewProvider(), SketcherGui::FilletSelection::allow(), SketcherGui::TrimmingSelection::allow(), PartDesignGui::ReferenceSelection::allow(), SketcherGui::ExternalSelection::allow(), Gui::QuantitySpinBox::apply(), PartDesignGui::collectMovableDependencies(), Gui::Document::createView(), MeshGui::ViewProviderMeshCurvature::curvatureInfoCallback(), Sketcher::SketchObject::evaluateSupport(), Drawing::FeatureProjection::execute(), Drawing::FeatureViewPart::execute(), Drawing::FeatureViewSpreadsheet::execute(), Inspection::Feature::execute(), PartDesign::Pipe::execute(), Raytracing::LuxFeature::execute(), Raytracing::RayFeature::execute(), Robot::Edge2TracObject::execute(), Robot::TrajectoryDressUpObject::execute(), Surface::Filling::execute(), TechDraw::DrawViewSpreadsheet::execute(), TechDraw::FeatureProjection::execute(), PartDesign::Body::execute(), Surface::Extend::execute(), TechDraw::DrawViewDetail::execute(), MeshGui::ViewProviderMesh::faceInfoCallback(), MeshGui::ViewProviderMesh::fillHoleCallback(), PartDesign::ProfileBased::getAxis(), PartDesign::Feature::getBaseObject(), InspectionGui::ViewProviderInspection::getIcon(), Fem::FemPostFilter::getInputData(), TechDraw::ShapeExtractor::getShapesFromObject(), PartDesign::Transformed::getSketchObject(), PartDesign::ProfileBased::getSupportFace(), PartDesign::MultiTransform::getTransformations(), PartDesign::Scaled::getTransformations(), PartDesign::LinearPattern::getTransformations(), PartDesign::Mirrored::getTransformations(), PartDesign::PolarPattern::getTransformations(), AttacherGui::getUIStrings(), PartGui::ViewProvider2DObjectGrid::handleChangedPropertyType(), PartDesign::Transformed::handleChangedPropertyType(), Part::Primitive::handleChangedPropertyType(), Gui::Dialog::DlgPropertyLink::init(), InspectionGui::ViewProviderInspection::inspectCallback(), InspectionGui::ViewProviderInspection::inspectDistance(), PartDesign::Feature::isDatum(), Base::BaseClass::isDerivedFrom(), PartDesignGui::isFeatureMovable(), TechDrawGui::QGIProjGroup::itemChange(), PartDesignGui::TaskFeaturePick::makeCopy(), MeshGui::ViewProviderMesh::markPartCallback(), Gui::TreeView::mouseDoubleClickEvent(), Gui::Dialog::DlgMaterialPropertiesImp::on_ambientColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_diffuseColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_emissiveColor_changed(), Gui::Dialog::DlgMaterialPropertiesImp::on_shininess_valueChanged(), Gui::Dialog::DlgMaterialPropertiesImp::on_specularColor_changed(), PartDesignGui::TaskBooleanParameters::onSelectionChanged(), Gui::ManualAlignment::probePickedCallback(), Sketcher::SketchObject::rebuildExternalGeometry(), App::ExtensionContainer::registerExtension(), SketcherGui::DrawSketchHandlerFillet::releaseButton(), SketcherGui::DrawSketchHandlerTrimming::releaseButton(), PartDesignGui::relinkToOrigin(), App::PropertyLinkList::Restore(), App::ExtensionContainer::restoreExtensions(), PartGui::FaceColors::Private::selectionCallback(), Gui::Document::setHide(), Gui::Document::setShow(), Gui::Application::setupContextMenu(), Gui::Dialog::DlgMaterialPropertiesImp::setViewProviders(), Gui::Document::slotDeletedObject(), Gui::ManualAlignment::slotDeletedObject(), FemGui::TaskFemConstraintFluidBoundary::TaskFemConstraintFluidBoundary(), Gui::TaskView::TaskSelectLinkProperty::TaskSelectLinkProperty(), Gui::SelectionFilter::test(), Gui::PropertyEditor::PropertyMatrixItem::toolTip(), Gui::PropertyEditor::PropertyRotationItem::toolTip(), Gui::PropertyEditor::PropertyPlacementItem::toolTip(), Gui::PropertyEditor::PropertyMaterialItem::toolTip(), Gui::PropertyEditor::PropertyMaterialListItem::toolTip(), InspectionGui::ViewProviderInspection::updateData(), MeshGui::ViewProviderMeshCurvature::updateData(), PartGui::ViewProviderBoolean::updateData(), PartGui::ViewProviderMultiFuse::updateData(), PartGui::ViewProviderMultiCommon::updateData(), PartGui::ViewProviderCompound::updateData(), PartGui::ViewProviderCustom::updateData(), PathGui::ViewProviderArea::updateData(), PathGui::ViewProviderAreaView::updateData(), PathGui::ViewProviderPathShape::updateData(), SketcherGui::ViewProviderCustom::updateData(), Sketcher::SketchObject::validateExternalLinks(), Gui::PropertyEditor::PropertyStringItem::value(), Gui::PropertyEditor::PropertyFontItem::value(), Gui::PropertyEditor::PropertyIntegerItem::value(), Gui::PropertyEditor::PropertyIntegerConstraintItem::value(), Gui::PropertyEditor::PropertyFloatItem::value(), Gui::PropertyEditor::PropertyUnitItem::value(), Gui::PropertyEditor::PropertyFloatConstraintItem::value(), Gui::PropertyEditor::PropertyBoolItem::value(), Gui::PropertyEditor::PropertyVectorItem::value(), Gui::PropertyEditor::PropertyVectorListItem::value(), Gui::PropertyEditor::PropertyVectorDistanceItem::value(), Gui::PropertyEditor::PropertyMatrixItem::value(), Gui::PropertyEditor::PropertyRotationItem::value(), Gui::PropertyEditor::PropertyPlacementItem::value(), Gui::PropertyEditor::PropertyEnumItem::value(), Gui::PropertyEditor::PropertyStringListItem::value(), Gui::PropertyEditor::PropertyFloatListItem::value(), Gui::PropertyEditor::PropertyIntegerListItem::value(), Gui::PropertyEditor::PropertyColorItem::value(), Gui::PropertyEditor::PropertyMaterialItem::value(), Gui::PropertyEditor::PropertyMaterialListItem::value(), Gui::PropertyEditor::PropertyFileItem::value(), Gui::PropertyEditor::PropertyPathItem::value(), Gui::PropertyEditor::PropertyTransientFileItem::value(), SketcherGui::PropertyConstraintListItem::value(), and MeshPartGui::CurveOnMeshHandler::Private::vertexCallback().
void Base::Type::operator= | ( | const Type | type | ) |