• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ InvalidArgument函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkSupported

FXImage *
MFXImageHelper::loadImage(FXApp *a, const std::string& file) {
    FXString ext=FXPath::extension(file.c_str());
    checkSupported(ext);
    FXImage *img=NULL;
    if (comparecase(ext,"gif")==0) {
        img=new FXGIFImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"bmp")==0) {
        img=new FXBMPImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"xpm")==0) {
        img=new FXXPMImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"pcx")==0) {
        img=new FXPCXImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"ico")==0 || comparecase(ext,"cur")==0) {
        img=new FXICOImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"tga")==0) {
        img=new FXTGAImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"rgb")==0) {
        img=new FXRGBImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"xbm")==0) {
        img=new FXXBMImage(a,NULL,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"png")==0) {
        img=new FXPNGImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"jpg")==0 || comparecase(ext,"jpeg")==0) {
        img=new FXJPGImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else if (comparecase(ext,"tif")==0 || comparecase(ext,"tiff")==0) {
        img=new FXTIFImage(a,NULL,IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP);
    } else {
        throw InvalidArgument("Unknown file extension for image '" + file + "'!");
    }

    FXFileStream stream;
    if (img != NULL && stream.open(file.c_str(), FXStreamLoad)) {
        a->beginWaitCursor();
        img->loadPixels(stream);
        stream.close();

        img->create();
        a->endWaitCursor();
    } else {
        throw InvalidArgument("Loading failed!");
    }
    return img;
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:44,代码来源:MFXImageHelper.cpp


示例2: switch

bool
GNEDetectorE2::isValid(SumoXMLAttr key, const std::string& value) {
    switch (key) {
        case SUMO_ATTR_ID:
            return isValidDetectorID(value);
        case SUMO_ATTR_LANE:
            if (value.empty()) {
                return false;
            } else {
                return canParse<std::vector<GNELane*> >(myViewNet->getNet(), value, false);
            }
        case SUMO_ATTR_LANES:
            if (value.empty()) {
                return false;
            } else if (canParse<std::vector<GNELane*> >(myViewNet->getNet(), value, false)) {
                // check if lanes are consecutives
                return lanesConsecutives(parse<std::vector<GNELane*> >(myViewNet->getNet(), value));
            } else {
                return false;
            }
        case SUMO_ATTR_POSITION:
            return canParse<double>(value);
        case SUMO_ATTR_ENDPOS:
            return canParse<double>(value);
        case SUMO_ATTR_FREQUENCY:
            return (canParse<double>(value) && (parse<double>(value) >= 0));
        case SUMO_ATTR_LENGTH:
            return (canParse<double>(value) && (parse<double>(value) >= 0));
        case SUMO_ATTR_NAME:
            return SUMOXMLDefinitions::isValidAttribute(value);
        case SUMO_ATTR_FILE:
            return SUMOXMLDefinitions::isValidFilename(value);
        case SUMO_ATTR_VTYPES:
            if (value.empty()) {
                return true;
            } else {
                return SUMOXMLDefinitions::isValidListOfTypeID(value);
            }
        case SUMO_ATTR_HALTING_TIME_THRESHOLD:
            return (canParse<double>(value) && (parse<double>(value) >= 0));
        case SUMO_ATTR_HALTING_SPEED_THRESHOLD:
            return (canParse<double>(value) && (parse<double>(value) >= 0));
        case SUMO_ATTR_JAM_DIST_THRESHOLD:
            return (canParse<double>(value) && (parse<double>(value) >= 0));
        case SUMO_ATTR_FRIENDLY_POS:
            return canParse<bool>(value);
        case GNE_ATTR_BLOCK_MOVEMENT:
            return canParse<bool>(value);
        case GNE_ATTR_SELECTED:
            return canParse<bool>(value);
        case GNE_ATTR_GENERIC:
            return isGenericParametersValid(value);
        default:
            throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
    }
}
开发者ID:behrisch,项目名称:sumo,代码行数:56,代码来源:GNEDetectorE2.cpp


示例3: InvalidArgument

    void Dictionary::Add(const Dictionary& other)
    {
        for (auto& kv : *(other.m_dictionaryData))
        {
            if (Contains(kv.first))
                InvalidArgument("Dictionary::Add: This dictionary already contains an entry with key %S that is being attempted to add from the 'other' dictionary", kv.first.c_str());

            (*this)[kv.first] = kv.second;
        }
    }
开发者ID:shadrack4292,项目名称:CNTK,代码行数:10,代码来源:Utils.cpp


示例4: throw

MSLane *
NLDetectorBuilder::getLaneChecking(const std::string &id,
                                   const std::string &detid) throw(InvalidArgument) {
    // get and check the lane
    MSLane *clane = MSLane::dictionary(id);
    if (clane==0) {
        throw InvalidArgument("The lane with the id '" + id + "' is not known (while building detector '" + detid + "').");
    }
    return clane;
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:10,代码来源:NLDetectorBuilder.cpp


示例5: InvalidArgument

std::pair<SUMOReal, SUMOReal>
GeomHelper::getNormal90D_CW(const Position& beg,
                            const Position& end,
                            SUMOReal length, SUMOReal wanted_offset) {
    if (beg == end) {
        throw InvalidArgument("same points at " + toString(beg));
    }
    return std::pair<SUMOReal, SUMOReal>
           ((beg.y() - end.y()) * wanted_offset / length, (end.x() - beg.x()) * wanted_offset / length);
}
开发者ID:smendez-hi,项目名称:SUMO-hib,代码行数:10,代码来源:GeomHelper.cpp


示例6: MSBusStop

void
NLTriggerBuilder::buildBusStop(MSNet& net, const std::string& id,
                               const std::vector<std::string>& lines,
                               MSLane* lane, SUMOReal frompos, SUMOReal topos) {
    MSBusStop* stop = new MSBusStop(id, lines, *lane, frompos, topos);
    if (!net.addBusStop(stop)) {
        delete stop;
        throw InvalidArgument("Could not build bus stop '" + id + "'; probably declared twice.");
    }
}
开发者ID:cathyyul,项目名称:sumo-0.18,代码行数:10,代码来源:NLTriggerBuilder.cpp


示例7: InvalidArgument

void
NLDetectorBuilder::createEdgeLaneMeanData(const std::string& id, SUMOTime frequency,
        SUMOTime begin, SUMOTime end, const std::string& type,
        const bool useLanes, const bool withEmpty, const bool printDefaults,
        const bool withInternal, const bool trackVehicles,
        const double maxTravelTime, const double minSamples,
        const double haltSpeed, const std::string& vTypes,
        const std::string& device) {
    if (begin < 0) {
        throw InvalidArgument("Negative begin time for meandata dump '" + id + "'.");
    }
    if (end < 0) {
        end = SUMOTime_MAX;
    }
    if (end <= begin) {
        throw InvalidArgument("End before or at begin for meandata dump '" + id + "'.");
    }
    MSMeanData* det = 0;
    if (type == "" || type == "performance" || type == "traffic") {
        det = new MSMeanData_Net(id, begin, end, useLanes, withEmpty,
                                 printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
    } else if (type == "emissions" || type == "hbefa") {
        if (type == "hbefa") {
            WRITE_WARNING("The netstate type 'hbefa' is deprecated. Please use the type 'emissions' instead.");
        }
        det = new MSMeanData_Emissions(id, begin, end, useLanes, withEmpty,
                                       printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
    } else if (type == "harmonoise") {
        det = new MSMeanData_Harmonoise(id, begin, end, useLanes, withEmpty,
                                        printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, vTypes);
    } else if (type == "amitran") {
        det = new MSMeanData_Amitran(id, begin, end, useLanes, withEmpty,
                                     printDefaults, withInternal, trackVehicles, maxTravelTime, minSamples, haltSpeed, vTypes);
    } else {
        throw InvalidArgument("Invalid type '" + type + "' for meandata dump '" + id + "'.");
    }
    if (det != 0) {
        if (frequency < 0) {
            frequency = end - begin;
        }
        MSNet::getInstance()->getDetectorControl().add(det, device, frequency, begin);
    }
}
开发者ID:fieryzig,项目名称:sumo,代码行数:43,代码来源:NLDetectorBuilder.cpp


示例8: throw

bool
Option_Float::set(const std::string &v) throw(InvalidArgument) {
    try {
        myValue = TplConvert<char>::_2SUMOReal(v.c_str());
        return markSet();
    } catch (...) {
        std::string s = "'" + v + "' is not a valid float (should be).";
        throw InvalidArgument(s);
    }
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:10,代码来源:Option.cpp


示例9: buildEdge

void
NLEdgeControlBuilder::beginEdgeParsing(
    const std::string& id, const MSEdge::EdgeBasicFunction function,
    const std::string& streetName) {
    myActiveEdge = buildEdge(id, function, streetName);
    if (MSEdge::dictionary(id) != 0) {
        throw InvalidArgument("Another edge with the id '" + id + "' exists.");
    }
    myEdges.push_back(myActiveEdge);
}
开发者ID:namnatulco,项目名称:sumo-complete,代码行数:10,代码来源:NLEdgeControlBuilder.cpp


示例10: NDArrayView

    NDArrayView::NDArrayView(const NDShape& viewShape, const SparseIndexType* colStarts, const SparseIndexType* rowIndices, const ElementType* nonZeroValues, size_t numNonZeroValues, const DeviceDescriptor& device, bool readOnly/* = false*/)
        : NDArrayView(AsDataType<ElementType>(), device, StorageFormat::SparseCSC, viewShape, false, AllocateTensorView<ElementType>(viewShape, StorageFormat::SparseCSC, device))
    {
        if ((colStarts == nullptr) || (rowIndices == nullptr) || (nonZeroValues == nullptr) || (numNonZeroValues == 0) || (numNonZeroValues > viewShape.TotalSize()))
            InvalidArgument("Invalid sparse CSC format initial data specified for NDArrayView construction");

        auto sparseMatrix = GetWritableMatrix<ElementType>(1);
        sparseMatrix->SetMatrixFromCSCFormat(colStarts, rowIndices, nonZeroValues, numNonZeroValues, sparseMatrix->GetNumRows(), sparseMatrix->GetNumCols());
        m_isReadOnly = readOnly;
    }
开发者ID:ChiPowers,项目名称:CNTK,代码行数:10,代码来源:NDArrayView.cpp


示例11: InvalidArgument

/*virtual*/ void ScatterPackedNode<ElemType>::ForwardPropNonLooping() /*override*/
{
    if (*Input(INDEXDATA)->GetMBLayout() != *Input(SOURCEDATA)->GetMBLayout())
        InvalidArgument("%ls %ls operation requires the minibatch layout of index and source data to be the same.", NodeName().c_str(), OperationName().c_str());
    Input(INDEXDATA)->MaskMissingValueColumnsTo(FrameRange(Input(INDEXDATA)->GetMBLayout()), -1); // indicates an invalid column to Gather/Scatter
    let&  index = Input(INDEXDATA)->Value();  // column indices to copy from
    let&  source = Input(SOURCEDATA)->Value(); // source data to copy
    auto& output =                    Value(); // output goes here
    output.DoScatterColumnsOf(/*beta=*/0, index, source, /*alpha=*/1);
}
开发者ID:SmartPlanetInternational,项目名称:CNTK,代码行数:10,代码来源:ReshapingNodes.cpp


示例12: InvalidArgument

void InvertibleRSAFunction::Initialize(const Integer &n, const Integer &e, const Integer &d)
{
	if (n.IsEven() || e.IsEven() | d.IsEven())
		throw InvalidArgument("InvertibleRSAFunction: input is not a valid RSA private key");

	m_n = n;
	m_e = e;
	m_d = d;

	Integer r = --(d*e);
	unsigned int s = 0;
	while (r.IsEven())
	{
		r >>= 1;
		s++;
	}

	ModularArithmetic modn(n);
	for (Integer i = 2; ; ++i)
	{
		Integer a = modn.Exponentiate(i, r);
		if (a == 1)
			continue;
		Integer b;
		unsigned int j = 0;
		while (a != n-1)
		{
			b = modn.Square(a);
			if (b == 1)
			{
				m_p = GCD(a-1, n);
				m_q = n/m_p;
				m_dp = m_d % (m_p-1);
				m_dq = m_d % (m_q-1);
				m_u = m_q.InverseMod(m_p);
				return;
			}
			if (++j == s)
				throw InvalidArgument("InvertibleRSAFunction: input is not a valid RSA private key");
			a = b;
		}
	}
}
开发者ID:BreakoutCoin,项目名称:Breakout-Chain-Client,代码行数:43,代码来源:rsa.cpp


示例13: InvalidArgument

    double Trainer::PreviousMinibatchEvaluationAverage() const
    {
        if (!m_evaluationFunction)
            InvalidArgument("Trainer::PreviousMinibatchEvaluationAverage: Cannot get evaluation criterion value when no evaluation function was specified during 'this' trainer's construction");

        if (m_prevMinibatchNumSamples == 0)
            RuntimeError("There was no preceeding call to TrainMinibatch or the minibatch was empty.");

        return m_prevMinibatchAggregateEvalCriterionValue->AsScalar<double>() / m_prevMinibatchNumSamples;
    }
开发者ID:AllanYiin,项目名称:CNTK,代码行数:10,代码来源:Trainer.cpp


示例14: switch

bool
GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
    switch (key) {
        case SUMO_ATTR_ID:
            return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrievePOI(value, false) == nullptr);
        case SUMO_ATTR_COLOR:
            return canParse<RGBColor>(value);
        case SUMO_ATTR_LANE:
            return (myNet->retrieveLane(value, false) != nullptr);
        case SUMO_ATTR_POSITION:
            if (getLaneParents().size() > 0) {
                return canParse<double>(value);
            } else {
                return canParse<Position>(value);
            }
        case SUMO_ATTR_POSITION_LAT:
            return canParse<double>(value);
        case SUMO_ATTR_GEOPOSITION: {
            return canParse<Position>(value);
        }
        case SUMO_ATTR_GEO:
            return canParse<bool>(value);
        case SUMO_ATTR_TYPE:
            return true;
        case SUMO_ATTR_LAYER:
            if (value == "default") {
                return true;
            } else {
                return canParse<double>(value);
            }
        case SUMO_ATTR_IMGFILE:
            if (value == "") {
                return true;
            } else {
                // check that image can be loaded
                return GUITexturesHelper::getTextureID(value) != -1;
            }
        case SUMO_ATTR_RELATIVEPATH:
            return canParse<bool>(value);
        case SUMO_ATTR_WIDTH:
            return canParse<double>(value) && (parse<double>(value) >= 0);
        case SUMO_ATTR_HEIGHT:
            return canParse<double>(value) && (parse<double>(value) >= 0);
        case SUMO_ATTR_ANGLE:
            return canParse<double>(value);
        case GNE_ATTR_BLOCK_MOVEMENT:
            return canParse<bool>(value);
        case GNE_ATTR_SELECTED:
            return canParse<bool>(value);
        case GNE_ATTR_GENERIC:
            return isGenericParametersValid(value);
        default:
            throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
    }
}
开发者ID:behrisch,项目名称:sumo,代码行数:55,代码来源:GNEPOI.cpp


示例15: throw

void
NLEdgeControlBuilder::beginEdgeParsing(const std::string &id,
                                       MSEdge::EdgeBasicFunction function) throw(InvalidArgument) {
    myActiveEdge = buildEdge(id);
    if (!MSEdge::dictionary(id, myActiveEdge)) {
        throw InvalidArgument("Another edge with the id '" + id + "' exists.");
    }
    myEdges.push_back(myActiveEdge);
    m_pDepartLane = (MSLane*) 0;
    m_Function = function;
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:11,代码来源:NLEdgeControlBuilder.cpp


示例16: FilterWithBufferedInput

StreamTransformationFilter::StreamTransformationFilter(StreamTransformation &c, BufferedTransformation *attachment, BlockPaddingScheme padding, bool allowAuthenticatedSymmetricCipher)
	: FilterWithBufferedInput(attachment)
	, m_cipher(c), m_padding(DEFAULT_PADDING), m_optimalBufferSize(0)
{
	assert(c.MinLastBlockSize() == 0 || c.MinLastBlockSize() > c.MandatoryBlockSize());

	if (!allowAuthenticatedSymmetricCipher && dynamic_cast<AuthenticatedSymmetricCipher *>(&c) != 0)
		throw InvalidArgument("StreamTransformationFilter: please use AuthenticatedEncryptionFilter and AuthenticatedDecryptionFilter for AuthenticatedSymmetricCipher");

	IsolatedInitialize(MakeParameters(Name::BlockPaddingScheme(), padding));
}
开发者ID:prakhs123,项目名称:cryptopp,代码行数:11,代码来源:filters.cpp


示例17: throw

void
OptionsCont::addSynonyme(const std::string &name1, const std::string &name2) throw(InvalidArgument) {
    KnownContType::iterator i1 = myValues.find(name1);
    KnownContType::iterator i2 = myValues.find(name2);
    if (i1==myValues.end()&&i2==myValues.end()) {
        throw InvalidArgument("Neither the option '" + name1 + "' nor the option '" + name2 + "' is known yet");
    }
    if (i1!=myValues.end()&&i2!=myValues.end()) {
        if ((*i1).second==(*i2).second) {
            return;
        }
        throw InvalidArgument("Both options '" + name1 + "' and '" + name2 + "' do exist and differ.");
    }
    if (i1==myValues.end()&&i2!=myValues.end()) {
        doRegister(name1, (*i2).second);
    }
    if (i1!=myValues.end()&&i2==myValues.end()) {
        doRegister(name2, (*i1).second);
    }
}
开发者ID:sagarc,项目名称:Indian_traffic_control,代码行数:20,代码来源:OptionsCont.cpp


示例18: InvalidArgument

void
GNEHierarchicalElementChilds::addLaneChild(GNELane* lane) {
    // Check if lane is valid
    if (lane == nullptr) {
        throw InvalidArgument("Trying to add an empty lane child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
    } else {
        myLaneChilds.push_back(lane);
        // update connections geometry
        myChildConnections.update();
    }
}
开发者ID:michele-segata,项目名称:plexe-sumo,代码行数:11,代码来源:GNEHierarchicalElementChilds.cpp


示例19: InvalidArgument

const UniChar & UniChar::operator=(long long unsigned i)
{
	if(!unicodePointValidity(i))
		throw InvalidArgument("The value '%' is not a valid unicode point.", i);

	priv->val = i;

	priv->dirtyUtf8 = true;

	return *this;
}
开发者ID:csjpeter,项目名称:libcsjp,代码行数:11,代码来源:csjp_unichar.cpp


示例20: InvalidArgument

boost::python::list NtTable::getColumn(int column) const
{
    if (column < 0 || column >= nColumns) {
        throw InvalidArgument("Column index must be in range [0,%d].", nColumns-1);
    }
    std::string columnName = getColumnName(column);
    boost::python::list pyList;
    epics::pvData::PVStructurePtr pvStructurePtr2 = PyPvDataUtility::getStructureField(ValueFieldKey, pvStructurePtr);
    PyPvDataUtility::scalarArrayFieldToPyList(columnName, pvStructurePtr2, pyList);
    return pyList;
}
开发者ID:pheest,项目名称:pvaPy,代码行数:11,代码来源:NtTable.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InvalidArgumentException函数代码示例发布时间:2022-05-30
下一篇:
C++ InvMod函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap