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


C++ copyObject函数代码示例

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


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

示例1: Assert

static ShareInputScan *make_shareinputscan(PlannerInfo *root, Plan *inputplan) 
{
	ShareInputScan *sisc = NULL;
	Path sipath;

	Assert(IsA(inputplan, Material) || IsA(inputplan, Sort));

	sisc = makeNode(ShareInputScan);
	incr_plan_nsharer(inputplan);


	sisc->plan.targetlist = copyObject(inputplan->targetlist);
	sisc->plan.lefttree = inputplan;
	sisc->plan.flow = copyObject(inputplan->flow); 

	set_plan_share_type((Plan *) sisc, get_plan_share_type(inputplan));
	set_plan_share_id((Plan *) sisc, get_plan_share_id(inputplan));
	sisc->driver_slice = -1;

	sisc->plan.qual = NIL;
	sisc->plan.righttree = NULL;

	cost_shareinputscan(&sipath, root, inputplan->total_cost, inputplan->plan_rows, inputplan->plan_width);

	sisc->plan.startup_cost = sipath.startup_cost;
	sisc->plan.total_cost = sipath.total_cost; 
	sisc->plan.plan_rows = inputplan->plan_rows;
	sisc->plan.plan_width = inputplan->plan_width;

	sisc->plan.extParam = bms_copy(inputplan->extParam);
	sisc->plan.allParam = bms_copy(inputplan->allParam);

	return sisc;
}
开发者ID:PivotalBigData,项目名称:incubator-hawq,代码行数:34,代码来源:planshare.c

示例2: test_rls_hooks_permissive

/*
 * Return permissive policies to be added
 */
List *
test_rls_hooks_permissive(CmdType cmdtype, Relation relation)
{
	List	   *policies = NIL;
	RowSecurityPolicy *policy = palloc0(sizeof(RowSecurityPolicy));
	Datum		role;
	FuncCall   *n;
	Node	   *e;
	ColumnRef  *c;
	ParseState *qual_pstate;
	RangeTblEntry *rte;

	if (strcmp(RelationGetRelationName(relation), "rls_test_permissive")
		&& strcmp(RelationGetRelationName(relation), "rls_test_both"))
		return NIL;

	qual_pstate = make_parsestate(NULL);

	rte = addRangeTableEntryForRelation(qual_pstate, relation, NULL, false,
										false);
	addRTEtoQuery(qual_pstate, rte, false, true, true);

	role = ObjectIdGetDatum(ACL_ID_PUBLIC);

	policy->policy_name = pstrdup("extension policy");
	policy->policy_id = InvalidOid;
	policy->polcmd = '*';
	policy->roles = construct_array(&role, 1, OIDOID, sizeof(Oid), true, 'i');

	/*
	 * policy->qual = (Expr *) makeConst(BOOLOID, -1, InvalidOid,
	 * sizeof(bool), BoolGetDatum(true), false, true);
	 */

	n = makeFuncCall(list_make2(makeString("pg_catalog"),
								makeString("current_user")), NIL, 0);

	c = makeNode(ColumnRef);
	c->fields = list_make1(makeString("username"));
	c->location = 0;

	e = (Node *) makeSimpleA_Expr(AEXPR_OP, "=", (Node *) n, (Node *) c, 0);

	policy->qual = (Expr *) transformWhereClause(qual_pstate, copyObject(e),
												 EXPR_KIND_POLICY,
												 "POLICY");

	policy->with_check_qual = copyObject(policy->qual);
	policy->hassublinks = false;

	policies = list_make1(policy);

	return policies;
}
开发者ID:thanhuwng,项目名称:postgres,代码行数:57,代码来源:test_rls_hooks.c

示例3: CopyPlanFields

/* ----------------
 *	CopyPlanFields
 *
 *	This function copies the fields of the Plan node.  It is used by
 *	all the copy functions for classes which inherit from Plan.
 * ----------------
 */
static void
CopyPlanFields(Plan *from, Plan *newnode)
{
    newnode->cost = from->cost;
    newnode->plan_size = from->plan_size;
    newnode->plan_width = from->plan_width;
    newnode->state = from->state;
    newnode->targetlist = copyObject(from->targetlist);
    newnode->qual = copyObject(from->qual);
    newnode->lefttree = copyObject(from->lefttree);
    newnode->righttree = copyObject(from->righttree);
}
开发者ID:jarulraj,项目名称:postgres95,代码行数:19,代码来源:copyfuncs.c

示例4: resetIsMoved

/*********************************************************************
** Member Function: print
** Description: print the resulting array given for the grid object
 * and use the loop for other loop actions like resetting flags
** Parameters: none
** Pre-Conditions: xMax and yMax must be >= 0
** Post-Conditions: xMax and yMax remain >= 0
*********************************************************************/
void Grid::print() {
    int count = 1;  // used to count how many objects exist
    for (int i = 0; i < yMax; i++){
        for (int j = 0; j < xMax; j++) {
            resetIsMoved(j, i); // reset move flags
            copyObject(j, i);   // check to see if a new object should be created
            deleteObject(j, i); // check to see if an object should be deleted
            if (gridArray[i][j] == NULL)    // prints a background space when NULL
                //std::cout << " - ";         // fill background
                std::cout << "   ";       // no background
            else if (gridArray[i][j]->getType() == 1) {
                std::cout << " * ";         /* Ant object */
                count++;
            }
            else if (gridArray[i][j]->getType() == 2) {
                std::cout << ">X<";         /* Doodlebug object */
                count++;
            }
        }
        std::cout << std::endl;
    }
    std::cout << std::endl;
    if (count == xMax * yMax)   // check to see if the grid is full
        setIsFull();
}
开发者ID:jhartle,项目名称:Ant-vs-Doodlebug-Simulation,代码行数:33,代码来源:grid.cpp

示例5: rewriteTargetSublinkUsingLeftJoin

Query *
rewriteTargetSublinkUsingLeftJoin (Query *newTop, Query *query, SublinkInfo *info, Index subList[])
{
	Query *rewrittenSublink;
	Index subIndex;

	/* here we are sure that the sublink is rewritten using MOVE-strategy there say so */
	LOGNOTICE("use Move");
	addUsedMethod("Move");

	/* rewrite Sublink query */
	rewrittenSublink = rewriteQueryNode(copyObject(info->sublink->subselect));
	info->rewrittenSublinkQuery = rewrittenSublink;

	/* join query RTEs */
	joinQueryRTEs(query);

	/* add left join for subink */
	subIndex = addLeftJoinWithRewrittenSublink (newTop, info);
	subList[info->sublinkPos] = subIndex;

	/* create the join condition for the left join with the rewritten sublink */
	createJoinCondition (newTop, info, true);

	return query;
}
开发者ID:legendOfZelda,项目名称:LDV,代码行数:26,代码来源:prov_sublink_leftjoin.c

示例6: CreatePhysicalPlan

/*
 * CreatePhysicalPlan encapsulates the logic needed to transform a particular
 * query into a physical plan. For modifications, queries immediately enter
 * the physical planning stage, since they are essentially "routed" to remote
 * target shards. SELECT queries go through the full logical plan/optimize/
 * physical plan process needed to produce distributed query plans.
 */
MultiPlan *
CreatePhysicalPlan(Query *parse)
{
	Query *parseCopy = copyObject(parse);
	MultiPlan *physicalPlan = MultiRouterPlanCreate(parseCopy, TaskExecutorType);
	if (physicalPlan == NULL)
	{
		/* Create and optimize logical plan */
		MultiTreeRoot *logicalPlan = MultiLogicalPlanCreate(parseCopy);
		MultiLogicalPlanOptimize(logicalPlan);

		/*
		 * This check is here to make it likely that all node types used in
		 * Citus are dumpable. Explain can dump logical and physical plans
		 * using the extended outfuncs infrastructure, but it's infeasible to
		 * test most plans. MultiQueryContainerNode always serializes the
		 * physical plan, so there's no need to check that separately.
		 */
		CheckNodeIsDumpable((Node *) logicalPlan);

		/* Create the physical plan */
		physicalPlan = MultiPhysicalPlanCreate(logicalPlan);
	}

	return physicalPlan;
}
开发者ID:Devin001,项目名称:citus,代码行数:33,代码来源:multi_planner.c

示例7: generateCsub

static Node *
generateCsub (SublinkInfo *info)
{
	Node *result;
	//ReplaceParamsContext *context;
	SubLink *sublink;
	//int *increaseSublevelsContext;

	/* copy sublink */
	sublink = copyObject(info->sublink);
	result = (Node *) sublink;

	//CHECK that its ok to not increase sublevelup for left join (should be because we are rewritting uncorrelated sublinks anyway, NO because we might be in another sublink)
//	/* increase varlevelsup in sublink query of Csub */
//	increaseSublevelsContext = (int *) palloc(sizeof(int));
//	*increaseSublevelsContext = -1;
//	sublink->subselect = increaseSublevelsUpMutator(sublink->subselect, increaseSublevelsContext);
//	pfree(increaseSublevelsContext);

//	/* increase varlevelsup in sublink test expression */
//	context = (ReplaceParamsContext *) palloc(sizeof(ReplaceParamsContext));
//	context->addVarSublevelsUp = 1;
//	context->touchParams = false;
//	context->touchAggs = false;
//	context->varSublevelsUp = -1;
//
//	 ((SubLink *) result)->testexpr = replaceParamsMutator (((SubLink *) result)->testexpr, context);
//	 pfree(context);

	return result;
}
开发者ID:legendOfZelda,项目名称:LDV,代码行数:31,代码来源:prov_sublink_leftjoin.c

示例8: Exception

void OperationList::addToPool(BaseObject *object, unsigned op_type)
{
	ObjectType obj_type;

	//Raises an error if the object to be added is not allocated
	if(!object)
		throw Exception(ERR_ASG_NOT_ALOC_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);

	obj_type=object->getObjectType();

	//Stores a copy of the object if its about to be moved or modified
	if(op_type==Operation::OBJECT_MODIFIED ||
		 op_type==Operation::OBJECT_MOVED)
	{
		BaseObject *copy_obj=NULL;

		if(obj_type!=BASE_OBJECT && obj_type!=OBJ_DATABASE)
			copyObject(&copy_obj, object, obj_type);
		else
			throw Exception(ERR_ASG_OBJECT_INV_TYPE,__PRETTY_FUNCTION__,__FILE__,__LINE__);

		//Raises an error if the copy fails (returning a null object)
		if(!copy_obj)
			throw Exception(ERR_ASG_NOT_ALOC_OBJECT,__PRETTY_FUNCTION__,__FILE__,__LINE__);
		else
			//Inserts the copy on the pool
			object_pool.push_back(copy_obj);
		//object=copy_obj;
	}
	else
		//Inserts the original object on the pool (in case of adition or deletion operations)
		object_pool.push_back(object);
}
开发者ID:Bumanji,项目名称:pgmodeler,代码行数:33,代码来源:operationlist.cpp

示例9: GetGroupHashIndexExpr

/*
 * GetGroupHashIndexExpr
 *
 * Returns the function expression used to index the given matrel
 */
FuncExpr *
GetGroupHashIndexExpr(int group_len, ResultRelInfo *ri)
{
	FuncExpr *result = NULL;
	int i;

	/*
	 * In order for the hashed group index to be usable, we must use an expression
	 * that is equivalent to the index expression in the group lookup. The best way
	 * to do this is to just copy the actual index expression.
	 */
	for (i = 0; i < ri->ri_NumIndices; i++)
	{
		IndexInfo *idx = ri->ri_IndexRelationInfo[i];
		Node *n;
		FuncExpr *func;

		if (!idx->ii_Expressions || list_length(idx->ii_Expressions) != 1)
			continue;

		n = linitial(idx->ii_Expressions);
		if (!IsA(n, FuncExpr))
			continue;

		func = (FuncExpr *) n;
		if ((func->funcid != HASH_GROUP_OID && func->funcid != LS_HASH_GROUP_OID) ||
				list_length(func->args) != group_len)
			continue;

		result = copyObject(func);
		break;
	}

	return result;
}
开发者ID:swrd,项目名称:pipelinedb,代码行数:40,代码来源:cont_plan.c

示例10: AddPreassignedOids

/*
 * Remember a list of pre-assigned OIDs, to be consumed later in the
 * transaction, when those system objects are created.
 */
void
AddPreassignedOids(List *l)
{
	ListCell *lc;
	MemoryContext old_context;

	if (IsBinaryUpgrade)
		elog(ERROR, "AddPreassignedOids called during binary upgrade");

	/*
	 * In the master, the OID-assignment-list is usually included in the next
	 * command that is dispatched, after an OID was assigned. In almost all
	 * cases, the dispatched command is the same CREATE command for which the
	 * oid was assigned. But I'm not sure if that's true for *all* commands,
	 * and so we don't require it. It is OK if an OID assignment is included
	 * in one dispatched command, but the command that needs the OID is only
	 * dispatched later in the same transaction. Therefore, keep the
	 * 'preassigned_oids' list in TopTransactionContext.
	 */
	old_context = MemoryContextSwitchTo(TopTransactionContext);

	foreach(lc, l)
	{
		OidAssignment *p = (OidAssignment *) lfirst(lc);

		p = copyObject(p);
		preassigned_oids = lappend(preassigned_oids, p);

#ifdef OID_DISPATCH_DEBUG
		elog(NOTICE, "received OID assignment: catalog %u, namespace: %u, name: \"%s\": %u",
			 p->catalog, p->namespaceOid, p->objname ? p->objname : "", p->oid);
#endif
	}
开发者ID:shwu,项目名称:gpdb,代码行数:37,代码来源:oid_dispatch.c

示例11: TEST

TEST(CoppyConstructor, ValidData)
{
	Arguments object = initializeObject();
	Arguments copyObject(object);
	ASSERT_EQ(copyObject.appName(), object.appName());
	ASSERT_EQ(copyObject[0],object[0]);
	ASSERT_EQ(copyObject[1],object[1]);
}
开发者ID:MariaBercean,项目名称:Maria.Bercean.Assignment,代码行数:8,代码来源:test_Arguments.cpp

示例12: cleanUp

KeySpace& KeySpace::operator=(const KeySpace &ks)
{
	if (this != &ks)
	{
		cleanUp();
		copyObject(ks);
	}
	return *this;
}
开发者ID:ChunHungLiu,项目名称:ctf-writeup,代码行数:9,代码来源:keyspace.cpp

示例13: replaceParamsMutator

Node *
replaceParamsMutator (Node *node, ReplaceParamsContext* context)
{
        if (node == NULL)
                return NULL;

        // replace Param nodes with Vars
        if (IsA(node, Param) && context->touchParams)
        {
                Param *param;
                Node *newExpr;
                TargetEntry *te;

                param = (Param *) node;

                /* find target list entry for param and retrieve expr value */
                te = (TargetEntry *) list_nth(context->sublink->targetList,param->paramid - 1);

                /* if the caller provides an varno value create a new var referencing this RTE */
                if (context->useVarnoValue)
                        newExpr = (Node *) makeVar(context->useVarnoValue, param->paramid, param->paramtype, param->paramtypmod, 0);
                /* else use the expr from the original sublink target entry */
                else
                        newExpr = (Node *) copyObject(te->expr);

                return (Node *) newExpr;
        }
        // adapt varlevelsup for Var nodes
        else if (IsA(node, Var))
        {
                Var *var;

                var = (Var *) node;

                if (context->addVarSublevelsUp)
                        var->varlevelsup = var->varlevelsup + context->addVarSublevelsUp;

                if (context->varSublevelsUp != -1)
                        var->varlevelsup = context->varSublevelsUp;

                return (Node *) var;
        }
        // adapt aggregation varlevels up
        else if (IsA(node, Aggref) && context->touchAggs)
        {
                Aggref *aggref;

                aggref = (Aggref *) node;
                aggref->agglevelsup = context->aggSublevelsUp;

                return expression_tree_mutator(node, replaceParamsMutator, (void *) context);
        }

        // recurse
        return expression_tree_mutator(node, replaceParamsMutator, (void *) context);
}
开发者ID:legendOfZelda,项目名称:LDV,代码行数:56,代码来源:prov_sublink_util_mutate.c

示例14: CreateModel

void
CreateModel(CreateModelStmt *stmt,const char *queryString, DestReceiver *dest, char *completionTag)
{

	List		*query_list;
	List		*planned_list;
	const char	*commandTag;
	Portal		portal;
	DestReceiver *tupledest;

	// create command Tag
	commandTag = CreateCommandTag(stmt->algorithmclause->trainingdata);

	// Rewrite the already analyzed Select query for the training data

	query_list = pg_rewrite_query((Query *)stmt->algorithmclause->trainingdata);

	//  plan the query

	planned_list = pg_plan_queries(query_list,0,NULL);

	// results should be send to the ModelReceiver
	tupledest = CreateModelDestReceiver(stmt->modelname,
										(TargetEntry *)stmt->outputcolumn,
										stmt->timecolumns,
										((Query *)stmt->algorithmclause->trainingdata)->jointree->quals,
										queryString,stmt->algorithmclause->algorithmname,
										((AlgorithmClause *)copyObject(stmt->algorithmclause))->algorithmparameter,
										0);

	// Create a new portal to run the query in
	portal = CreateNewPortal();

	//Don't display the portal in pg_cursors, it is for internal use only
	portal->visible = false;

	PortalDefineQuery(portal,
						  NULL,
						  queryString,
						  commandTag,
						  planned_list,
						  NULL);


	//  Start the portal.  No parameters here.
	PortalStart(portal, NULL, InvalidSnapshot);

	(void) PortalRun(portal, FETCH_ALL, false, tupledest, tupledest, completionTag);

	// Drop portal and receiver

	(*tupledest->rDestroy) (tupledest);

	PortalDrop(portal, false);

}
开发者ID:Khalefa,项目名称:VLDB12Demo,代码行数:56,代码来源:modelcmds.c

示例15: MJFormSkipQuals

/* ----------------------------------------------------------------
 *		MJFormSkipQuals
 *
 *		This takes the mergeclause which is a qualification of the
 *		form ((= expr expr) (= expr expr) ...) and forms new lists
 *		of the forms ((< expr expr) (< expr expr) ...) and
 *		((> expr expr) (> expr expr) ...).	These lists will be used
 *		by ExecMergeJoin() to determine if we should skip tuples.
 *		(We expect there to be suitable operators because the "=" operators
 *		were marked mergejoinable; however, there might be a different
 *		one needed in each qual clause.)
 * ----------------------------------------------------------------
 */
static void
MJFormSkipQuals(List *qualList, List **ltQuals, List **gtQuals,
				PlanState *parent)
{
	List	   *ltexprs,
			   *gtexprs,
			   *ltcdr,
			   *gtcdr;

	/*
	 * Make modifiable copies of the qualList.
	 */
	ltexprs = (List *) copyObject((Node *) qualList);
	gtexprs = (List *) copyObject((Node *) qualList);

	/*
	 * Scan both lists in parallel, so that we can update the operators
	 * with the minimum number of syscache searches.
	 */
	ltcdr = ltexprs;
	foreach(gtcdr, gtexprs)
	{
		OpExpr	   *ltop = (OpExpr *) lfirst(ltcdr);
		OpExpr	   *gtop = (OpExpr *) lfirst(gtcdr);

		/*
		 * The two ops should be identical, so use either one for lookup.
		 */
		if (!IsA(ltop, OpExpr))
			elog(ERROR, "mergejoin clause is not an OpExpr");

		/*
		 * Lookup the operators, and replace the data in the copied
		 * operator nodes.
		 */
		op_mergejoin_crossops(ltop->opno,
							  &ltop->opno,
							  &gtop->opno,
							  &ltop->opfuncid,
							  &gtop->opfuncid);

		ltcdr = lnext(ltcdr);
	}
开发者ID:sunyangkobe,项目名称:cscd43,代码行数:56,代码来源:nodeMergejoin.c


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