PhysicsBallJointUnrecPtr PhysicsBallJoint::create(PhysicsWorldUnrecPtr w)
{
    PhysicsBallJointUnrecPtr fc; 

    if(getClassType().getPrototype() != NULL) 
    {
        fc = dynamic_pointer_cast<PhysicsBallJoint>(
            getClassType().getPrototype()-> shallowCopy()); 
    }
    if(fc != NULL)
    {
        fc->setWorld(w);
    }
    
    return fc; 
}
Exemplo n.º 2
0
NORI_NAMESPACE_BEGIN

void NoriObject::addChild(NoriObject *) {
	throw NoriException(QString("NoriObject::addChild() is not "
		"implemented for objects of type '%1'!").arg(
			classTypeName(getClassType())));
}
OSG_BEGIN_NAMESPACE

// Documentation for this class is emitted in the
// OSGImageFieldEditorBase.cpp file.
// To modify it, please change the .fcd file (OSGImageFieldEditor.fcd) and
// regenerate the base file.

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

void ImageFieldEditor::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::FactoryPost)
    {
        FieldEditorFactory::the()->setSingleDefaultEditor(&FieldTraits<Image*>::getType(), &getClassType());
        FieldEditorFactory::the()->setEditorType(&FieldTraits<Image*>::getType(), &getClassType(),
                                                 "ImageLoader");
    }
}
Exemplo n.º 4
0
OSG_USING_NAMESPACE

// Documentation for this class is emited in the
// OSGScreenLODBase.cpp file.
// To modify it, please change the .fcd file (OSGScreenLOD.fcd) and
// regenerate the base file.

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

void ScreenLOD::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        typedef ActionBase::ResultE (ScreenLOD::*Callback)(Action *);

        Callback enter = &ScreenLOD::renderEnter;

        RenderAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(enter));
    }
}
Exemplo n.º 5
0
const TypeSpec& TraceTree::getClassTypeSpec(void)
{
    
    static TypeSpec revTypeSpec = TypeSpec( getClassType(), new TypeSpec( WorkspaceToCoreWrapperObject<RevBayesCore::TraceTree>::getClassTypeSpec() ) );
    
    return revTypeSpec;
}
OSG_USING_NAMESPACE

/***************************************************************************\
 *                            Description                                  *
\***************************************************************************/

/*! \class OSG::PlaneMoveManipulator
 * The MoveHandle is used for moving objects. It consist of three axis which
 * can be picked and translated and one center box to translate freely in 3D.
 */

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

void PlaneMoveManipulator::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        IntersectAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &PlaneMoveManipulator::intersectEnter));

        IntersectAction::registerLeaveDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &PlaneMoveManipulator::intersectLeave));

        RenderAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &PlaneMoveManipulator::renderEnter));

        RenderAction::registerLeaveDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &PlaneMoveManipulator::renderLeave));
    }
}
Exemplo n.º 7
0
/**
 * Do fix ups for non-primitive behaviours, ensuring they
 * get all of the appropriate information from their parent
 * primitive behaviour types.
 */
void RexxBehaviour::resolveNonPrimitiveBehaviour()
{
    if (isNotResolved())
    {
        setResolved();
        operatorMethods = getOperatorMethods(getClassType());
    }
}
Exemplo n.º 8
0
//! create a new instance of the class
PhysicsBodyUnrecPtr PhysicsBody::create(PhysicsWorldUnrecPtr World) 
{
    PhysicsBodyUnrecPtr fc; 

    if(getClassType().getPrototype() != NULL) 
    {
        fc = dynamic_pointer_cast<PhysicsBody>(
                getClassType().getPrototype()-> shallowCopy()); 
    }
    if(fc != NULL)
    {
        fc->setWorld(World);
        commitChanges();

        fc->initDefaults();
    }

    return fc; 
}
Exemplo n.º 9
0
void Geometry::initMethod(InitPhase ePhase)
{
    if(ePhase == TypeObject::SystemPost)
    {
        IntersectAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(&Geometry::intersect));

        RenderAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &MaterialDrawable::renderActionEnterHandler));
                
        RenderAction::registerLeaveDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &MaterialDrawable::renderActionLeaveHandler));
    }
}
Exemplo n.º 10
0
//! initialize the static features of the class, e.g. action callbacks
void DVRVolume::initMethod(void)
{
    DrawAction::registerEnterDefault( getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                              DVRVolumePtr, 
                              CNodePtr,  
                              Action *>(&DVRVolume::doDraw));
    
    IntersectAction::registerEnterDefault( getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                          DVRVolumePtr, 
                              CNodePtr,  
                          Action *>(&DVRVolume::intersect));
    
    RenderAction::registerEnterDefault( getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                          DVRVolumePtr, 
                              CNodePtr,  
                              Action *>(&DVRVolume::render));
}
Exemplo n.º 11
0
OSG_BEGIN_NAMESPACE

// Documentation for this class is emitted in the
// OSGReplicateTransformBase.cpp file.
// To modify it, please change the .fcd file (OSGReplicateTransform.fcd) and
// regenerate the base file.

/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

void ReplicateTransform::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
#ifndef OSG_EMBEDDED
        IntersectAction::registerEnterDefault( 
            getClassType(), 
            reinterpret_cast<Action::Callback>(&ReplicateTransform::intersectEnter));
        
        IntersectAction::registerLeaveDefault( 
            getClassType(), 
            reinterpret_cast<Action::Callback>(&ReplicateTransform::intersectLeave));
#endif
       
        RenderAction::registerEnterDefault(
            ReplicateTransform::getClassType(), 
            reinterpret_cast<Action::Callback>(&ReplicateTransform::renderEnter));

        RenderAction::registerLeaveDefault(
            ReplicateTransform::getClassType(), 
            reinterpret_cast<Action::Callback>(&ReplicateTransform::renderLeave));

    }
}
Exemplo n.º 12
0
/*!
 * \brief Append new-class to container.
 * \param klassOop [in] New class oop.
 * \return New-class data.
 */
TObjectData *TClassContainer::pushNewClass(void *klassOop) {
  TObjectData *cur = NULL;

  /* Class info setting. */

  cur = (TObjectData *)calloc(1, sizeof(TObjectData));
  /* If failure allocate. */
  if (unlikely(cur == NULL)) {
    /* Adding empty to list is deny. */
    logger->printWarnMsg("Couldn't allocate counter memory!");
    return NULL;
  }

  cur->tag = (uintptr_t)cur;
  cur->className = getClassName(getKlassFromKlassOop(klassOop));
  /* If failure getting class name. */
  if (unlikely(cur->className == NULL)) {
    /* Adding empty to list is deny. */
    logger->printWarnMsg("Couldn't get class name!");
    free(cur);
    return NULL;
  }
  cur->classNameLen = strlen(cur->className);
  cur->oopType = getClassType(cur->className);

  void *clsLoader = getClassLoader(klassOop, cur->oopType);
  TObjectData *clsLoaderData = NULL;
  /* If class loader isn't system bootstrap class loader. */
  if (clsLoader != NULL) {
    void *clsLoaderKlsOop = getKlassOopFromOop(clsLoader);
    if (clsLoaderKlsOop != NULL) {
      /* Search classloader's class. */
      clsLoaderData = this->findClass(clsLoaderKlsOop);
      if (unlikely(clsLoaderData == NULL)) {
        /* Register classloader's class. */
        clsLoaderData = this->pushNewClass(clsLoaderKlsOop);
      }
    }
  }
  cur->clsLoaderTag = (clsLoaderData != NULL) ? clsLoaderData->tag : 0;
  cur->clsLoaderId = (uintptr_t)clsLoader;

  /* Chain setting. */
  cur->klassOop = klassOop;
  TObjectData *result = this->pushNewClass(klassOop, cur);
  if (unlikely(result != cur)) {
    free(cur->className);
    free(cur);
  }
  return result;
}
Exemplo n.º 13
0
OSG_USING_NAMESPACE

// Documentation for this class is emited in the
// OSGGeoInstancerBase.cpp file.
// To modify it, please change the .fcd file (OSGGeoInstancer.fcd) and
// regenerate the base file.


/***************************************************************************\
 *                           Class variables                               *
\***************************************************************************/

/***************************************************************************\
 *                           Class methods                                 *
\***************************************************************************/

