当前位置: 首页>>代码示例>>C++>>正文


C++ SoType::getName方法代码示例

本文整理汇总了C++中SoType::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ SoType::getName方法的具体用法?C++ SoType::getName怎么用?C++ SoType::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoType的用法示例。


在下文中一共展示了SoType::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void
SoEnabledElementsList::enable(SoType elementType, int stackIndex)
//
////////////////////////////////////////////////////////////////////////
{
    SoType prev = elements[stackIndex];

    // If not enabled before or if enabled before but we are now
    // enabling a more-specific subclass, add the element.
    if (prev.isBad() || 
	(elementType != prev && elementType.isDerivedFrom(prev))) {
	elements.set(stackIndex, elementType);

	// Increment global counter to indicate that lists have changed
	counter++;
    }

#ifdef DEBUG
    // If we aren't enabling a more general super-class (and therefore
    // don't need to do anything), error:
    else if (! prev.isDerivedFrom(elementType)) {
	const char *eltName = elementType.getName().getString();
	SoDebugError::post("SoAction::enableElement",
			   "Cannot enable element %s because element %s "
			   "is already enabled",
			   eltName, prev.getName().getString());
    }
#endif
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:29,代码来源:SoAction.cpp

示例2: assert

SbBool
SoType::isDerivedFrom(const SoType parent) const
{
  assert(!this->isBad());

  if (parent.isBad()) {
#if COIN_DEBUG
    SoDebugError::postWarning("SoType::isDerivedFrom",
                              "can't compare type '%s' against an invalid type",
                              this->getName().getString());
#endif // COIN_DEBUG
    return FALSE;
  }

  SoType type = *this;
  do {
#if COIN_DEBUG && 0 // debug
    SoDebugError::postInfo("SoType::isDerivedFrom",
                           "this: '%s' parent: '%s'",
                           type.getName().getString(),
                           parent.getName().getString());
#endif // debug
    if (type == parent) return TRUE;
    type = (*SoType::typedatalist)[(int)type.getKey()]->parent;
  } while (!type.isBad());

  return FALSE;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:28,代码来源:SoType.cpp

示例3: if

void
SoUnknownNode::createFromIsA(SoMFString *isA)
//
////////////////////////////////////////////////////////////////////////
{
    for (int i = 0; i < isA->getNum(); i++) {
	SoType t = SoType::fromName((*isA)[i]);

	if (t.canCreateInstance() &&
	    t.isDerivedFrom(SoNode::getClassTypeId())) {

	    SoNode *alternateRep = (SoNode *)t.createInstance();
	    alternateRep->ref();
#ifdef DEBUG
	    if (alternateRep == NULL) {
		SoDebugError::post("SoUnknownNode::createFromIsA",
				   "SoType.createInstance returned "
				   "NULL (type %s)",
				   t.getName().getString());
		return;
	    }
#endif
	    // Copy over all fields that are shared:
	    int num = instanceFieldData->getNumFields();
	    for (int j=0; j<num; j++) {
		const SbName &fieldName = instanceFieldData->getFieldName(j);
		SoField *f = instanceFieldData->getField(this, j);
		// Don't copy over fields with default values:
		if (f->isDefault()) continue;
		
		SoField *nf = alternateRep->getField(fieldName);
		if (nf != NULL && nf->getTypeId() == f->getTypeId()) {
		    nf->copyFrom(*f);
		    if (f->isConnectedFromField()) {
			SoField *cf;
			f->getConnectedField(cf);
			nf->connectFrom(cf);
		    } else if (f->isConnectedFromEngine()) {
			SoEngineOutput *eo;
			f->getConnectedEngine(eo);
			nf->connectFrom(eo);
		    }
		}
	    }
	    // And if alternateRep is a group, copy over hidden
	    // children:
	    if (alternateRep->isOfType(SoGroup::getClassTypeId())) {
		SoGroup *g = (SoGroup *)alternateRep;
		for (int kid = 0; kid < hiddenChildren.getLength();
		     kid++) {
		    g->addChild(hiddenChildren[kid]);
		}
	    }
	    addChild(alternateRep);
	    return;
	}
    }
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:58,代码来源:SoUnknownNode.cpp

示例4:

void
SoActionMethodList::addMethod(SoType nodeType, SoActionMethod method)
//
////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
    // Make sure nodeType is a kind of node!
    if (! nodeType.isDerivedFrom(SoNode::getClassTypeId()))
	SoDebugError::post("SoAction::addMethod", "%s is not a node type",
			   nodeType.getName().getString());
#endif /* DEBUG */

    numValidTypes = 0;
    (*this)[SoNode::getActionMethodIndex(nodeType)] = method;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:15,代码来源:SoAction.cpp

示例5: SoFieldData

SoGate::SoGate(SoType inputType)
//
////////////////////////////////////////////////////////////////////////
{
    SO_ENGINE_CONSTRUCTOR(SoGate);
    SO_ENGINE_ADD_INPUT(enable, (0));
    SO_ENGINE_ADD_INPUT(trigger, ());

    myInputData = new SoFieldData(inputData);
    myOutputData = new SoEngineOutputData(outputData);
    input = NULL;

    setup(inputType);
    typeField.setValue(inputType.getName());

    isBuiltIn = TRUE;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:17,代码来源:SoGate.cpp

示例6: if

int
main(void)
{
  SoDB::init();
  SoNodeKit::init();
  SoInteraction::init();

  SoTypeList tl;
  const unsigned int n = SoType::getAllDerivedFrom(SoNode::getClassTypeId(), tl);
  for (unsigned int i=0; i < n; i++) {
    (void)fprintf(stdout, "%s", tl[i].getName().getString());

    SoFieldContainer * fc = (SoFieldContainer *)
      (tl[i].canCreateInstance() ? tl[i].createInstance() : NULL);

    if (fc == NULL) {
      (void)fprintf(stdout, "  (abstract)\n");
      continue;
    }

    (void)fprintf(stdout, "\n");

    SoFieldList fl;
    const unsigned int nrf = fc->getAllFields(fl);
    for (unsigned int j=0; j < nrf; j++) {
      SoField * f = fl[j];
      SoType ftype = f->getTypeId();
      SbName fname;
      f->getContainer()->getFieldName(f, fname);
      (void)fprintf(stdout, "  %s (%s)\n",
                    fname.getString(),
                    ftype.getName().getString());

      if (ftype.isDerivedFrom(SoSFEnum::getClassTypeId())) {
        list_enums((SoSFEnum *)f);
      }
      else if (ftype.isDerivedFrom(SoMFEnum::getClassTypeId())) {
        list_enums((SoMFEnum *)f);
      }
    }
  }

  return 0;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:44,代码来源:dumpnodes.cpp

示例7: if

/*!
  Upgrade \a base, usually created using SoUpgrader::tryCreateNode(),
  to the latest version of the same node.
*/
SoBase *
SoUpgrader::createUpgrade(const SoBase * base)
{
  soupgrader_init_classes();

  SoType type = base->getTypeId();

  if (type == SoPackedColorV20::getClassTypeId()) {
    SoPackedColorV20 * pp = (SoPackedColorV20*) base;
    return (SoBase*) pp->createUpgrade();
  }
  else if (type == SoShapeHintsV10::getClassTypeId()) {
    SoShapeHintsV10 * pp = (SoShapeHintsV10*) base;
    return (SoBase*) pp->createUpgrade();
  }
  else {
    SoDebugError::post("SoUpgrader::createUpgrade",
                       "No upgrade functionality available for %s",
                       type.getName().getString());
  }
  return NULL;
}
开发者ID:Alexpux,项目名称:Coin3D,代码行数:26,代码来源:SoUpgrader.cpp

示例8: DECIDE

void
SoGate::setup(SoType inputType)
//
////////////////////////////////////////////////////////////////////////
{
#ifdef DEBUG
    if (input != NULL) {
	SoDebugError::post("SoGate::setup",
			   "Already initialized!");
    }
#endif

    if (inputType.isDerivedFrom(SoMField::getClassTypeId())) {
	input = (SoMField *)inputType.createInstance();
    } else {
	input = NULL;
    }
    if (input == NULL) {
#ifdef DEBUG
	SoDebugError::post("SoGate::setup",
		   "Couldn't create field of type %s",
			   inputType.getName().getString());
#endif
	conversionCase = BAD_TYPE;
    } else {

	input->setContainer(this);

	// Pass in the static field data as the parent field data for
	// the per-instance field data:
	myInputData->addField(this, "input", input);
    
	// Construct the output:
	output = new SoEngineOutput;
	output->setContainer(this);
	myOutputData->addOutput(this, "output", output, inputType);
	
// This handy macro sets up conversionCase, which is used to quickly
// decide what type we're hooked up to at evaluate() time:

#define DECIDE(class) \
	(inputType == SO__CONCAT(SoMF,class)::getClassTypeId()) { \
	     conversionCase = class; \
	}			     

	// Set up for which switch to use in evaluate() routine:
	if DECIDE(BitMask)
	else if DECIDE(Bool)
	else if DECIDE(Color)
	else if DECIDE(Enum)
	else if DECIDE(Float)
	else if DECIDE(Int32)
	else if DECIDE(Matrix)
	else if DECIDE(Name)
	else if DECIDE(Node)
	else if DECIDE(Path)
	else if DECIDE(Plane)
	else if DECIDE(Rotation)
	else if DECIDE(Short)
	else if DECIDE(String)
	else if DECIDE(Time)
	else if DECIDE(UInt32)
	else if DECIDE(UShort)
	else if DECIDE(Vec2f)
	else if DECIDE(Vec3f)
	else if DECIDE(Vec4f)
#undef DECIDE
	else {
#ifdef DEBUG
	    SoDebugError::post("SoGate::setup",
			"Can't gate field of type %s",
			inputType.getName().getString());
#endif
	    conversionCase = BAD_TYPE;
	}
    }
}    
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:77,代码来源:SoGate.cpp

示例9: catch

void
SoCatch::postExceptionMessage(SoType      ERR_OBJ_TYPE_ID,
                              const char *OP_DESCR_STR,
                              SoType      ACTION_TYPE_ID,
                              const char *END_STR)
{
   SbString objName = "<unknown object>";
   try {
      if(ERR_OBJ_TYPE_ID != SoType::badType()) {
      	 objName = ERR_OBJ_TYPE_ID.getName().getString();
      }
   }
   catch(...) {
      objName="<error getting objTypeName>";
   }

   SbString opString = "";
   try {
      if(OP_DESCR_STR) {
      	 opString = OP_DESCR_STR;
      }
   }
   catch(...) {
      opString = "<error getting description>";
   }

   SbString actionName = "";
   try {
      if(ACTION_TYPE_ID != SoType::badType()) {
      	 actionName = ACTION_TYPE_ID.getName().getString();
      }
   }
   catch(...) {
      actionName="<error getting action type name>";
   }

   SbString endString = "";
   try {
      if(END_STR) {
      	 endString = END_STR;
      }
   }
   catch(...) {
      endString = "<error getting endStr name>";
   }

   SbString traceInfos ="";
   try {
      traceInfos = SoGlobalTraceBuffer.getTraceDumpString();
   }
   catch(...) {
      traceInfos="<error getting traceInfos name>";
   }

   try {
      SoError::post("Crash in %s while %s %s %s %s",
                    objName   .getString(),
                    opString  .getString(),
                    actionName.getString(),
                    endString .getString(),
                    traceInfos.getString());
   }
   catch(...) {
      SoError::post("<Could not create error message after catching error>");
   }
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:66,代码来源:SoCatch.cpp


注:本文中的SoType::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。