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


C++ VALUE函数代码示例

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


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

示例1: qb_validate_operands_transform

static int32_t qb_validate_operands_transform(qb_compiler_context *cxt, qb_op_factory *f, qb_primitive_type expr_type, uint32_t flags, qb_operand *operands, uint32_t operand_count, qb_result_destination *result_destination) {
	qb_operand *matrix1 = &operands[0], *matrix2 = &operands[1];

	if(matrix1->address->dimension_count < 2) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 0, "matrix");
		return FALSE;
	}
	if(matrix2->address->dimension_count < 1) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 1, "vector");
		return FALSE;
	}

	if(HAS_CONSTANT_DIMENSION(matrix1->address, -2) && HAS_CONSTANT_DIMENSION(matrix1->address, -1) && HAS_CONSTANT_DIMENSION(matrix2->address, -1)) {
		qb_matrix_order order = qb_get_matrix_order(cxt, f);
		qb_address *m1_col_address = qb_obtain_matrix_column_address(cxt, matrix1->address, order);
		qb_address *m1_row_address = qb_obtain_matrix_row_address(cxt, matrix1->address, order);
		qb_address *m2_row_address = DIMENSION_ADDRESS(matrix2->address, -1);
		uint32_t m1_col_count = VALUE(U32, m1_col_address);
		uint32_t m1_row_count = VALUE(U32, m1_row_address);
		uint32_t m2_row_count = VALUE(U32, m2_row_address);

		if(!(m2_row_count >= 2 && m2_row_count <= 4 && m1_col_count == m2_row_count + 1 && m1_row_count == m2_row_count)) {
			qb_report_invalid_transform_exception(cxt->line_id, m1_col_count, m1_row_count, m2_row_count);
			return FALSE;
		}
	} else {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 0, "matrix with fixed dimensions");
	}
	return TRUE;
}
开发者ID:3CTO,项目名称:qb,代码行数:30,代码来源:qb_op_factory_operand_validation.c

示例2: qb_validate_operands_array_pad

static int32_t qb_validate_operands_array_pad(qb_compiler_context *cxt, qb_op_factory *f, qb_primitive_type expr_type, uint32_t flags, qb_operand *operands, uint32_t operand_count, qb_result_destination *result_destination) {
	qb_operand *input = &operands[0], *size = &operands[1], *value = &operands[2];

	if(IS_SCALAR(input->address)) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 0, "array");
		return FALSE;
	}
	if(!IS_SCALAR(size->address)) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 0, "scalar");
		return FALSE;
	}

	if(input->address->dimension_count > 1) {
		qb_address *element_size_address = input->address->array_size_addresses[1];
		qb_address *value_size_address = value->address->array_size_address;
		if(IS_IMMUTABLE(element_size_address) && IS_IMMUTABLE(value_size_address)) {
			uint32_t element_size = VALUE(U32, element_size_address);
			uint32_t value_size = VALUE(U32, value_size_address);
			if(element_size != value_size) {
				qb_report_unmet_intrinsic_condition_exception(cxt->line_id, cxt->intrinsic_function, "the third parameter to have the same size as the elements in the input array");
				return FALSE;
			}
		} else {
			qb_operand guard_operands[2] = { { QB_OPERAND_ADDRESS, { value_size_address } }, { QB_OPERAND_ADDRESS, { element_size_address } } };
			qb_operand guard_result = { QB_OPERAND_EMPTY, { NULL } };
			qb_produce_op(cxt, &factory_guard_array_size_exact, guard_operands, 2, &guard_result, NULL, 0, NULL);
		}
	} else {
		if(!IS_SCALAR(value->address)) {
			qb_report_unmet_intrinsic_condition_exception(cxt->line_id, cxt->intrinsic_function, "the third parameter to be a scalar when the input array is not multidimensional");
			return FALSE;
		}
	}
	return TRUE;
}
开发者ID:3CTO,项目名称:qb,代码行数:35,代码来源:qb_op_factory_operand_validation.c

示例3: VALUE