void GeoInstancer::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        IntersectAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(&GeoInstancer::intersectEnter));

        RenderAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &MaterialDrawable::renderEnter));
                
        RenderAction::registerLeaveDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(
                &MaterialDrawable::renderLeave));
    }
}
Exemplo n.º 14
0
bool CSSImageGeneratorValue::isPending() const {
  switch (getClassType()) {
    case CrossfadeClass:
      return toCSSCrossfadeValue(this)->isPending();
    case LinearGradientClass:
      return toCSSLinearGradientValue(this)->isPending();
    case PaintClass:
      return toCSSPaintValue(this)->isPending();
    case RadialGradientClass:
      return toCSSRadialGradientValue(this)->isPending();
    default:
      ASSERT_NOT_REACHED();
  }
  return false;
}
Exemplo n.º 15
0
void Group::initMethod (void)
{
    DrawAction::registerEnterDefault( 
        getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                                          GroupPtr  , 
                                          CNodePtr  ,  
                                          Action   *>(&Group::drawEnter));
    DrawAction::registerLeaveDefault( 
        getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                                          GroupPtr  , 
                                          CNodePtr  ,  
                                          Action   *>(&Group::drawLeave));

    RenderAction::registerEnterDefault( 
        getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                                          GroupPtr  , 
                                          CNodePtr  ,  
                                          Action   *>(&Group::renderEnter));

    RenderAction::registerLeaveDefault( 
        getClassType(), 
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                                          GroupPtr  , 
                                          CNodePtr  ,  
                                          Action   *>(&Group::renderLeave));
    
    IntersectAction::registerEnterDefault( 
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<Action::ResultE,
                                          GroupPtr  ,
                                          CNodePtr  ,
                                          Action   *>(&Group::intersect));
}
Exemplo n.º 16
0
void RigidBody::create(const Matrix44& pose, SimpleShape* shape, Real mass, Scene* scene)
{
  if (mActor != 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that was already created.");
  return;
 }
 
 if (shape == 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that has no shape.");
  return;
 }
 
 if (scene == 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that has no scene.");
  return;
 }
 
 NxActorDesc actor_description;
 NxBodyDesc  body_description;
 
 actor_description.globalPose.setRowMajor44(pose.ptr());
 Functions::SimpleShapeToActorDescription(actor_description, shape);
 
 if (mass)
 {
  body_description.mass = mass;
  actor_description.body = &body_description;
 }
 
 mActor = scene->getScene()->createActor(actor_description);
 
 if (mActor == 0)
 {
  NxOgre_ThrowError("RigidBody actor was not created.");
  return;
 }

 for (unsigned int i=0; i < actor_description.shapes.size(); i++)
 {
  NxShapeDesc* desc = actor_description.shapes[i];
  delete desc;
 }
 
 mActor->userData = (void*) NxOgre_New(PhysXPointer)(this, getClassType()); 
}
Exemplo n.º 17
0
PassRefPtr<Image> CSSImageGeneratorValue::image(const LayoutObject& layoutObject, const IntSize& size)
{
    switch (getClassType()) {
    case CrossfadeClass:
        return toCSSCrossfadeValue(this)->image(layoutObject, size);
    case LinearGradientClass:
        return toCSSLinearGradientValue(this)->image(layoutObject, size);
    case PaintClass:
        return toCSSPaintValue(this)->image(layoutObject, size);
    case RadialGradientClass:
        return toCSSRadialGradientValue(this)->image(layoutObject, size);
    default:
        ASSERT_NOT_REACHED();
    }
    return nullptr;
}
Exemplo n.º 18
0
IntSize CSSImageGeneratorValue::fixedSize(const LayoutObject& layoutObject, const FloatSize& defaultObjectSize)
{
    switch (getClassType()) {
    case CrossfadeClass:
        return toCSSCrossfadeValue(this)->fixedSize(layoutObject, defaultObjectSize);
    case LinearGradientClass:
        return toCSSLinearGradientValue(this)->fixedSize(layoutObject);
    case PaintClass:
        return toCSSPaintValue(this)->fixedSize(layoutObject);
    case RadialGradientClass:
        return toCSSRadialGradientValue(this)->fixedSize(layoutObject);
    default:
        ASSERT_NOT_REACHED();
    }
    return IntSize();
}
Exemplo n.º 19
0
bool CSSImageGeneratorValue::knownToBeOpaque(const LayoutObject& layoutObject) const
{
    switch (getClassType()) {
    case CrossfadeClass:
        return toCSSCrossfadeValue(this)->knownToBeOpaque(layoutObject);
    case LinearGradientClass:
        return toCSSLinearGradientValue(this)->knownToBeOpaque(layoutObject);
    case PaintClass:
        return toCSSPaintValue(this)->knownToBeOpaque(layoutObject);
    case RadialGradientClass:
        return toCSSRadialGradientValue(this)->knownToBeOpaque(layoutObject);
    default:
        ASSERT_NOT_REACHED();
    }
    return false;
}
Exemplo n.º 20
0
void CSSImageGeneratorValue::loadSubimages(const Document& document) {
  switch (getClassType()) {
    case CrossfadeClass:
      toCSSCrossfadeValue(this)->loadSubimages(document);
      break;
    case LinearGradientClass:
      toCSSLinearGradientValue(this)->loadSubimages(document);
      break;
    case PaintClass:
      toCSSPaintValue(this)->loadSubimages(document);
      break;
    case RadialGradientClass:
      toCSSRadialGradientValue(this)->loadSubimages(document);
      break;
    default:
      ASSERT_NOT_REACHED();
  }
}
Exemplo n.º 21
0
void Switch::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::SystemPost)
    {
        RenderAction::registerEnterDefault(
            Switch::getClassType(),
            reinterpret_cast<Action::Callback>(&Switch::renderEnter));
    
        RenderAction::registerLeaveDefault(
            Switch::getClassType(),
            reinterpret_cast<Action::Callback>(&Switch::renderLeave));
        
        IntersectAction::registerEnterDefault(
            getClassType(),
            reinterpret_cast<Action::Callback>(&Switch::intersect));
    }
}
void GenericFieldContainerEditor::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::FactoryPost)
    {
        //Fill in all of the editable types
        UInt32 NumTypes(FieldContainerFactory::the()->getNumTypes());
        UInt32 FoundTypes(0);
        FieldContainerType* type;
        for(UInt32 i(0) ; FoundTypes<NumTypes; ++i)
        {
            type = FieldContainerFactory::the()->findType(i);
            if(type != NULL)
            {
                ++FoundTypes;
                _EditableTypes.push_back(type);
                FieldContainerEditorFactory::the()->setEditorType(type, &getClassType(), "Generic");
            }
        }
    }
}
Exemplo n.º 23
0
void FCPtrFieldEditor::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::FactoryPost)
    {
        //Fill in all of the editable types
        UInt32 NumTypes(TypeFactory::the()->getNumTypes());
        FieldType* type;
        for(UInt32 i(0) ; i<NumTypes; ++i)
        {
            type = dynamic_cast<FieldType*>(TypeFactory::the()->findType(i));
            if(type != NULL &&
               (type->getClass() == FieldType::PtrField ||
               type->getClass() == FieldType::ChildPtrField))
            {
                _EditableTypes.push_back(&type->getContentType());
                FieldEditorFactory::the()->setEditorType(&type->getContentType(), &getClassType(),
                                                         "FieldContainerPtr");
            }
        }
    }
}
void GenericFieldEditor::initMethod(InitPhase ePhase)
{
    Inherited::initMethod(ePhase);

    if(ePhase == TypeObject::FactoryPost)
    {
        //Fill in all of the editable types
        UInt32 NumTypes(TypeFactory::the()->getNumTypes());
        DataType* type;
        for(UInt32 i(0) ; i<NumTypes; ++i)
        {
            type = dynamic_cast<DataType*>(TypeFactory::the()->findType(i));
            if(type != NULL &&
                *type != FieldTraits<AttachmentMap>::getType() &&
                *type != FieldTraits<ChangedFunctorCallback>::getType())
            {
                _EditableTypes.push_back(type);
                FieldEditorFactory::the()->setEditorType(type, &getClassType(), "Generic");
            }
            FieldEditorFactory::the()->removeEditorType(&FieldTraits<MaterialMap>::getType(), "Generic");
        }
    }
}
Exemplo n.º 25
0
void RigidBody::create(RigidBodyPrototype* prototype, Scene* scene, Shapes* final_shapes)
{

 if (mActor != 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that was already created.");
  return;
 }
 
 if (prototype == 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that has no prototype.");
  return;
 }
 
 if (scene == 0)
 {
  NxOgre_ThrowError("RigidBody tried to create an actor that has no scene.");
  return;
 }

 if (prototype->mShapes.size() == 0)
 {
  NxOgre_ThrowError("RigidBody has no shapes.");
  return;
 }

 mScene = scene;
 
 
 NxActorDesc actor_description;
 NxBodyDesc  body_description;
 
 // Copy over the prototype into the Actor and possible Body descriptions.
 Functions::PrototypeFunctions::RigidBodyPrototypeToNxActorAndNxBodyDesc(prototype, actor_description, body_description);
 
 // Create the shapes, and bind them to the shape that represents them - or not.

 for (unsigned int i=0;i < prototype->mShapes.size(); i++)
 {
  Shape* shape = prototype->mShapes[i];
  NxShapeDesc* description = shape->create();
  //OUAN HACK MAYBE HERE IS WHY SHAPES DIDNT GET ITS NAME
  description->name=prototype->mName.c_str();

  if (description)
  {
   if (final_shapes)
    description->userData = (void*) NxOgre_New(PhysXPointer)(shape, shape->getClassType(), this);
   actor_description.shapes.push_back(description);
  }
 }
 
 
 mActor = mScene->getScene()->createActor(actor_description);
 
 if (mActor == 0)
 {
  SharedStringStream ss;
  ss << "RigidBody actor was not created! \n"
     << "Reason(s) are: \n" <<  Reason::whyAsStream(actor_description);
  NxOgre_ThrowError(ss.get());
  return;
 }
 
 mActor->userData = (void*) NxOgre_New(PhysXPointer)(this, getClassType());
 
 for (unsigned int i=0; i < actor_description.shapes.size(); i++)
 {
  NxShapeDesc* desc = actor_description.shapes[i];
  delete desc;
 }
 
 if (final_shapes)
 {
  NxShape* const* shapes = mActor->getShapes();
  NxU32 nbShapes = mActor->getNbShapes();
  
  while (nbShapes--)
  {
   NxShape* physx_shape = shapes[nbShapes];
   PhysXShapeBinder::BindShape(physx_shape);
   final_shapes->insert(pointer_representive_cast<Shape>(physx_shape->userData));
  }
 }

 
}
Exemplo n.º 26
0
void ComponentTransform::initMethod (void)
{
    DrawAction::registerEnterDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::drawEnter));

    DrawAction::registerLeaveDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::drawLeave));


    RenderAction::registerEnterDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::renderEnter));

    RenderAction::registerLeaveDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::renderLeave));

    IntersectAction::registerEnterDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::intersectEnter));

    IntersectAction::registerLeaveDefault(
        getClassType(),
        osgTypedMethodFunctor2BaseCPtrRef<
        Action::ResultE,
        ComponentTransformPtr  ,
        CNodePtr               ,
        Action                *>(&ComponentTransform::intersectLeave));

    IntersectActor::regClassEnter(
        osgTypedMethodFunctor2BaseCPtr<
        NewActionTypes::ResultE,
        ComponentTransformPtr  ,
        NodeCorePtr            ,
        ActorBase::FunctorArgumentType &>(&ComponentTransform::intersectActorEnter),
        getClassType());

    IntersectActor::regClassLeave(
        osgTypedMethodFunctor2BaseCPtr<
        NewActionTypes::ResultE,
        ComponentTransformPtr  ,
        NodeCorePtr            ,
        ActorBase::FunctorArgumentType &>(&ComponentTransform::intersectActorLeave),
        getClassType());
}
Exemplo n.º 27
0
vector<std::string> ofxGuiInputField<Type>::getClassTypes(){
	vector<std::string> types = ofxGuiElement::getClassTypes();
	types.push_back(getClassType());
	return types;
}
Exemplo n.º 28
0
/**
 * This method test if S is 'instanceof' T
 * \param classId_S The class id of S
 * \param classId_T The class id of T
 * \return true, if S is 'instanceof' T; false otherwise.
 */
