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


C++ ObjectType类代码示例

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


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

示例1: result

dmz::Boolean
dmz::NetModulePacketCodecBasic::register_object (
      const Handle ObjectHandle,
      const ObjectType &Type,
      Marshal &outData) {

   Boolean result (False);

   _objTable.remove (ObjectHandle);

   ObjectType current (Type);

   EncodeObjectStruct *eos (0);

   do {

      eos = _objTypeTable.lookup (current.get_handle ());
      current.become_parent ();

   } while (current && !eos);

   if (ObjectHandle && eos && _objTable.store (ObjectHandle, eos)) {

      result = _write_object (ObjectHandle, NetObjectActivate, outData);
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:28,代码来源:dmzNetModulePacketCodecBasic.cpp

示例2: switch

int CJSONValue::GetCount (void) const

//	GetCount
//
//	Returns the number of elements

	{
	switch (m_iType)
		{
		case typeNull:
			return 0;

		case typeArray:
			{
			ArrayType *pArray = (ArrayType *)m_pValue;
			return pArray->GetCount();
			}

		case typeObject:
			{
			ObjectType *pObj = (ObjectType *)m_pValue;
			return pObj->GetCount();
			}

		default:
			return 1;
		}
	}
开发者ID:bmer,项目名称:Alchemy,代码行数:28,代码来源:CJSONValue.cpp

示例3: Allocate

inline ObjectType* ObjectHeap< ObjectType >::AllocateFresh( void )
{
	ObjectType* object = Allocate();
	if( object )
		object->Reset();
	return object;
}
开发者ID:spencerparkin,项目名称:GAVisTool,代码行数:7,代码来源:ObjectHeap.hpp

示例4: result

dmz::Boolean
dmz::NetModuleLocalDRBasic::update_object (const Handle ObjectHandle) {

   Boolean result (False);

   if (_objMod) {

      const ObjectType Type (_objMod->lookup_object_type (ObjectHandle));

      if (Type) {

         ObjectUpdate *test (_typeTable.lookup (Type.get_handle ()));

         if (!test) { test = _create_test_from_type (Type); }

         Boolean limitRate (False);

         while (test && !result && !limitRate) {

            result = test->update_object (ObjectHandle, *_objMod, limitRate);
            test = test->next;
         }
      }
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:27,代码来源:dmzNetModuleLocalDRBasic.cpp

示例5: Name

dmz::Boolean
dmz::QtPluginCanvasObjectBasic::_find_config_from_type (
      Config &local,
      ObjectType &objType) {

   const String Name (get_plugin_name ());

   Boolean found (objType.get_config ().lookup_all_config_merged (Name, local));

   if (!found) {

      ObjectType currentType (objType);
      currentType.become_parent ();

      while (currentType && !found) {

         if (currentType.get_config ().lookup_all_config_merged (Name, local)) {

            found = True;
            objType = currentType;
         }

         currentType.become_parent ();
      }
   }

   return found;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:28,代码来源:dmzQtPluginCanvasObjectBasic.cpp

示例6: currentType

dmz::QtPluginCanvasObjectBasic::ModelStruct *
dmz::QtPluginCanvasObjectBasic::_get_model_struct (const ObjectType &ObjType) {

   ModelStruct *retVal (_masterModelTable.lookup (ObjType.get_handle ()));

   if (!retVal) {

      Config local;
      ObjectType currentType (ObjType);

      if (_find_config_from_type (local, currentType)) {

         ModelStruct *ms (_modelTable.lookup (currentType.get_handle ()));

         if (!ms) {

            ms = _config_to_model_struct (local, currentType);

            if (ms) {

               _modelTable.store (ms->ObjType.get_handle (), ms);
            }
         }

         retVal = ms;
      }
   }

   if (retVal) {

      _masterModelTable.store (ObjType.get_handle (), retVal);
   }

   return retVal;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:35,代码来源:dmzQtPluginCanvasObjectBasic.cpp

示例7: worldToScreenCoords

static Rect worldToScreenCoords(const Point3f &_position, const ObjectType &_type, const Point2f &fov_size, const Size &frame_size, float cameraElevation)
{
	// TODO : replace magic numbers with an object depth property
	// This constant is half a ball diameter (9.75-ish inches), converted to meters
	// For example, goals will have 0 depth since we're just shooting at
	// a plane. 3d objects will have depth, though, so we track the center of the
	// rather than the front.
	float r = sqrtf(_position.x * _position.x + _position.y * _position.y + _position.z * _position.z); // - (4.572 * 25.4)/1000.0;
	float azimuth = asinf(_position.x / sqrt(_position.x * _position.x + _position.y * _position.y));
	float inclination = asinf( _position.z / r ) + cameraElevation;

	//inverse of formula in screenToWorldCoords()
	Point2f dist_to_center(
			tan(azimuth) * (0.5 * frame_size.width / tan(fov_size.x / 2)),
			tan(inclination) * (0.5 * frame_size.height / tan(fov_size.y / 2)));
	
	cout << "Distance to center: " << dist_to_center << endl;
	Point2f rect_center(
			dist_to_center.x + (frame_size.width / 2.0),
			-dist_to_center.y + (frame_size.height / 2.0));

	Point2f angular_size( 2.0 * atan2f(_type.width(), (2.0*r)), 2.0 * atan2f(_type.height(), (2.0*r)));
	Point2f screen_size(
			angular_size.x * (frame_size.width / fov_size.x),
			angular_size.y * (frame_size.height / fov_size.y));

	Point topLeft(
			cvRound(rect_center.x - (screen_size.x / 2.0)),
			cvRound(rect_center.y - (screen_size.y / 2.0)));
			return Rect(topLeft.x, topLeft.y, cvRound(screen_size.x), cvRound(screen_size.y));
}
开发者ID:FRC900,项目名称:2016VisionCode,代码行数:31,代码来源:track3d.cpp

示例8: objectName

void
ObjectType::setLayout(ObjectTypeLayout* l)
{
    if (!l) {
        cerr << "[WARNING] ObjectType::setLayout: Cannot set layout to 0." << endl;
        return;
    }

    if (layout()) {
        if (layout() != l) {
            cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" << l->objectName().cstring();
            cerr << "' on ObjectType '" << objectName().cstring() << "', which already has a layout." << endl;
        }
        return;
    }

    ObjectType* oldParent = l->parent();
    if (oldParent && oldParent != this) {
        if (oldParent->isLayoutType()) {
            cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '" << l->objectName().cstring();
            cerr << "' on ObjectType '" << objectName().cstring() << "', when the ObjectTypeLayout already has a parent layout." << endl;
            return;
        } else {
            // Steal the layout from an ObjectType parent.
            oldParent->takeLayout();
        }
    }

    m_layout = l;
    if (oldParent != this) {
        l->setParent(this);
        l->reparentChildren(this);
    }
}
开发者ID:M4rtinK,项目名称:shiboken-bb10,代码行数:34,代码来源:objecttype.cpp

示例9: ObjectType

void Module::setSpecification(const ObjectType& parent, const ObjectType& child)
{
    if (!parent.typeTemplate().isVirtual()) {
        Log::error("Cannot forward ",parent," to ",child," because ",parent.typeTemplate(), " is not virtual ");
    }
    const ObjectType* parentPtr = new ObjectType(parent);
    _automaticSpecifications.insert(std::make_pair(parentPtr, child));
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:8,代码来源:module.cpp

示例10: create

ObjectType*
ObjectType::createWithChild()
{
    ObjectType* parent = create();
    ObjectType* child = create();
    child->setObjectName("child");
    child->setParent(parent);
    return parent;
}
开发者ID:M4rtinK,项目名称:shiboken-bb10,代码行数:9,代码来源:objecttype.cpp

示例11: setupObject

void ObjectTypeManager::setupObject(IGObject::Ptr obj, uint32_t type){
  if(checkValid(type)){
    ObjectType* prototype = typeStore[type];
    obj->setType(type);
    prototype->setupObject(obj);
  }else{
    //TODO throw exception?
  }
}
开发者ID:epyon,项目名称:tpserver-cpp,代码行数:9,代码来源:objecttypemanager.cpp

示例12: config_to_string

// QtPluginIconPalletTool Interface
void
dmz::QtPluginIconPalletTool::_add_type (const ObjectType &Type) {

   const String IconResource = config_to_string (
      get_plugin_name () + ".resource",
      Type.get_config());

   const String IconName = _rc.find_file (IconResource);

   if (IconName) {

      const String Name = Type.get_name ();

      if (Name) {

         QImage back (
            (int)_iconExtent,
            (int)_iconExtent,
            QImage::Format_ARGB32_Premultiplied);
         QPainter painter (&back);
         painter.setCompositionMode (QPainter::CompositionMode_Source);
         painter.fillRect (back.rect (), Qt::transparent);
         painter.setCompositionMode (QPainter::CompositionMode_SourceOver);
         QSvgRenderer qsr (QString (IconName.get_buffer ()));
         QRectF size = qsr.viewBoxF ();
         qreal width = size.width ();
         qreal height = size.height ();
         qreal scale = (width > height) ? width : height;
         if (scale <= 0.0f) { scale = 1.0f; }
         scale = _iconExtent / scale;
         width *= scale;
         height *= scale;
         size.setWidth (width);
         size.setHeight (height);
         if (height < _iconExtent) { size.moveTop ((_iconExtent - height) * 0.5f); }
         if (width < _iconExtent) { size.moveLeft ((_iconExtent - width) * 0.5f); }
         qsr.render (&painter, size);
         painter.end ();
         QIcon icon;
         icon.addPixmap (QPixmap::fromImage (back));
         QStandardItem *item = new QStandardItem (icon, Name.get_buffer ());
         item->setEditable (false);
         _model.appendRow (item);
      }
   }
   else if (IconResource) {

      _log.error << "Unable to find icon resource: " << IconResource
          << " for object type: " << Type.get_name () << endl;
   }

   RuntimeIterator it;
   ObjectType next;

   while (Type.get_next_child (it, next)) { _add_type (next); }
}
开发者ID:sbhall,项目名称:dmz,代码行数:57,代码来源:dmzQtPluginIconPalletTool.cpp

示例13: config_to_string

void
dmz::QtPluginCanvasObject::_init (Config &local, Config &global) {

   _canvasModuleName = config_to_string ("module.canvas.name", local);

   Config pluginList;

   if (local.lookup_all_config ("plugins.plugin", pluginList)) {

      RuntimeContext *context (get_plugin_runtime_context ());

      if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) {

         _extensions.discover_plugins ();
      }
   }

   _defaultAttributeHandle = activate_default_object_attribute (
      ObjectCreateMask |
      ObjectDestroyMask |
      ObjectPositionMask |
      ObjectOrientationMask);

   _linkAttributeHandle = activate_object_attribute (
      ObjectAttributeLayerLinkName,
      ObjectLinkMask | ObjectUnlinkMask);

#if 0
   Config preLoadList;

   if (local.lookup_all_config ("preload", preLoadList)) {

      Config data;
      ConfigIterator it;

      Boolean done (!preLoadList.get_first_config (it, data));

      while (!done) {

         ObjectType objType;
         Mask objState;

         if (_defs.lookup_object_type (config_to_string ("type", data), objType)) {

            _defs.lookup_state (config_to_string ("state", data), objState);

            _log.info << "Pre-Loading object of type: " << objType.get_name () << endl;
            _get_model_struct (objType, objState);
         }

         done = !preLoadList.get_next_config (it, data);
      }
   }
#endif
}
开发者ID:Andais,项目名称:dmz,代码行数:55,代码来源:dmzQtPluginCanvasObject.cpp

示例14: SN_ERROR

//------------------------------------------------------------------------------
void ObjectTypeDatabase::unregisterType(const ObjectType & t)
{
    if (t.getID() < m_types.size())
    {
        m_types[t.getID()] = nullptr;
    }
    else
    {
        SN_ERROR("ObjectTypeDatabase::unregisterType: type not found (" << t.toString() << ")");
    }
}
开发者ID:Zylann,项目名称:SnowfeetEngine,代码行数:12,代码来源:ObjectTypeDatabase.cpp

示例15: setExtension

void Module::setExtension(const ObjectTypeTemplate &childTemplate, const ObjectType &parent, const std::map<int, int> &parameterMapping)
{
    setExtension(childTemplate, [parent, parameterMapping](const ObjectType& type)
    {
        ObjectType father = parent;
        for(const auto& binding : parameterMapping)
        {
            father.setParameter(binding.second, type.parameterValue(binding.first));
        }
        return father;
    });
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:12,代码来源:module.cpp


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