int SimpleHinter::crossCount( const RecoResult & R, int x, int y, int W, int H )
{
    int value = VALUE( x, y );

    // go top & bottom
    int vCount = 1;
    int step = y - 1;
    while ( step >= 0 && VALUE( x, step ) == value ) {
        vCount++;
        step--;
    }
    step = y + 1;
    while ( step < H && VALUE( x, step ) == value ) {
        vCount++;
        step++;
    }

    // go right & left
    int hCount = 1;
    step = x + 1;
    while ( step < W && VALUE( step, y ) == value ) {
        hCount++;
        step++;
    }
    step = x - 1;
    while ( step >= 0 && VALUE( step, y ) == value ) {
        hCount++;
        step--;
    }

    // return the longest line
    return qMax( vCount, hCount );
}
开发者ID:rodrigohl19,项目名称:biocheat,代码行数:33,代码来源:SimpleHinter.cpp

示例4: DefMarking

DefMarking(struct net_object *netobj, struct net_object *unf_netobj)
{
  struct place_object *place; 
  list curr = NULL;
  markPTR m;
  multisetPTR p_MS;
  int i;
  char *tag;
  
  while ( (curr = list_iterator(gListMarking, curr)) != NULL ){
    m = DATA(curr);
    if(m->type==0){
      evalMarking(m, &p_MS);
      for(i=0; i<CARD(p_MS) ; i++)          
        if( VALUE(SET(p_MS)[i])>0 ){        
          tag = NewStringCat(m->place->tag, STR_INDEX(SET(p_MS)[i]));      
          for(place = unf_netobj->places; place!=NULL && (strcmp(place->tag, tag)!=0) ; place = place->next);
          if(place == NULL)
            Error(UNKN_PLACE_ERR, "DefMarking", tag);
          else 
            place->m0 = VALUE(SET(p_MS)[i]);
        }
    }
    else{
      tag = NewStringCat(m->place->tag, "_");      
      for(place = unf_netobj->places; place!=NULL && (strcmp(place->tag, tag)!=0) ; place = place->next);
      if(place == NULL)
        Error(UNKN_PLACE_ERR, "DefMarking", tag);
      else 
        place->mpar = m->mrk;
    }
  }


}
开发者ID:cosyverif,项目名称:deb-greatspn,代码行数:35,代码来源:unfold.c

示例5: TEST_F

// TODO : Fix it. Transaction abort clears transaction log buffer resulting in resetting transaction ID.
TEST_F(NLDBTest, transaction_abort) {

	ASSERT_TRUE( nldb_tx_begin(tx) == 0 );

	ASSERT_TRUE( nldb_table_put( tx, vol_table, KEY(rec1), VALUE(rec1) ) == 0 );

	ASSERT_TRUE( nldb_tx_commit(tx) == 0 );

	ASSERT_TRUE( nldb_tx_begin(tx) == 0 );

	// Put the value with rec2 temporarily.
	ASSERT_TRUE( nldb_table_put( tx, vol_table, KEY(rec1), VALUE(rec2) ) == 0 );

	// Check before abort
	{
		nldb_value_t v;
		ASSERT_TRUE( nldb_table_get( tx, vol_table, KEY(rec1), & v, NULL /*nldb_order_t*/) == 0 );
		// The value should be rec2
		ASSERT_TRUE( IS_VALUE_EQUAL(rec2, v));
	}
	ASSERT_TRUE( nldb_tx_abort(tx) == 0 );

	// Check value after abort
	{
		nldb_value_t v;
		ASSERT_TRUE( nldb_table_get( tx, vol_table, KEY(rec1), & v, NULL /*nldb_order_t*/ ) == 0 );
		// The value should be rec1 after aborting the transaction.
		ASSERT_TRUE( IS_VALUE_EQUAL(rec1, v));
	}

}
开发者ID:Nanolat,项目名称:nldb,代码行数:32,代码来源:nldb_test.cpp

示例6: s3b_hash_remove

void
s3b_hash_remove(struct s3b_hash *hash, s3b_block_t key)
{
    u_int i;
    u_int j;
    u_int k;

    /* Find entry */
    for (i = FIRST(hash, key); 1; i = NEXT(hash, i)) {
        void *const value = VALUE(hash, i);

        if (EMPTY(value))               /* no such entry */
            return;
        if (KEY(value) == key)          /* entry found */
            break;
    }

    /* Repair subsequent entries as necessary */
    for (j = NEXT(hash, i); 1; j = NEXT(hash, j)) {
        void *const value = VALUE(hash, j);

        if (value == NULL)
            break;
        k = FIRST(hash, KEY(value));
        if (j > i ? (k <= i || k > j) : (k <= i && k > j)) {
            VALUE(hash, i) = value;
            i = j;
        }
    }

    /* Remove entry */
    assert(VALUE(hash, i) != NULL);
    VALUE(hash, i) = NULL;
    hash->numkeys--;
}
开发者ID:ethus3h,项目名称:s3backer,代码行数:35,代码来源:hash.c