BOOL CP_IsInstanceOf(u2 classId_S, u2 classId_T) {
	CLASS_TYPE type_T = getClassType(classId_T);
	CLASS_TYPE type_S = getClassType(classId_S);

	BOOL instanceOf;
	if (isObjectArray(classId_S) || isPrimitiveValueArray(classId_S)) {
		if (isObjectArray(classId_T)) {
			if (isObjectArray(classId_S)) {
				// Both are object arrays:
				u2 classId_SC = getArrayElementClassId(classId_S);
				u2 classId_TC = getArrayElementClassId(classId_T);
				instanceOf = CP_IsInstanceOf(classId_SC, classId_TC);
			} else {
				instanceOf = FALSE;
			}
		} else if (isPrimitiveValueArray(classId_T)) {
			instanceOf = (classId_T == classId_S) ? TRUE : FALSE;
		} else if (type_T == CT_CLASS) {
			instanceOf = classId_T == 0 ? TRUE : FALSE;
		} else {
			// S shall implement T:
			if (!is_S_implementing_T(classId_S, classId_T)) {
				instanceOf = FALSE;
			} else {
				instanceOf = TRUE;
			}
			consout("not tested, since arrays does not implement any interfaces ... %d\n",
					instanceOf);
			jvmexit(1);
		}
	} else if (type_S == CT_CLASS) {
		if (type_T == CT_CLASS) {
			instanceOf = classId_S == classId_T ? TRUE : FALSE;
			if (!instanceOf) {
				instanceOf = is_S_SubClassing_T(classId_S, classId_T);
			}
		} else {
			// S shall implement T:
			if (!is_S_implementing_T(classId_S, classId_T)) {
				instanceOf = FALSE;
			} else {
				instanceOf = TRUE;
			}
		}
	} else if (type_S == CT_INTERFACE) {
		// All objects in this VM has a class reference; so we don't support any classes having a class id which
		// is an interface.
		// This piece of code is not testable nor tested ;-)
		consout("not implemented\n");
		jvmexit(1);
	} else {
		consout("not implemented\n");
		jvmexit(1);
	}

	/*
	 *i If S is an ordinary (nonarray) class, then:
	 *i    o If T is a class type, then S must be the same class (§2.8.1) as T or a subclass of T.
	 *i    o If T is an interface type, then S must implement (§2.13) interface T.
	 *i If S is an interface type, then:
	 *-    o If T is a class type, then T must be Object (§2.4.7).
	 *-    o If T is an interface type, then T must be the same interface as S, or a superinterface of S (§2.13.2).
	 *  If S is a class representing the array type SC[], that is, an array of components of type SC, then:
	 *i    o If T is a class type, then T must be Object (§2.4.7).
	 *i    o If T is an array type TC[], that is, an array of components of type TC, then one of the following must be true:
	 *i        + TC and SC are the same primitive type (§2.4.1).
	 *i        + TC and SC are reference types (§2.4.6), and type SC can be cast to TC by these runtime rules.
	 *(i)  o If T is an interface type, T must be one of the interfaces implemented by arrays (§2.15).
	 */
	return instanceOf;
}
Exemplo n.º 29
0
void CSSValue::finalizeGarbageCollectedObject() {
  switch (getClassType()) {
    case BasicShapeCircleClass:
      toCSSBasicShapeCircleValue(this)->~CSSBasicShapeCircleValue();
      return;
    case BasicShapeEllipseClass:
      toCSSBasicShapeEllipseValue(this)->~CSSBasicShapeEllipseValue();
      return;
    case BasicShapePolygonClass:
      toCSSBasicShapePolygonValue(this)->~CSSBasicShapePolygonValue();
      return;
    case BasicShapeInsetClass:
      toCSSBasicShapeInsetValue(this)->~CSSBasicShapeInsetValue();
      return;
    case BorderImageSliceClass:
      toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
      return;
    case ColorClass:
      toCSSColorValue(this)->~CSSColorValue();
      return;
    case CounterClass:
      toCSSCounterValue(this)->~CSSCounterValue();
      return;
    case CursorImageClass:
      toCSSCursorImageValue(this)->~CSSCursorImageValue();
      return;
    case FontFaceSrcClass:
      toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue();
      return;
    case FontFamilyClass:
      toCSSFontFamilyValue(this)->~CSSFontFamilyValue();
      return;
    case FontFeatureClass:
      toCSSFontFeatureValue(this)->~CSSFontFeatureValue();
      return;
    case FunctionClass:
      toCSSFunctionValue(this)->~CSSFunctionValue();
      return;
    case LinearGradientClass:
      toCSSLinearGradientValue(this)->~CSSLinearGradientValue();
      return;
    case RadialGradientClass:
      toCSSRadialGradientValue(this)->~CSSRadialGradientValue();
      return;
    case CrossfadeClass:
      toCSSCrossfadeValue(this)->~CSSCrossfadeValue();
      return;
    case PaintClass:
      toCSSPaintValue(this)->~CSSPaintValue();
      return;
    case CustomIdentClass:
      toCSSCustomIdentValue(this)->~CSSCustomIdentValue();
      return;
    case ImageClass:
      toCSSImageValue(this)->~CSSImageValue();
      return;
    case InheritedClass:
      toCSSInheritedValue(this)->~CSSInheritedValue();
      return;
    case InitialClass:
      toCSSInitialValue(this)->~CSSInitialValue();
      return;
    case UnsetClass:
      toCSSUnsetValue(this)->~CSSUnsetValue();
      return;
    case GridAutoRepeatClass:
      toCSSGridAutoRepeatValue(this)->~CSSGridAutoRepeatValue();
      return;
    case GridLineNamesClass:
      toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
      return;
    case GridTemplateAreasClass:
      toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
      return;
    case PathClass:
      toCSSPathValue(this)->~CSSPathValue();
      return;
    case PrimitiveClass:
      toCSSPrimitiveValue(this)->~CSSPrimitiveValue();
      return;
    case IdentifierClass:
      toCSSIdentifierValue(this)->~CSSIdentifierValue();
      return;
    case QuadClass:
      toCSSQuadValue(this)->~CSSQuadValue();
      return;
    case ReflectClass:
      toCSSReflectValue(this)->~CSSReflectValue();
      return;
    case ShadowClass:
      toCSSShadowValue(this)->~CSSShadowValue();
      return;
    case StringClass:
      toCSSStringValue(this)->~CSSStringValue();
      return;
    case CubicBezierTimingFunctionClass:
      toCSSCubicBezierTimingFunctionValue(this)
          ->~CSSCubicBezierTimingFunctionValue();
      return;
    case StepsTimingFunctionClass:
      toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue();
      return;
    case UnicodeRangeClass:
      toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue();
      return;
    case URIClass:
      toCSSURIValue(this)->~CSSURIValue();
      return;
    case ValueListClass:
      toCSSValueList(this)->~CSSValueList();
      return;
    case ValuePairClass:
      toCSSValuePair(this)->~CSSValuePair();
      return;
    case ImageSetClass:
      toCSSImageSetValue(this)->~CSSImageSetValue();
      return;
    case CSSContentDistributionClass:
      toCSSContentDistributionValue(this)->~CSSContentDistributionValue();
      return;
    case VariableReferenceClass:
      toCSSVariableReferenceValue(this)->~CSSVariableReferenceValue();
      return;
    case CustomPropertyDeclarationClass:
      toCSSCustomPropertyDeclaration(this)->~CSSCustomPropertyDeclaration();
      return;
    case PendingSubstitutionValueClass:
      toCSSPendingSubstitutionValue(this)->~CSSPendingSubstitutionValue();
      return;
  }
  ASSERT_NOT_REACHED();
}
Exemplo n.º 30
0
bool CSSValue::equals(const CSSValue& other) const {
  if (m_classType == other.m_classType) {
    switch (getClassType()) {
      case BasicShapeCircleClass:
        return compareCSSValues<CSSBasicShapeCircleValue>(*this, other);
      case BasicShapeEllipseClass:
        return compareCSSValues<CSSBasicShapeEllipseValue>(*this, other);
      case BasicShapePolygonClass:
        return compareCSSValues<CSSBasicShapePolygonValue>(*this, other);
      case BasicShapeInsetClass:
        return compareCSSValues<CSSBasicShapeInsetValue>(*this, other);
      case BorderImageSliceClass:
        return compareCSSValues<CSSBorderImageSliceValue>(*this, other);
      case ColorClass:
        return compareCSSValues<CSSColorValue>(*this, other);
      case CounterClass:
        return compareCSSValues<CSSCounterValue>(*this, other);
      case CursorImageClass:
        return compareCSSValues<CSSCursorImageValue>(*this, other);
      case FontFaceSrcClass:
        return compareCSSValues<CSSFontFaceSrcValue>(*this, other);
      case FontFamilyClass:
        return compareCSSValues<CSSFontFamilyValue>(*this, other);
      case FontFeatureClass:
        return compareCSSValues<CSSFontFeatureValue>(*this, other);
      case FunctionClass:
        return compareCSSValues<CSSFunctionValue>(*this, other);
      case LinearGradientClass:
        return compareCSSValues<CSSLinearGradientValue>(*this, other);
      case RadialGradientClass:
        return compareCSSValues<CSSRadialGradientValue>(*this, other);
      case CrossfadeClass:
        return compareCSSValues<CSSCrossfadeValue>(*this, other);
      case PaintClass:
        return compareCSSValues<CSSPaintValue>(*this, other);
      case CustomIdentClass:
        return compareCSSValues<CSSCustomIdentValue>(*this, other);
      case ImageClass:
        return compareCSSValues<CSSImageValue>(*this, other);
      case InheritedClass:
        return compareCSSValues<CSSInheritedValue>(*this, other);
      case InitialClass:
        return compareCSSValues<CSSInitialValue>(*this, other);
      case UnsetClass:
        return compareCSSValues<CSSUnsetValue>(*this, other);
      case GridAutoRepeatClass:
        return compareCSSValues<CSSGridAutoRepeatValue>(*this, other);
      case GridLineNamesClass:
        return compareCSSValues<CSSGridLineNamesValue>(*this, other);
      case GridTemplateAreasClass:
        return compareCSSValues<CSSGridTemplateAreasValue>(*this, other);
      case PathClass:
        return compareCSSValues<CSSPathValue>(*this, other);
      case PrimitiveClass:
        return compareCSSValues<CSSPrimitiveValue>(*this, other);
      case IdentifierClass:
        return compareCSSValues<CSSIdentifierValue>(*this, other);
      case QuadClass:
        return compareCSSValues<CSSQuadValue>(*this, other);
      case ReflectClass:
        return compareCSSValues<CSSReflectValue>(*this, other);
      case ShadowClass:
        return compareCSSValues<CSSShadowValue>(*this, other);
      case StringClass:
        return compareCSSValues<CSSStringValue>(*this, other);
      case CubicBezierTimingFunctionClass:
        return compareCSSValues<CSSCubicBezierTimingFunctionValue>(*this,
                                                                   other);
      case StepsTimingFunctionClass:
        return compareCSSValues<CSSStepsTimingFunctionValue>(*this, other);
      case UnicodeRangeClass:
        return compareCSSValues<CSSUnicodeRangeValue>(*this, other);
      case URIClass:
        return compareCSSValues<CSSURIValue>(*this, other);
      case ValueListClass:
        return compareCSSValues<CSSValueList>(*this, other);
      case ValuePairClass:
        return compareCSSValues<CSSValuePair>(*this, other);
      case ImageSetClass:
        return compareCSSValues<CSSImageSetValue>(*this, other);
      case CSSContentDistributionClass:
        return compareCSSValues<CSSContentDistributionValue>(*this, other);
      case CustomPropertyDeclarationClass:
        return compareCSSValues<CSSCustomPropertyDeclaration>(*this, other);
      case VariableReferenceClass:
        return compareCSSValues<CSSVariableReferenceValue>(*this, other);
      case PendingSubstitutionValueClass:
        return compareCSSValues<CSSPendingSubstitutionValue>(*this, other);
    }
    ASSERT_NOT_REACHED();
    return false;
  }
  return false;
}