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


C++ TypeMismatchException函数代码示例

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


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

示例1: TypeMismatchException

/** Adds the given colormap to this colormap.
 * This operator takes the given colormap and compares it to this colormap. If
 * this colormap has C_OTHER or C_BACKGROUND the value is compied from the other
 * LUT, otherwise the value is kept as is.
 * @param cmlt other colormap to add
 * @return reference to this
 */
Colormap &
YuvColormap::operator+=(const Colormap &cmlt)
{
	const YuvColormap *tc = dynamic_cast<const YuvColormap *>(&cmlt);
	if (tc == NULL) {
		throw TypeMismatchException("Only YUV colormaps can be added to a YUV colormap");
	}

	if ((width_ != tc->width_) || (height_ != tc->height_) || (depth_ != tc->depth_)) {
		throw TypeMismatchException("YuvColormaps are of different sizes");
	}

	unsigned char *this_lut  = lut_;
	unsigned char *other_lut = tc->lut_;

	for (unsigned int i = 0; i < plane_size_ * depth_; ++i) {
		if ((*this_lut == C_OTHER) || (*this_lut == C_BACKGROUND)) {
			// can be overridden
			if ((*other_lut != C_OTHER) && (*other_lut != C_BACKGROUND)) {
				// there is something that is worth overriding this value
				*this_lut = *other_lut;
			}
		}
		++this_lut;
		++other_lut;
	}

	return *this;
}
开发者ID:fawkesrobotics,项目名称:fawkes,代码行数:36,代码来源:yuvcm.cpp

示例2: TypeMismatchException