示例7: qb_validate_operands_vm_mult

static int32_t qb_validate_operands_vm_mult(qb_compiler_context *cxt, qb_op_factory *f, qb_primitive_type expr_type, uint32_t flags, qb_operand *operands, uint32_t operand_count, qb_result_destination *result_destination) {
	qb_operand *matrix1 = &operands[0], *matrix2 = &operands[1];
	qb_matrix_order order = qb_get_matrix_order(cxt, f);
	qb_address *m1_col_address = DIMENSION_ADDRESS(matrix1->address, -1);
	qb_address *m2_row_address = qb_obtain_matrix_row_address(cxt, matrix2->address, order);

	if(matrix1->address->dimension_count < 1) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 0, "vector");
		return FALSE;
	}
	if(matrix2->address->dimension_count < 2) {
		qb_report_unexpected_intrinsic_argument_exception(cxt->line_id, cxt->intrinsic_function, 1, "matrix");
		return FALSE;
	}

	if(m1_col_address != m2_row_address) {
		if(IS_IMMUTABLE(m1_col_address) && IS_IMMUTABLE(m2_row_address)) {
			uint32_t m1_col_count = VALUE(U32, m1_col_address);
			uint32_t m2_row_count = VALUE(U32, m2_row_address);

			if(!cxt->matrix_padding) {
				if(m1_col_count != m2_row_count) {
					qb_report_invalid_matrix_multiplication_exception(cxt->line_id, m1_col_count, m2_row_count, 2);
					return FALSE;
				}
			}
		} else {
			qb_operand operands[2] = { { QB_OPERAND_ADDRESS, { m1_col_address } }, { QB_OPERAND_ADDRESS, { m2_row_address } } };
			qb_produce_op(cxt, &factory_validate_vm_mult, operands, 2, NULL, NULL, 0, NULL);
		}
	}
	return TRUE;
}
开发者ID:3CTO,项目名称:qb,代码行数:33,代码来源:qb_op_factory_operand_validation.c

示例8: value_finalize

static void
value_finalize (GObject *gobject)
{
	g_free(VALUE (gobject)->dictkeyword);
	g_free(VALUE (gobject)->value);

	//G_OBJECT_CLASS (gobject)->finalize (gobject);
}
开发者ID:gebrproject,项目名称:gebr.backup,代码行数:8,代码来源:value.c

示例9: ct_swap_data

static void
ct_swap_data(node_t *node1, node_t *node2)
{
	PyObject *tmp;
	tmp = KEY(node1);
	KEY(node1) = KEY(node2);
	KEY(node2) = tmp;
	tmp = VALUE(node1);
	VALUE(node1) = VALUE(node2);
	VALUE(node2) = tmp;
}
开发者ID:xiaonanln,项目名称:pyGrape,代码行数:11,代码来源:ctrees.c

示例10: op_errormessage

P op_errormessage(void)
{
  LBIG e, pid, port;
  P nb, tnb; 
  B *m, *s;

  if (o_6 < FLOORopds) goto baderror;
  if (CLASS(o_6) != NUM) goto baderror;
  if (! VALUE(o_6, &pid)) goto baderror;
  if (TAG(o_5) != (ARRAY | BYTETYPE)) goto baderror;
  if (CLASS(o_4) != NUM) goto baderror;
  if (! VALUE(o_4, &port)) goto baderror;
  if (TAG(o_3) != (ARRAY | BYTETYPE)) goto baderror;
  if (CLASS(o_2) != NUM) goto baderror;
  if (!VALUE(o_2, &e)) goto baderror;
  if (TAG(o_1) != (ARRAY | BYTETYPE)) goto baderror;

  s = (B *)VALUE_BASE(o_1); 
  tnb = ARRAY_SIZE(o_1);
  nb = dm_snprintf((char*) s, tnb, "On %*s port %llu, pid %llu: ",
		   (int) ARRAY_SIZE(o_5),
		   (char*) VALUE_BASE(o_5),
                   (unsigned long long) port,
		   (unsigned long long) pid);
  s += nb;
  tnb -= nb;

  if ((P)e < 0) /*Clib error */
    nb = dm_snprintf((char*) s, tnb, "errno: %s",
		     (char*) strerror(-(int)e));
  else { /* one of our error codes: decode */
    m = geterror((P) e);
    nb = strlen((char*) m);
    if (nb > tnb) nb = tnb;
    moveB(m, s, nb);
  }
  s += nb;
  tnb -= nb;

  nb = dm_snprintf((char*)s, tnb, " in %*s\n",
		   (int) ARRAY_SIZE(o_3),
		   (char*) VALUE_BASE(o_3));

  ARRAY_SIZE(o_1) = (P)(s + nb) - VALUE_BASE(o_1);
  moveframe(o_1,o_6);
  FREEopds = o_5;
  return OK;

 baderror:
  printf("**Error with corrupted error info on operand stack!\n");
  return op_halt();
}
开发者ID:apeyser,项目名称:Deuterostome,代码行数:52,代码来源:dm-dnode.c

