MCPcopy Create free account
hub / github.com/Gecode/gecode / clone

Method clone

contribs/qecode/QCOPPlus.cc:269–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269Qcop* Qcop::clone() {
270 bool* qt = new bool[nbSpaces];
271 int* nvv = new int[nbSpaces];
272 MySpace** zerulz = new MySpace*[nbSpaces];
273 Opts* opop = new Opts[nbSpaces];
274 int* nbvbs = new int[nbSpaces];
275 for (unsigned int i=0;i < nbSpaces;i++) {
276 qt[i] = this->Quantifiers[i];
277 nvv[i] = this->nvar[i];
278 zerulz[i] = static_cast<MySpace*>(this->rules[i]->clone(false));
279 opop[i] = this->optim[i];
280 nbvbs[i] = this->nbVarBySpace[i];
281 }
282
283 // void** v = new void*[this->n];
284 VarType* typeofv = new VarType[n];
285 int* wso = new int[n];
286 for (unsigned int i=0;i<n;i++) {
287 typeofv[i] = this->type_of_v[i];
288 wso[i] = this->whichSpaceOwns[i];
289 }
290
291 Qcop* ret = new Qcop();
292 ret->nvar = nvv;
293 ret->n = this->n;
294 ret->nbSpaces = this->nbSpaces;
295 ret->type_of_v = typeofv;
296 ret->Quantifiers = qt;
297 ret->rules = zerulz;
298 ret->goal = static_cast<MySpace*>(this->goal->clone(false));
299 ret->optim = opop;
300 ret->nbVarBySpace = nbvbs;
301 ret->whichSpaceOwns = wso;
302 ret->varInitialised = this->varInitialised;
303 currentDeclareSpace = this->currentDeclareSpace;
304
305return ret;
306}

Callers 7

recomputeMethod · 0.45
nextMethod · 0.45
Worker.hhFile · 0.45
getSpaceMethod · 0.45
getGoalMethod · 0.45
getSpaceMethod · 0.45
getGoalMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected