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

C++ equals函数代码示例

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

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



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

示例1: qt_options

// Called when terminal type is selected.
// This procedure should parse options on the command line.
// A list of the currently selected options should be stored in term_options[],
// in a form suitable for use with the set term command.
// term_options[] is used by the save command.  Use options_null() if no options are available." *
void qt_options()
{
	char *s = NULL;
	QString fontSettings;
	bool duplication = false;
	bool set_enhanced = false, set_font = false;
	bool set_persist = false, set_number = false;
	bool set_raise = false, set_ctrl = false;
	bool set_title = false, set_close = false;
	bool set_capjoin = false, set_size = false;
	bool set_widget = false;

#define SETCHECKDUP(x) { c_token++; if (x) duplication = true; x = true; }

	while (!END_OF_COMMAND)
	{
		FPRINTF((stderr, "processing token\n"));
		switch (lookup_table(&qt_opts[0], c_token)) {
		case QT_WIDGET:
			SETCHECKDUP(set_widget);
			if (!(s = try_to_get_string()))
				int_error(c_token, "widget: expecting string");
			if (*s)
				qt_optionWidget = QString(s);
			free(s);
			break;
		case QT_FONT:
			SETCHECKDUP(set_font);
			if (!(s = try_to_get_string()))
				int_error(c_token, "font: expecting string");
			if (*s)
			{
				fontSettings = QString(s);
				QStringList list = fontSettings.split(',');
				if ((list.size() > 0) && !list[0].isEmpty())
					qt_optionFontName = list[0];
				if ((list.size() > 1) && (list[1].toInt() > 0))
					qt_optionFontSize = list[1].toInt();
			}
			free(s);
			break;
		case QT_ENHANCED:
			SETCHECKDUP(set_enhanced);
			qt_optionEnhanced = true;
			term->flags |= TERM_ENHANCED_TEXT;
			break;
		case QT_NOENHANCED:
			SETCHECKDUP(set_enhanced);
			qt_optionEnhanced = false;
			term->flags &= ~TERM_ENHANCED_TEXT;
			break;
		case QT_SIZE:
			SETCHECKDUP(set_size);
			if (END_OF_COMMAND)
				int_error(c_token, "size requires 'width,heigth'");
			qt_optionWidth = real_expression();
			if (!equals(c_token++, ","))
				int_error(c_token, "size requires 'width,heigth'");
			qt_optionHeight = real_expression();
			if (qt_optionWidth < 1 || qt_optionHeight < 1)
				int_error(c_token, "size is out of range");
			break;
		case QT_PERSIST:
			SETCHECKDUP(set_persist);
			qt_optionPersist = true;
			break;
		case QT_NOPERSIST:
			SETCHECKDUP(set_persist);
			qt_optionPersist = false;
			break;
		case QT_RAISE:
			SETCHECKDUP(set_raise);
			qt_optionRaise = true;
			break;
		case QT_NORAISE:
			SETCHECKDUP(set_raise);
			qt_optionRaise = false;
			break;
		case QT_CTRL:
			SETCHECKDUP(set_ctrl);
			qt_optionCtrl = true;
			break;
		case QT_NOCTRL:
			SETCHECKDUP(set_ctrl);
			qt_optionCtrl = false;
			break;
		case QT_TITLE:
			SETCHECKDUP(set_title);
			if (!(s = try_to_get_string()))
				int_error(c_token, "title: expecting string");
			if (*s)
				qt_optionTitle = qt_codec->toUnicode(s);
			free(s);
			break;
		case QT_CLOSE:
//.........这里部分代码省略.........
开发者ID:zsx,项目名称:gnuplot,代码行数:101,代码来源:qt_term.cpp


示例2:

bool URI::operator != (const URI& uri) const
{
	return !equals(uri);
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:4,代码来源:URI.cpp


示例3: testFindIndexForSingleMonth

static void testFindIndexForSingleMonth() {
	const int months[] = {6};
	
	assert(equals(0, findIndex(1, months, 1)));
	assert(equals(0, findIndex(2, months, 1)));
	assert(equals(0, findIndex(3, months, 1)));
	assert(equals(0, findIndex(4, months, 1)));
	assert(equals(0, findIndex(5, months, 1)));
	assert(equals(0, findIndex(6, months, 1)));
	assert(equals(0, findIndex(7, months, 1)));
	assert(equals(0, findIndex(8, months, 1)));
	assert(equals(0, findIndex(9, months, 1)));
	assert(equals(0, findIndex(10, months, 1)));
	assert(equals(0, findIndex(11, months, 1)));
	assert(equals(0, findIndex(12, months, 1)));
}
开发者ID:bcdev,项目名称:iavisa-ct,代码行数:16,代码来源:UnitTests.cpp


示例4: m_parts

/**
 * Construct an AVT by parsing the string, and either 
 * constructing a vector of AVTParts, or simply hold 
 * on to the string if the AVT is simple.
 */
AVT::AVT(
            StylesheetConstructionContext&  constructionContext,
            const LocatorType*              locator,
            const XalanDOMChar*             name,
            const XalanDOMChar*             stringedValue,
            const PrefixResolver&           resolver) :
        m_parts(0),
        m_partsSize(0),
        m_simpleString(0),
        m_simpleStringLength(0),
        m_name(constructionContext.getPooledString(name))
{
    StringTokenizer     tokenizer(stringedValue, theTokenDelimiterCharacters, true);

    const StringTokenizer::size_type    nTokens = tokenizer.countTokens();

    if(nTokens < 2)
    {
        // Do the simple thing
        m_simpleStringLength = length(stringedValue);

        m_simpleString = constructionContext.allocateXalanDOMCharVector(stringedValue, m_simpleStringLength, false);
    }
    else
    {
        // This over-allocates, but we probably won't waste that much space.  If necessary,
        // we could tokenize twice, just counting the numbers of AVTPart instances we
        // will need the first time.
        m_parts = constructionContext.allocateAVTPartPointerVector(nTokens + 1);

        XalanDOMString  buffer(constructionContext.getMemoryManager());
        XalanDOMString  exprBuffer(constructionContext.getMemoryManager());
        XalanDOMString  t(constructionContext.getMemoryManager()); // base token
        XalanDOMString  lookahead(constructionContext.getMemoryManager()); // next token

        while(tokenizer.hasMoreTokens())
        {
            if(length(lookahead))
            {
                t = lookahead;

                clear(lookahead);
            }
            else
            {
                nextToken(constructionContext, locator, tokenizer, t);
            }

            if(length(t) == 1)
            {
                const XalanDOMChar  theChar = charAt(t, 0);

                switch(theChar)
                {
                    case(XalanUnicode::charLeftCurlyBracket):
                    {
                        // Attribute Value Template start
                        nextToken(constructionContext, locator, tokenizer, lookahead);

                        if(equals(lookahead, theLeftCurlyBracketString))
                        {
                            // Double braces mean escape to show brace
                            append(buffer, lookahead);

                            clear(lookahead);

                            break; // from switch
                        }
                        else
                        {
                            if(length(buffer) > 0)
                            {
                                assert(m_partsSize + 1 < nTokens);

                                m_parts[m_partsSize++] =
                                    constructionContext.createAVTPart(
                                        c_wstr(buffer),
                                        length(buffer));

                                clear(buffer);
                            }
                                    
                            clear(exprBuffer);

                            while(length(lookahead) > 0 && !equals(lookahead, theRightCurlyBracketString))
                            {
                                if(length(lookahead) == 1)
                                {
                                    switch(charAt(lookahead, 0))
                                    {
                                        case XalanUnicode::charApostrophe:
                                        case XalanUnicode::charQuoteMark:
                                        {
                                            // String start
                                            append(exprBuffer, lookahead);
//.........这里部分代码省略.........
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:101,代码来源:AVT.cpp


示例5: vector

bool SFVec3f::equals(float x, float y, float z) 
{
	SFVec3f vector(x, y, z);
	return equals(&vector);
}
开发者ID:lukfugl,项目名称:raytracer,代码行数:5,代码来源:SFVec3f.cpp


示例6: LOGD

ConditionResponse Condition::evaluateFeatures(Request* req){
	LOGD("[COND EVALUATE FEAT] 1 : %d",resource_attrs.size());
	map<string,vector<match_info_str*> >::iterator it;
	vector<match_info_str*> my_features = (it = resource_attrs.find(API_FEATURE))!=resource_attrs.end() 
			? it->second 
			: vector<match_info_str*>();
	
	map<string, vector<string>* > requestResource_attrs = req->getResourceAttrs();
	map<string, vector<string>* >::iterator rraIT = requestResource_attrs.find(API_FEATURE);
	vector<string>* req_features = (rraIT != requestResource_attrs.end())
			? rraIT->second
			: NULL;
	
	bool found;	
	bool anyUndetermined = resource_attrs.find(API_FEATURE)!= resource_attrs.end() 
			&& requestResource_attrs.find(API_FEATURE) == requestResource_attrs.end();	

	LOGD("Condition.evaluateFeatures - 03");
	if(combine == AND){
		LOGD("Condition.evaluateFeatures - 04");
		// find any No Match
		for(unsigned int j=0; req_features && j<my_features.size(); j++){
			found = false;
			for(unsigned int i=0; i<req_features->size(); i++){
				string mod_function = my_features[j]->mod_func;
				string s = (mod_function != "") 
							? modFunction(mod_function, req_features->at(i))
							: req_features->at(i);
				if(equals(s,my_features[j]->value, string2strcmp_mode(my_features[j]->equal_func)))
				{
					found = true;
					break;
				}
			}
			if (found == false)
				return NO_MATCH;
		}
		if (anyUndetermined)
			return NOT_DETERMINED;
		else
			return MATCH;
	}
	else if(combine == OR){
		LOGD("Condition.evaluateFeatures - 05");
		// find any Match
		for(unsigned int j=0; req_features && j<my_features.size(); j++){
			for(unsigned int i=0; i<req_features->size(); i++){
				string mod_function = my_features[j]->mod_func;
				string s = (mod_function != "") 
							? modFunction(mod_function, req_features->at(i))
							: req_features->at(i);
				if(equals(s,my_features[j]->value, string2strcmp_mode(my_features[j]->equal_func)))
					return MATCH;
			}
		}
		if (anyUndetermined)
			return NOT_DETERMINED;
		else
			return NO_MATCH;
	}
	// TODO: is that right? What should happen if policy is invalid?
	LOGD("Condition.evaluateFeatures - 09");
	return NOT_DETERMINED;
}
开发者ID:AlexWei2013,项目名称:Webinos-Platform,代码行数:64,代码来源:Condition.cpp


示例7: equals

 inline bool equals( 
     const Range1T& Input, 
     const Range2T& Test)
 {
     return equals(Input, Test, is_equal());
 }
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:6,代码来源:predicate.hpp


示例8: main

int main(int argc, char **argv)
{
  plan_tests(46);

  // test constructor
  GeoPoint p1(Angle::Degrees(fixed(345.32)), Angle::Degrees(fixed(-6.332)));
  ok1(equals(p1, -6.332, 345.32));

  // test normalize()
  p1.Normalize();
  ok1(equals(p1, -6.332, -14.68));

  // test parametric()
  GeoPoint p2(Angle::Degrees(fixed_two), Angle::Degrees(fixed_one));
  GeoPoint p3 = p1.Parametric(p2, fixed(5));
  ok1(equals(p3, -1.332, -4.68));

  // test interpolate
  GeoPoint p4 = p1.Interpolate(p3, fixed_half);
  ok1(equals(p4, -3.832, -9.68));

  GeoPoint p5 = p1.Interpolate(p3, fixed(0.25));
  ok1(equals(p5, -5.082, -12.18));

  // test *
  GeoPoint p6 = p2 * fixed(3.5);
  ok1(equals(p6, 3.5, 7));

  // test +
  p6 = p6 + p2;
  ok1(equals(p6, 4.5, 9));

  // test +=
  p6 += p2;
  ok1(equals(p6, 5.5, 11));

  // test -
  p6 = p6 - p2;
  ok1(equals(p6, 4.5, 9));

  // test sort()
  ok1(!p1.Sort(p3));
  ok1(p3.Sort(p1));
  ok1(!p1.Sort(p4));
  ok1(p4.Sort(p1));
  ok1(!p1.Sort(p5));
  ok1(p5.Sort(p1));
  ok1(!p4.Sort(p3));
  ok1(p3.Sort(p4));
  ok1(!p5.Sort(p3));
  ok1(p3.Sort(p5));
  ok1(!p5.Sort(p4));
  ok1(p4.Sort(p5));

  // test distance()
  //
  // note: distance between p1 and p4 and between p3 and p4 is not
  // the same due to linear interpolation instead of real geographic
  // intermediate point calculation
  ok1(equals(p2.Distance(p6), 869326.653160));
  ok1(equals(p6.Distance(p2), 869326.653160));
  ok1(equals(p1.Distance(p5), 309562.219016));
  ok1(equals(p1.Distance(p4), 619603.149273));
  ok1(equals(p1.Distance(p3), 1240649.267606));
  ok1(equals(p3.Distance(p4), 621053.760625));

  // test bearing()
  //
  // note: the bearings p1 -> p5, p5 -> p4 and so on are not the same due to
  // linear interpolation instead of real geographic intermediate point
  // calculation
  ok1(equals(p2.Bearing(p6), 63.272424));
  ok1(equals(p6.Bearing(p2), 243.608847));
  ok1(equals(p1.Bearing(p5), 63.449343));
  ok1(equals(p1.Bearing(p4), 63.582620));
  ok1(equals(p1.Bearing(p3), 63.784526));
  ok1(equals(p5.Bearing(p4), 63.466726));
  ok1(equals(p5.Bearing(p3), 63.646072));
  ok1(equals(p4.Bearing(p3), 63.540756));
  ok1(equals(p5.Bearing(p6), 65.982854));
  ok1(equals(p2.Bearing(p3), 250.786774));

  // test distance_bearing()
  // note: should be the same output as bearing() and distance()
  GeoVector v = p2.DistanceBearing(p6);
  ok1(equals(v.distance, 869326.653160));
  ok1(equals(v.bearing, 63.272424));

  // test intermediate_point()
  GeoPoint p7(Angle::Degrees(fixed_zero), Angle::Degrees(fixed_zero));
  GeoPoint p8 = p7.IntermediatePoint(p2, fixed(100000));
  ok1(equals(p8, 0.402274, 0.804342));
  ok1(equals(p8.Distance(p7), 100000));
  GeoPoint p9 = p7.IntermediatePoint(p2, fixed(100000000));
  ok1(equals(p9, p2));

  // test projected_distance()
  ok1(equals(p8.ProjectedDistance(p7, p2), 100000));
  ok1(equals(p4.ProjectedDistance(p1, p3), 619599.304393));
  ok1(equals((p2 * fixed_two).ProjectedDistance(p2, p6), 248567.832772));
//.........这里部分代码省略.........
开发者ID:davidswelt,项目名称:XCSoar,代码行数:101,代码来源:TestGeoPoint.cpp


示例9: LOGD

ConditionResponse Condition::evaluateEnvironment(Request* req){	
	vector<match_info_str*> my_environment_params;
	map<string, string> requestEnvironment_attrs = req->getEnvironmentAttrs();
	
	map<string,vector<match_info_str*> >::iterator it;
	match_info_str * my_roaming = (it = environment_attrs.find("roaming"))!=environment_attrs.end() 
		? it->second.at(0) 
		: NULL;
	
	vector<match_info_str *> my_bearer_vet = (it = environment_attrs.find("bearer-type"))!=environment_attrs.end() 
		? it->second 
		: vector<match_info_str*>();
	
	vector<match_info_str *> my_profile_vet = (it = environment_attrs.find("profile"))!=environment_attrs.end() 
		? it->second 
		: vector<match_info_str*>();
	
	if(combine == OR){
		LOGD("[ENVIRONMENT] dentro OR");
		if(my_roaming != NULL){
			string req_roaming = requestEnvironment_attrs["roaming"];
			LOGD("[ENVIRONMENT] req_roaming : %s",req_roaming.data());
			if(equals(req_roaming, my_roaming->value, string2strcmp_mode(my_roaming->equal_func)))
				return MATCH;
		}
		else
			LOGD("[ENVIRONMENT] my_roaming null");
		
		string req_bearer = requestEnvironment_attrs["bearer-type"];
		for(unsigned int j=0; j<my_bearer_vet.size(); j++){
			if(equals(req_bearer, my_bearer_vet[j]->value, string2strcmp_mode(my_bearer_vet[j]->equal_func)))
				return MATCH;
		}
		string req_profile = requestEnvironment_attrs["profile"];
		for(unsigned int j=0; j<my_profile_vet.size(); j++){
			if(equals(req_profile, my_profile_vet[j]->value, string2strcmp_mode(my_profile_vet[j]->equal_func)))
				return MATCH;
		}
		return NO_MATCH;
	}
	else{ //combine == AND
		// find any No Match
		LOGD("[ENVIRONMENT] dentro AND");
		if(my_roaming != NULL){
			string req_roaming = requestEnvironment_attrs["roaming"];
			LOGD("[ENVIRONMENT] confronto : %s con %s",req_roaming.data(),my_roaming->value.data());
			if(!equals(req_roaming, my_roaming->value, string2strcmp_mode(my_roaming->equal_func)))
				return NO_MATCH;
		}
		else
			LOGD("[ENVIRONMENT] my_roaming null");
		
		string req_bearer = requestEnvironment_attrs["bearer-type"];
		for(unsigned int j=0; j<my_bearer_vet.size(); j++){
			if(!equals(req_bearer, my_bearer_vet[j]->value, string2strcmp_mode(my_bearer_vet[j]->equal_func)))
				return NO_MATCH;
		}
		string req_profile = requestEnvironment_attrs["profile"];
		for(unsigned int j=0; j<my_profile_vet.size(); j++){
			if(!equals(req_profile, my_profile_vet[j]->value, string2strcmp_mode(my_profile_vet[j]->equal_func)))
				return NO_MATCH;
		}
		return MATCH;
	}
}
开发者ID:Valerio88,项目名称:webinos-policy,代码行数:65,代码来源:Condition.cpp


示例10:

bool GMBoundingSphere::operator!=(const GMBoundingSphere& sphere) const
{
    return !equals(sphere, GMMath::kDoubleEqThreshold);
}
开发者ID:nanathia,项目名称:tenninoboru_ketui,代码行数:4,代码来源:GMBoundingSphere.cpp


示例11: mprinterr

/** Set up variable with value. In this case allow any amount of whitespace,
  * so re-tokenize the original argument line (minus the command).
  */
CpptrajState::RetType
  Control_Set::SetupControl(CpptrajState& State, ArgList& argIn, Varray& CurrentVars)
{
  ArgList remaining = argIn.RemainingArgs();
  size_t pos0 = remaining.ArgLineStr().find_first_of("=");
  if (pos0 == std::string::npos) {
    mprinterr("Error: Expected <var>=<value>\n");
    return CpptrajState::ERR;
  }
  size_t pos1 = pos0;
  bool append = false;
  if (pos0 > 0 && remaining.ArgLineStr()[pos0-1] == '+') {
    pos0--;
    append = true;
  }
  std::string variable = NoWhitespace( remaining.ArgLineStr().substr(0, pos0) );
  if (variable.empty()) {
    mprinterr("Error: No variable name.\n");
    return CpptrajState::ERR;
  }
  ArgList equals( NoLeadingWhitespace(remaining.ArgLineStr().substr(pos1+1)) );
  std::string value;
  if (equals.Contains("inmask")) {
    AtomMask mask( equals.GetStringKey("inmask") );
    Topology* top = State.DSL().GetTopByIndex( equals );
    if (top == 0) return CpptrajState::ERR;
    if (top->SetupIntegerMask( mask )) return CpptrajState::ERR;
    if (equals.hasKey("atoms"))
      value = integerToString( mask.Nselected() );
    else if (equals.hasKey("residues")) {
      int curRes = -1;
      int nres = 0;
      for (AtomMask::const_iterator at = mask.begin(); at != mask.end(); ++at) {
        int res = (*top)[*at].ResNum();
        if (res != curRes) {
          nres++;
          curRes = res;
        }
      }
      value = integerToString( nres );
    } else if (equals.hasKey("molecules")) {
      int curMol = -1;
      int nmol = 0;
      for (AtomMask::const_iterator at = mask.begin(); at != mask.end(); ++at) {
        int mol = (*top)[*at].MolNum();
        if (mol != curMol) {
          nmol++;
          curMol = mol;
        }
      }
      value = integerToString( nmol );
    } else {
      mprinterr("Error: Expected 'atoms', 'residues', or 'molecules'.\n");
      return CpptrajState::ERR;
    }
  } else if (equals.hasKey("trajinframes")) {
    value = integerToString(State.InputTrajList().MaxFrames());
  } else
    value = equals.ArgLineStr();
  if (append)
    CurrentVars.AppendVariable( "$" + variable, value );
  else
    CurrentVars.UpdateVariable( "$" + variable, value );
  mprintf("\tVariable '%s' set to '%s'\n", variable.c_str(), value.c_str());
  for (int iarg = 0; iarg < argIn.Nargs(); iarg++)
    argIn.MarkArg( iarg );
  return CpptrajState::OK;
}
开发者ID:Amber-MD,项目名称:cpptraj,代码行数:71,代码来源:Control.cpp


示例12: main

int main(int argc, char** argv){
	//srand will force the random numbers to be always the same, so we can verify that our code works
	//normally we would want them to be different.
	srand(100);
	struct DataSet* setA;
	setA = allocDataSet();

	struct DataSet* setB;
	setB = allocDataSet();


	int i = 0;
	for(i = 0; i < 30; ++i){
		Byte element = rand() % 20;
		appendDataSet(setA, element);
		Byte event = rand() % 100;
		if(event < 30){
			//30% of chance of repeating the same number
			appendDataSet(setB, element);
		}
		else if(event < 65){
			//65% of chance of adding a different element
			//event should be a number between 0 and 99
			//make it between 0 and 49 included
			appendDataSet(setB, event % 50);
		}
		else{
			//C requires an else, even if it is empty,
			//this else does nothing, so setB could be smaller than setA
		}
	}
	//Data has been initialized, now lets test the other methods
	//Print
	printf("SET A IS:\n");
	printDataSet(setA);
	printf("SET B IS:\n");
	printDataSet(setB);

	//Union (notice that union is another C keyword),
	//actually what is does is like a struct,
	//but guarantees the block will be put right after the other
	//in this class you dont need to know it, but once more, if you want to learn
	struct DataSet* unionSet;
	unionSet = unionDataSet(setA, setB);

	printf("A UNION B:\n");
	printDataSet(unionSet);

	//Intersection
	struct DataSet* intersectionSet;
	intersectionSet = intersectionDataSet(setA, setB);

	printf("A INTERSECTION B:\n");
	printDataSet(intersectionSet);

	//Set difference
	struct DataSet* diffSet;
	diffSet = diffDataSet(setA, setB);

	printf("A DIFF B:\n");
	printDataSet(diffSet);

	//Subset Test
	struct DataSet* subsetTest;
	subsetTest = subset(unionSet, 3, 7);

	printf("ORIGINAL SET:\n");
	printDataSet(unionSet);

	printf("SUBSET:\n");
	printDataSet(subsetTest);
	printf("subsetTest %s a subset of unionSet\n", isSubset(subsetTest, unionSet) ? "IS" : "IS NOT");
	printf("unionSet %s a subset of subsetSet\n", isSubset(unionSet, subsetTest) ? "IS" : "IS NOT");

	struct DataSet* emptySet = allocDataSet();
	//no data added so it should be the nullSet
	printf("THE EMPTY SET LOOKS LIKE:\n");
	printDataSet(emptySet);
	printf("emptySet %s equal to the NULL set\n", isNull(emptySet) ? "IS" : "IS NOT");

	struct DataSet* reverseSet = allocDataSet();
	for(i = unionSet->length - 1; i >= 0; --i){
		appendDataSet(reverseSet, unionSet->data[i]);
	}
	printf("reverseSet %s equal unionSet\n", equals(unionSet, reverseSet) ? "IS" : "IS NOT");
	printf("reverseSet %s %u\n", contains(reverseSet, unionSet->data[0]) ? "CONTAINSS" : "DOES NOT CONTAIN", unionSet->data[0]);
	printDataSet(reverseSet);

	//Statistics:
	printf("ORGINAL SET FOR STATISTICS:\n");
	printDataSet(unionSet);
	printf("Min value %u\n", unionSet->min);
	printf("Max value %u\n", unionSet->max);
	printf("Avg value %f\n", AverageDataSet(unionSet));
	printf("Range value %u\n", RangeDataSet(unionSet));

	//Release the DataSets resources after finish their usage.
	releaseDataSet(setA);
	releaseDataSet(setB);

//.........这里部分代码省略.........
开发者ID:JamesBedont,项目名称:computerScience1,代码行数:101,代码来源:main_update.c


示例13:

 bool operator !=(const_pointer value) const {
   return !equals(value);
 }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:3,代码来源:StaticString.hpp


示例14: multiplot_start

void
multiplot_start()
{
    TBOOLEAN set_spacing = FALSE;
    TBOOLEAN set_margins = FALSE;

    c_token++;

    /* Only a few options are possible if we are already in multiplot mode */
    /* So far we have "next".  Maybe also "previous", "clear"? */
    if (multiplot) {
	if (equals(c_token, "next")) {
	    c_token++;
	    if (!mp_layout.auto_layout)
		int_error(c_token, "only valid inside an auto-layout multiplot");
	    multiplot_next();
	    return;
	} else if (almost_equals(c_token, "prev$ious")) {
	    c_token++;
	    if (!mp_layout.auto_layout)
		int_error(c_token, "only valid inside an auto-layout multiplot");
	    multiplot_previous();
	    return;
	} else {
	    term_end_multiplot();
	}
    }

    /* FIXME: more options should be reset/initialized each time */
    mp_layout.auto_layout = FALSE;
    mp_layout.auto_layout_margins = FALSE;
    mp_layout.current_panel = 0;
    mp_layout.title.noenhanced = FALSE;
    free(mp_layout.title.text);
    mp_layout.title.text = NULL;
    free(mp_layout.title.font);
    mp_layout.title.font = NULL;
    mp_layout.title.boxed = 0;

    /* Parse options */
    while (!END_OF_COMMAND) {

	if (almost_equals(c_token, "ti$tle")) {
	    c_token++;
	    mp_layout.title.text = try_to_get_string();
 	    continue;
       }

       if (equals(c_token, "font")) {
	    c_token++;
	    mp_layout.title.font = try_to_get_string();
	    continue;
	}

        if (almost_equals(c_token,"enh$anced")) {
            mp_layout.title.noenhanced = FALSE;
            c_token++;
            continue;
        }

        if (almost_equals(c_token,"noenh$anced")) {
            mp_layout.title.noenhanced = TRUE;
            c_token++;
            continue;
        }
        
	if (equals(c_token,"boxed")) {
            mp_layout.title.boxed = 1;
            c_token++;
            continue;
        }

	if (almost_equals(c_token, "lay$out")) {
	    if (mp_layout.auto_layout)
		int_error(c_token, "too many layout commands");
	    else
		mp_layout.auto_layout = TRUE;

	    c_token++;
	    if (END_OF_COMMAND) {
		int_error(c_token,"expecting '<num_cols>,<num_rows>'");
	    }

	    /* read row,col */
	    mp_layout.num_rows = int_expression();
	    if (END_OF_COMMAND || !equals(c_token,",") )
		int_error(c_token, "expecting ', <num_cols>'");

	    c_token++;
	    if (END_OF_COMMAND)
		int_error(c_token, "expecting <num_cols>");
	    mp_layout.num_cols = int_expression();

	    /* remember current values of the plot size and the margins */
	    mp_layout.prev_xsize = xsize;
	    mp_layout.prev_ysize = ysize;
	    mp_layout.prev_xoffset = xoffset;
	    mp_layout.prev_yoffset = yoffset;
	    mp_layout.prev_lmargin = lmargin;
	    mp_layout.prev_rmargin = rmargin;
//.........这里部分代码省略.........
开发者ID:deniramires,项目名称:gnuplot,代码行数:101,代码来源:multiplot.c


示例15: main

int main(void) {
    std::unordered_map<int, std::unordered_map<int, cv::Mat1f>> map;

    map[2][1] = cv::Mat1f::ones(1, 1);
    map[3][1] = cv::Mat1f::ones(1, 1);
    map[3][1] *= 2;
    map[4][3] = cv::Mat1f::ones(1, 1);
    map[5][3] *= 4;
    map[7][4] = cv::Mat1f::ones(1, 1);
    map[3][7] = cv::Mat1f::ones(1, 1);

    std::cout << "before:" << std::endl;

    for(int r = 0; r < 8; ++r) {
        for(int c = 0; c < 8; ++c) {
            if(map[r][c].empty()) {
                std::cout << cv::Mat1f::zeros(1, 1);
            } else {
                std::cout << map[r][c];
            }
        }
        std::cout << std::endl;
    }

    if(map[0][0].empty()) {
        map[0][0] = cv::Mat1f::zeros(1, 1);
    }

    cv::Mat_<cv::Mat1f*> mapping(8, 8);
    mapping.at<cv::Mat1f*>(0, 0) = &map[0][0];

    for(int r = 1; r < 8; ++r) {
        cv::Mat1f lastElement = *(mapping.at<cv::Mat1f*>(r - 1, 0));
        if(!map[r][0].empty()) {
            map[r][0] += lastElement;
            mapping.at<cv::Mat1f*>(r, 0) = &map[r][0];
        } else {
            mapping.at<cv::Mat1f*>(r, 0) = mapping.at<cv::Mat1f*>(r - 1, 0);
        }
    }

    for(int c = 1; c < 8; ++c) {
        cv::Mat1f lastElement = *(mapping.at<cv::Mat1f*>(0, c - 1));
        if(!map[0][c].empty()) {
            map[0][c] += lastElement;
            mapping.at<cv::Mat1f*>(0, c) = &map[0][c];
        } else {
            mapping.at<cv::Mat1f*>(0, c) = mapping.at<cv::Mat1f*>(0, c - 1);
        }
    }

    for(int r = 1; r < 8; ++r) {
        for(int c = 1; c < 8; ++c) {
            cv::Mat1f lastLeft = *(mapping.at<cv::Mat1f*>(r, c - 1));
            cv::Mat1f lastTop = *(mapping.at<cv::Mat1f*>(r - 1, c));
            cv::Mat1f lastTopLeft = *(mapping.at<cv::Mat1f*>(r - 1, c - 1));

            cv::Mat1f tmp;

            if(!map[r][c].empty()) {
                tmp = map[r][c] + lastLeft + lastTop - lastTopLeft;
            } else {
                tmp = lastLeft + lastTop - lastTopLeft;
            }

            cv::Scalar s = cv::sum(tmp - lastLeft);

            if(equals(tmp, lastLeft)) {
                mapping.at<cv::Mat1f*>(r, c) = mapping.at<cv::Mat1f*>(r, c - 1);
            } else {
                if(equals(tmp, lastTop)) {
                    std::cout << "Value changed, top entry equal" << std::endl;
                    mapping.at<cv::Mat1f*>(r, c) = mapping.at<cv::Mat1f*>(r - 1, c);
                } else {
                    std::cout << "Value changed, new value" << std::endl;
                    map[r][c] = tmp;
                    mapping.at<cv::Mat1f*>(r, c) = &map[r][c];
                }
            }
        }
    }

    std::cout << "after:" << std::endl;

    for(int r = 0; r < 8; ++r) {
        for(int c = 0; c < 8; ++c) {
            if(map[r][c].empty()) {
                std::cout << cv::Mat1f::zeros(1, 1);
            } else {
                std::cout << map[r][c];
            }
        }
        std::cout << std::endl;
    }

    std::cout << "mapping:" << std::endl;
    for(int y = 0; y < mapping.rows; ++y) {
        for(int x = 0; x < mapping.cols; ++x) {
            std::cout << "(" << mapping.at<cv::Mat1f*>(y, x) << "," << mapping.at<cv::Mat1f*>(y, x) << ")";
        }
//.........这里部分代码省略.........
开发者ID:s1hofmann,项目名称:useful_things,代码行数:101,代码来源:sparse_integral_image.cpp


示例16: kitConfig

/**
 * Callback function for reading of config.txt
 */
static void kitConfig(char* pName, const void* pValue, DWORD a)
{
    kattr_data* kd = (kattr_data*)a;
    if (!kd) return;

    switch (kd->attr)
    {
        case ATT_MODEL:
            kd->kit.model = *(DWORD*)pValue;
            kd->kit.attDefined |= MODEL;
            GDB_DEBUG(wlog,(slog,L"model = %d\n",kd->kit.model));
            break;

        case ATT_COLLAR:
            kd->kit.collar = *(DWORD*)pValue;
            kd->kit.attDefined |= COLLAR;
            GDB_DEBUG(wlog,(slog,L"collar = %d\n",kd->kit.collar));
            break;

        case ATT_SHIRT_NUMBER_LOCATION:
            if (equals(pValue, L"off"))
                kd->kit.shirtNumberLocation = 0;
            else if (equals(pValue, L"center"))
                kd->kit.shirtNumberLocation = 1;
            else if (equals(pValue, L"topright"))
                kd->kit.shirtNumberLocation = 2;
            kd->kit.attDefined |= SHIRT_NUMBER_LOCATION;
            GDB_DEBUG(wlog,(slog,L"shirtNumberLocation = %d\n",kd->kit.shirtNumberLocation));
            break;

        case ATT_SHORTS_NUMBER_LOCATION:
            if (equals(pValue,L"off"))
                kd->kit.shortsNumberLocation = 0;
            else if (equals(pValue,L"left"))
                kd->kit.shortsNumberLocation = 1;
            else if (equals(pValue,L"right"))
                kd->kit.shortsNumberLocation = 2;
            kd->kit.attDefined |= SHORTS_NUMBER_LOCATION;
            GDB_DEBUG(wlog,(slog,L"shortsNumberLocation = %d\n",kd->kit.shortsNumberLocation));
            break;

        case ATT_NAME_LOCATION:
            if (equals(pValue, L"off"))
                kd->kit.nameLocation = 0;
            else if (equals(pValue, L"top"))
                kd->kit.nameLocation = 1;
            else if (equals(pValue, L"bottom"))
                kd->kit.nameLocation = 2;
            kd->kit.attDefined |= NAME_LOCATION;
            GDB_DEBUG(wlog,(slog,L"nameLocation = %d\n",kd->kit.nameLocation));
            break;

        case ATT_NAME_SHAPE:
            if (equals(pValue, L"type1"))
                kd->kit.nameShape = 0;
            else if (equals(pValue, L"type2"))
                kd->kit.nameShape = 1;
            else if (equals(pValue, L"type3"))
                kd->kit.nameShape = 2;
            else if (equals(pValue, L"type4"))
                kd->kit.nameShape = 3;
            kd->kit.attDefined |= NAME_SHAPE;
            GDB_DEBUG(wlog,(slog,L"nameShape = %d\n",kd->kit.nameShape));
            break;

        case ATT_LOGO_LOCATION:
            if (equals(pValue, L"off"))
                kd->kit.logoLocation = 0;
            else if (equals(pValue, L"top"))
                kd->kit.logoLocation = 1;
            else if (equals(pValue, L"bottom"))
                kd->kit.logoLocation = 2;
            kd->kit.attDefined |= LOGO_LOCATION;
            GDB_DEBUG(wlog,(slog,L"logoLocation = %d\n",kd->kit.logoLocation));
            break;

        case ATT_MAIN_COLOR:
            if (ParseColor((wchar_t*)pValue, &kd->kit.mainColor))
                kd->kit.attDefined |= MAIN_COLOR;
            GDB_DEBUG(wlog,(slog,L"mainColor = %02x%02x%02x%02x\n",
                        kd->kit.mainColor.r,
                        kd->kit.mainColor.g,
                        kd->kit.mainColor.b,
                        kd->kit.mainColor.a
                        ));
            break;

        case ATT_SHORTS_COLOR:
            if (ParseColor((wchar_t*)pValue, &kd->kit.shortsFirstColor))
                kd->kit.attDefined |= SHORTS_MAIN_COLOR;
            GDB_DEBUG(wlog,(slog,L"shortsFirstColor = %02x%02x%02x%02x\n",
                        kd->kit.shortsFirstColor.r,
                        kd->kit.shortsFirstColor.g,
                        kd->kit.shortsFirstColor.b,
                        kd->kit.shortsFirstColor.a
                        ));
            break;
//.........这里部分代码省略.........
开发者ID:kitserver,项目名称:kitserver8,代码行数:101,代码来源:gdb.cpp


示例17: gl_carray_indexof_from_to

static size_t
gl_carray_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
                           const void *elt)
{
  size_t count = list->count;

  if (!(start_index <= end_index && end_index <= count))
    /* Invalid arguments.  */
    abort ();

  if (start_index < end_index)
    {
      gl_listelement_equals_fn equals = list->base.equals_fn;
      size_t allocated = list->allocated;
      size_t i_end;

      i_end = list->offset + end_index;
      if (i_end >= allocated)
        i_end -= allocated;

      if (equals != NULL)
        {
          size_t i;

          i = list->offset + start_index;
          if (i >= allocated) /* can only happen if start_index > 0 */
            i -= allocated;

          for (;;)
            {
              if (equals (elt, list->elements[i]))
                return (i >= list->offset ? i : i + allocated) - list->offset;
              i++;
              if (i == allocated)
                i = 0;
              if (i == i_end)
                break;
            }
        }
      else
        {
          size_t i;

          i = list->offset + start_index;
          if (i >= allocated) /* can only happen if start_index > 0 */
            i -= allocated;

          for (;;)
            {
              if (elt == list->elements[i])
                return (i >= list->offset ? i : i + allocated) - list->offset;
              i++;
              if (i == allocated)
                i = 0;
              if (i == i_end)
                break;
            }
        }
    }
  return (size_t)(-1);
}
开发者ID:cooljeanius,项目名称:wget,代码行数:61,代码来源:gl_carray_list.c


示例18:

bool String::operator !=(const String &x) const {
	return !equals(x);
}
开发者ID:jvprat,项目名称:residual,代码行数:3,代码来源:str.cpp


示例19: parsedURI

bool URI::operator != (const std::string& uri) const
{
	URI parsedURI(uri);
	return !equals(parsedURI);
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:5,代码来源:URI.cpp


示例20: assert

bool String::operator !=(const char *x) const {
	assert(x != 0);
	return !equals(x);
}
开发者ID:jvprat,项目名称:residual,代码行数:4,代码来源:str.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ er函数代码示例发布时间:2022-05-30
下一篇:
C++ equalobj函数代码示例发布时间: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