示例11: _omFindInSortedList

void* _omFindInSortedList(void* list, int next, int long_field,
                          unsigned long what)
{
  while (list != NULL)
  {
    if (VALUE(list, long_field) >= what)
    {
      if (VALUE(list, long_field) == what) return list;
      return NULL;
    }
    ITER(list);
  }
  return NULL;
}
开发者ID:Macaulay2,项目名称:Singular,代码行数:14,代码来源:omList.c

示例12: prod

/* Return the product of two expressions */
static exp_t *
prod(exp_t *a1, exp_t *a2)
{
        exp_t *res;

        CHKNUM(a1, *);
        CHKNUM(a2, *);

        if (isfloat(a1) || isfloat(a2))
                res = nfloat(VALUE(a1) * VALUE(a2));
        else
                res = nrat(NUMER(a1) * NUMER(a2), DENOM(a1) * DENOM(a2));
        return res;
}
开发者ID:l0stman,项目名称:loot,代码行数:15,代码来源:prim.c

示例13: dl_print

void dl_print(List list) {
    assert_argument_not_null(list);
    dl_assert_element_size(list);
    ListNode *node = list->first;
    printf("[");
    if (node != NULL) {
        printf("%g", VALUE(node));
        node = node->next;
    }
    for (; node != NULL; node = node->next) {
        printf(", %g", VALUE(node));
    }
    printf("]");
}
开发者ID:qwertzuiop961,项目名称:prgraas,代码行数:14,代码来源:double_list.c

示例14: AddDebugAlloc

void _stdcall AddDebugAlloc(void* pPointer, int nSize)
{
	VALUE(vProgInfo);
	LPDBGALLOCINFO pDbg;	
	char *pProgInfo = 0;

	if (pPointer && gbTrackAlloc)
	{
		pDbg = malloc(sizeof(DBGALLOCINFO));
		if (!pDbg)
			return;

		EVALUATE(vProgInfo,"ALLTRIM(STR(LINENO())) + ':' + PROGRAM() + CHR(0)");
		if (IS_STRING(vProgInfo))
		{
			pProgInfo = strdup(HANDTOPTR(vProgInfo));
			FREEHAND(vProgInfo);
		}

		pDbg->pPointer = pPointer;
		pDbg->pProgInfo = pProgInfo;
		pDbg->nSize = nSize;
		pDbg->next = gpDbgInfo;
		gpDbgInfo = pDbg;
	}
}
开发者ID:akrisiun,项目名称:VfpProj,代码行数:26,代码来源:vfp2cmarshal.c

示例15: print_dist

static void
print_dist (gsl_monte_vegas_state * state, unsigned long dim)
{
  unsigned long i, j;
  int p = state->verbose;
  if (p < 1)
    return;

  for (j = 0; j < dim; ++j)
    {
      fprintf (state->ostream, "\n axis %lu \n", j);
      fprintf (state->ostream, "      x   g\n");
      for (i = 0; i < state->bins; i++)
        {
          fprintf (state->ostream, "weight [%11.2e , %11.2e] = ", 
                   COORD (state, i, j), COORD(state,i+1,j));
          fprintf (state->ostream, " %11.2e\n", VALUE (state, i, j));

        }
      fprintf (state->ostream, "\n");
    }
  fprintf (state->ostream, "\n");
  fflush (state->ostream);

}
开发者ID:Ayato-Harashima,项目名称:CMVS-PMVS,代码行数:25,代码来源:vegas.c


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