//  Fill in a caller-provided unsigned int
void Optarg::Value(unsigned int& i) const
{
    CString cs = _value.getCString();
    const char* s = cs;
    Boolean valid = true;
    Uint32 j;

    for (j = 0; j < strlen (s); j++)
    {
        if ((!isdigit (s [j])) && (!isspace (s [j])))
        {
            valid = false;
            break;
        }
    }
    if (valid)
    {
        Uint64 i64;
        if ( !(sscanf (s, "%" PEGASUS_64BIT_CONVERSION_WIDTH "u", &i64)) ||
             (i64 > 0xFFFFFFFF))
        {
            throw TypeMismatchException ();
        }

        i = Uint32(i64);
    }
    else
    {
        throw TypeMismatchException();
    }
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:32,代码来源:getoopt.cpp

示例3: TypeMismatchException

void CIMPropertyRep::setValue(const CIMValue& value)
{
    // CIMType of value is immutable:

    if (!value.typeCompatible(_value))
	throw TypeMismatchException();

    if (_arraySize && _arraySize != value.getArraySize())
	throw TypeMismatchException();

    _value = value;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:12,代码来源:CIMPropertyRep.cpp

示例4: NullPointerException

/** Get value of current field as bool array.
 * @return field value
 * @exception NullPointerException invalid iterator, possibly end iterator
 * @exception TypeMismatchException thrown if field is not of type bool or field
 * is not an array (length is 1)
 */
bool *
InterfaceFieldIterator::get_bools() const
{
  if ( __infol == NULL ) {
    throw NullPointerException("Cannot get value of end element");
  } else if ( __infol->type != IFT_BOOL ) {
    throw TypeMismatchException("Requested value is not of type bool");
  } else if (__infol->length == 1) {
    throw TypeMismatchException("Field %s is not an array", __infol->name);
  } else {
    return (bool *)__infol->value;
  }
}
开发者ID:fuxiang90,项目名称:fawkes,代码行数:19,代码来源:field_iterator.cpp

示例5: _name

CIMPropertyRep::CIMPropertyRep(
    const CIMName& name,
    const CIMValue& value,
    Uint32 arraySize,
    const CIMName& referenceClassName,
    const CIMName& classOrigin,
    Boolean propagated)
    :
    _name(name), _value(value), _arraySize(arraySize),
    _referenceClassName(referenceClassName), _classOrigin(classOrigin),
    _propagated(propagated), _refCounter(1), _ownerCount(0)
{
    // ensure name is not null
    if (name.isNull())
    {
        throw UninitializedObjectException();
    }

    // Set the CIM name tag.
    _nameTag = generateCIMNameTag(_name);

    if ((arraySize != 0) &&
        (!value.isArray() || value.getArraySize() != arraySize))
    {
        throw TypeMismatchException();
    }

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    // if referenceClassName exists, must be CIMType REFERENCE.
    if (!referenceClassName.isNull())
    {
        if (_value.getType() != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }

    // Can a property be of reference type with a null referenceClassName?
    // The DMTF says yes if it is a property of an instance; no if it is a
    // property of a class.  We'll allow it here, but check in the CIMClass
    // addProperty() method.
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:47,代码来源:CIMPropertyRep.cpp

示例6: TypeMismatchException

void ModuleController::_async_handleEnqueue(AsyncOpNode *op,
					    MessageQueue *q,
					    void *parm)
{

   ModuleController *myself = static_cast<ModuleController *>(q);
   Message *request = op->get_request();
   Message *response = op->get_response();

   if( request && (! (request->getMask() & message_mask::ha_async)))
      throw TypeMismatchException();

   if( response && (! (response->getMask() & message_mask::ha_async) ))
      throw TypeMismatchException();

   op->release();
   myself->return_op(op);

   Uint32 routing=0;

   // get rid of the module wrapper
   if( request && request->getType() == async_messages::ASYNC_MODULE_OP_START )
   {
      (static_cast<AsyncMessage *>(request))->op = NULL;
      AsyncModuleOperationStart *rq = static_cast<AsyncModuleOperationStart *>(request);
      request = rq->get_action();
      request->setRouting(routing = rq->getRouting());
      delete rq;
   }

   // get rid of the module wrapper
   if(response && response->getType() == async_messages::ASYNC_MODULE_OP_RESULT )
   {
      (static_cast<AsyncMessage *>(response))->op = NULL;
      AsyncModuleOperationResult *rp = static_cast<AsyncModuleOperationResult *>(response);
      response = rp->get_result();
      response->setRouting(routing = rp->getRouting());
      delete rp;
   }

   callback_handle *cb = reinterpret_cast<callback_handle *>(parm);

   cb->_module->_send_async_callback(routing, response, cb->_parm);
   delete cb;

   return;
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:47,代码来源:ModuleController.cpp

示例7: TypeMismatchException

void CIMPropertyRep::setValue(const CIMValue& value)
{
    // CIMType of value is immutable:

    if (!value.typeCompatible(_value))
        throw TypeMismatchException();

    if (_arraySize && _arraySize != value.getArraySize())
        throw TypeMismatchException();

    // A CIM Property may not be of reference array type
    if (value.isArray() && (value.getType() == CIMTYPE_REFERENCE))
    {
        throw TypeMismatchException();
    }

    _value = value;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:18,代码来源:CIMPropertyRep.cpp

示例8: ValueArray

void AmArg::assertArray() {
  if (Array == type)
    return;
  if (Undef == type) {
    type = Array;
    v_array = new ValueArray();
    return;
  } 
  throw TypeMismatchException();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:10,代码来源:AmArg.cpp

示例9: TypeMismatchException

/** Copy values from other interface.
 * @param other other interface to copy values from
 */
void
TestInterface::copy_values(const Interface *other)
{
  const TestInterface *oi = dynamic_cast<const TestInterface *>(other);
  if (oi == NULL) {
    throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
                                type(), other->type());
  }
  memcpy(data, oi->data, sizeof(TestInterface_data_t));
}
开发者ID:tempbottle,项目名称:fawkes,代码行数:13,代码来源:TestInterface.cpp

示例10: TypeMismatchException

/** Message content constructor.
 * This constructor is meant to be used with FawkesNetworkMessage::msgc().
 * @param component_id component ID
 * @param msg_id message ID
 * @param payload message payload
 * @param payload_size total payload size
 */
PluginListMessage::PluginListMessage(unsigned int component_id,
				     unsigned int msg_id,
				     void *payload, size_t payload_size)
{
  if ( component_id != FAWKES_CID_PLUGINMANAGER ) {
    throw TypeMismatchException("PluginListMessage: invalid component ID");
  }
  plugin_list_msg_t *tmsg = (plugin_list_msg_t *)payload;
  void *plugin_list_payload = (void *)((size_t)payload + sizeof(msg));
  plugin_list = new DynamicBuffer(&(tmsg->plugin_list), plugin_list_payload,
				  payload_size - sizeof(msg));
}
开发者ID:fuxiang90,项目名称:fawkes,代码行数:19,代码来源:list_message.cpp

示例11: TypeMismatchException

/** Message content constructor.
 * This constructor is meant to be used with FawkesNetworkMessage::msgc().
 * @param component_id component ID
 * @param msg_id message ID
 * @param payload message payload
 * @param payload_size total payload size
 */
BlackBoardInterfaceListContent::BlackBoardInterfaceListContent(unsigned int component_id,
							       unsigned int msg_id,
							       void *payload,
							       size_t payload_size)
{
  if ( component_id != FAWKES_CID_BLACKBOARD ) {
    throw TypeMismatchException("BlackBoardInterfaceListContent: invalid component ID");
  }
  bb_ilist_msg_t *tmsg = (bb_ilist_msg_t *)payload;
  void *ilist_payload = (void *)((size_t)payload + sizeof(msg));
  interface_list = new DynamicBuffer(&(tmsg->interface_list), ilist_payload,
				     payload_size - sizeof(msg));
}
开发者ID:fuxiang90,项目名称:fawkes,代码行数:20,代码来源:ilist_content.cpp

示例12: TypeMismatchException

CIMKeyBinding::CIMKeyBinding(const CIMName& name, const CIMValue& value)
{
    if (value.isArray())
    {
        throw TypeMismatchException();
    }

    String kbValue = value.toString();
    Type kbType;

    switch (value.getType())
    {
    case CIMTYPE_BOOLEAN:
        kbType = BOOLEAN;
        break;
    case CIMTYPE_CHAR16:
    case CIMTYPE_STRING:
    case CIMTYPE_DATETIME:
        kbType = STRING;
        break;
    case CIMTYPE_REFERENCE:
        kbType = REFERENCE;
        break;
//  case CIMTYPE_REAL32:
//  case CIMTYPE_REAL64:
    case CIMTYPE_OBJECT:
    case CIMTYPE_INSTANCE:
        // From PEP 194: EmbeddedObjects cannot be keys.
        throw TypeMismatchException();
        break;
    default:
        kbType = NUMERIC;
        break;
    }

    _rep = new CIMKeyBindingRep(name, kbValue, kbType);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:37,代码来源:CIMObjectPath.cpp

示例13: _name

CIMParameterRep::CIMParameterRep(
    const CIMName& name,
    CIMType type,
    Boolean isArray,
    Uint32 arraySize,
    const CIMName& referenceClassName)
    : _name(name), _type(type),
    _isArray(isArray), _arraySize(arraySize),
    _referenceClassName(referenceClassName)
{
    // ensure name is not null
    if(name.isNull())
    {
        throw UninitializedObjectException();
    }

    if((_arraySize != 0) && !_isArray)
    {
        throw TypeMismatchException();
    }

    if (!referenceClassName.isNull())
    {
        if (_type != CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }
    else
    {
        if (_type == CIMTYPE_REFERENCE)
        {
            throw TypeMismatchException();
        }
    }
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:36,代码来源:CIMParameterRep.cpp

示例14: strtoul

void CIMClientRep::compareObjectPathtoCurrentConnection(const CIMObjectPath& obj)
{

    String ObjHost = obj.getHost();
    // test if a host is given at all, if not everything is fine and we leave it at that
    if (ObjHost==String::EMPTY)
    {
        return;
    }

    MessageLoaderParms typeMismatchMessage;
    // splitting the port from hostname as we have to compare both separate
    int i = ObjHost.find(":");
    String ObjPort = String::EMPTY;
    // only if there is a ":" we should split a port address from hostname string
    if (i > 0)
    {
        ObjPort = ObjHost.subString(i+1);
        ObjHost.remove(i);

        // lets see who we are really connected to
        // should stand in UInt32 _connectPortNumber and String _connectHost;

        // comparing the stuff
        // first the easy part, comparing the ports
        Uint32 objectport = strtoul((const char*) ObjPort.getCString(), NULL, 0);

        // if port in object path does not equal port of connection throw a TypeMismatch Exception
        if (objectport != _connectPortNumber)
        {
            typeMismatchMessage = MessageLoaderParms("Client.CIMClientRep.TYPEMISMATCH_PORTMISMATCH",
                                  "Failed validation of CIM object path: port of CIMClient connection($0) and port of object path($1) not equal",
                                  _connectPortNumber, objectport);
            throw TypeMismatchException(typeMismatchMessage);
        }
    }
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:37,代码来源:CIMClientRep.cpp

示例15: createBoundingVolume

    /*!
     * \overload
     *
     * This method creates a new BoundingVolume as a copy of \p copy.
     */
    BoundingVolume* BoundingVolume::createBoundingVolume(World* world, const BoundingVolume* copy, BvhNode* parent) {
        if (!copy) {
            return createBoundingVolume(world, parent);
        }

        if (copy->getVolumeType() != getCreateRigidBoundingVolumeType(world)) {
            std::stringstream errormessage;
            errormessage << "ERROR: requested a copy of BV type "
                    << copy->getVolumeType()
                    << ", but expected type " << getCreateRigidBoundingVolumeType(world)
                    << std::endl;
            throw TypeMismatchException(errormessage.str());
        }

        BoundingVolume* bv = 0;
        switch (getCreateRigidBoundingVolumeType(world)) {
            case BV_TYPE_AABB:
                bv = new Aabb(*static_cast<const Aabb*>(copy));
                break;
            case BV_TYPE_KDOP:
                bv = new Kdop(*static_cast<const Kdop*>(copy));
                break;
            case BV_TYPE_SPHERE:
                bv = new BoundingSphere(*static_cast<const BoundingSphere*>(copy));
                break;
            case BV_TYPE_OBB:
                bv = new Obb(*static_cast<const Obb*>(copy));
                break;
            default:
                // TODO: exception!!
                std::cerr << dc_funcinfo << "FATAL ERROR: bounding volume type " << getCreateRigidBoundingVolumeType(world) << " not supported" << std::endl;
                exit(1);
                return 0;
        }
        bv->setHierarchyNode(parent);
        return bv;
    }
开发者ID:ColinGilbert,项目名称:d-collide,代码行数:42,代码来源:boundingvolume.cpp


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