void sanguis::server::auras::update_sight::leave( sanguis::server::entities::with_body &_entity ) { fcppt::optional::maybe_void( fcppt::cast::dynamic_cross< sanguis::server::entities::with_id const >( _entity ), [ this ]( fcppt::reference< sanguis::server::entities::with_id const > const _with_id ) { remove_( _with_id.get() ); } ); }
void remove(const string& name){ auto itr = networkMap_.find(name); if(itr == networkMap_.end()){ return; } remove_(itr->second); networkMap_.erase(itr); }
Str& Str::operator= (int num) { remove_(); char buf[20]; sprintf(buf,"%d",num); operator=(buf); return *this; }
Str& Str::operator= (double num) { remove_(); char buf[20]; sprintf(buf,"%.13g",num); operator=(buf); return *this; }
bool ServerCollect::remove(const common::ArrayHelper<BlockCollect*>& blocks) { RWLock::Lock lock(mutex_, WRITE_LOCKER); for (int32_t i = 0; i < blocks.get_array_index(); ++i) { remove_(*blocks.at(i)); } return true; }
void Str::nset(const char* chars, int len) { sabassert(chars); remove_(); byteLength_ = len; text_ = claimMemory(len + 1); memcpy(text_, chars, len); text_[len] = 0; }
Str& Str::operator=(const Str& string) { remove_(); int hisByteLen = string.length(); byteLength_ = hisByteLen; text_ = claimMemory(hisByteLen + 1); memcpy(operator char*(), string.operator char*(), hisByteLen+1); return *this; }
Str& Str::operator= (char c) { remove_(); char *p; *(p = claimMemory(2)) = c; p[1] = 0; byteLength_ = 1; text_ = p; return *this; }
void TwoThreeTree::remove(int key){ if ( remove_(root, key)) root = NULL; else if (root != NULL && root->child.size() == 1){ auto t = root; root = root->child[0]; t->child.clear(); delete t; } }
DStr& DStr::appendSelf(DStr& other) { other.nadd(text_, byteLength_); DynBlockItem *b; for (b = blocks.first; b; b = b -> next) other.nadd(b -> data, b -> byteCount); remove_(); byteLength_ = 0; return other; }
bool Set::remove(int value){ for (int i = 0; i < size; i++){ if (values[i] == value){ return remove_(i); } } return 0; }
bool TwoThreeTree::remove_(Node *node, int key){ if (node == NULL) return false; if (node->isLeaf()){ if (node->key == key){ delete node; return true; } return false; } int toRemove = node->findChildNo(key); if (remove_(node->child[toRemove], key)){ node->child.erase(node->child.begin() + toRemove); return false; } if (node->child[toRemove]->child.size() == 1){ int borrower = -1; if (toRemove > 0 && node->child[toRemove - 1]->child.size() == 3){ borrower = toRemove - 1; } else { if (toRemove < node->child.size() - 1 && node->child[toRemove + 1]->child.size() == 3) borrower = toRemove + 1; } if (borrower != -1){ node->child[toRemove]->child[1] = node->child[borrower]->child[2]; node->child[borrower]->child.pop_back(); }else{ if (toRemove > 0) borrower = toRemove - 1; else borrower = toRemove + 1; auto tmp = *(node->child[toRemove]->child.rbegin()); node->child[borrower]->child.push_back(tmp); node->child[toRemove]->child.pop_back(); delete node->child[toRemove]; node->child.erase(node->child.begin() + toRemove); } } return false; }
// Tokenizes the instruction part of the text command. If it corresponds to one of the supported // instructions, like "add" or "remove", it searches for the next token (the sample name) in the // list of samples and sends its buttonID to the relevant instruction function for further processing void instructionControl(char *string_pointer) { char *buttonID = NULL; int instruction_to_execute; if (!string_pointer) { return; } instruction_to_execute = selectInstruction(string_pointer); string_pointer = strtok(NULL, " \n"); if (string_pointer != NULL) { buttonID = findSampleInArray(string_pointer); // } switch(instruction_to_execute) { case ADD: add_(buttonID); break; case REMOVE: remove_(buttonID); break; case SET: set_(string_pointer); break; case STOP: stopAll_(); break; } }
void Tracked_Blip_Buffer::remove_samples( long n ) { remove_( n ); Blip_Buffer::remove_samples( n ); }
void Tracked_Blip_Buffer::remove_silence( long n ) { remove_( n ); Blip_Buffer::remove_silence( n ); }
DStr::~DStr() { remove_(); }
int IDENTIFIER(void) { d("IDENTIFIER",token,pending); if (!id("X")) return 0; remove_("X"); return 1; }
DStr& DStr::operator=(const DStr& other) { remove_(); operator+=(other); return *this; }
DStr& Str::appendSelf(DStr& other) { other.nadd(operator char*(), length()); remove_(); return other; }
Str::~Str() { remove_(); }
void Str::empty() { byteLength_ = 0; remove_(); *(text_ = claimMemory(1)) = 0; }
bool ServerCollect::remove(BlockCollect* block) { RWLock::Lock lock(mutex_, WRITE_LOCKER); return NULL != block ? remove_(block) : false; }
static void ant_rlf(gcp_solution_t *sol, gcp_t *problem) {/*{{{*/ int i, j; int colornumber = 0; /* number of colors used */ int colored = 0; /* number of colored vertex */ int v, new_v; /* vertex to be colored */ int nn; /* keep number of non-neighbors of v */ double *probb; /* probabilities for choosing a vertex */ /*{{{*/ static int *degree = NULL; static int **adj = NULL; static int *ctr = NULL; if (!ctr) { degree = malloc_(sizeof(int) * problem->size); adj = malloc_(sizeof(int*) * problem->size); } for (i = 0; i < problem->size; i++) { degree[i] = problem->degree[i]; if (!ctr) { adj[i] = malloc(sizeof(int) * problem->size); } for (j = 0; j < problem->size; j++) { adj[i][j] = problem->adj[i][j]; // adj[j][i] = problem->adj[j][i]; } } ctr = degree; /*}}}*/ while (colored < problem->size) { v = first_vertex(degree, problem->size); sol->color[v] = colornumber; sol->nodes_color[colornumber]++; colored++; nn = problem->size - degree[v] - 1; for (i = 0; i < problem->size; i++) { if (!adj[v][i] && (degree[i] == OUT)) { nn--; } } while (nn > 0) { /* choose new_v, non neighbor of v that is not OUT with probability p */ /* probb = calculate_probbs(v, problem->size, colornumber, degree, adj, sol->color, problem->alpha, problem->beta); new_v = choose_vertex(probb, problem->size); */ new_v = 0; while (v==new_v || (degree[new_v]==OUT) || adj[new_v][v]) new_v++; for (i = new_v; i < problem->size; i++) { if ((i != v) && !adj[v][i] && (degree[i] != OUT) && (degree[i] > degree[new_v])) new_v = i; } sol->color[new_v] = colornumber; sol->nodes_color[colornumber]++; colored++; contract(v, new_v, degree, adj, problem->size, &nn); nn--; } remove_(v, degree, adj, problem->size); colornumber++; } sol->spent_time = current_usertime_secs(); sol->ncolors = colornumber; }/*}}}*/
/** * qhasharr->put(): Put an object into this table. * * @param tbl qhasharr_t container pointer. * @param key key string * @param value value object data * @param size size of value * * @return true if successful, otherwise returns false * @retval errno will be set in error condition. * - ENOBUFS : Table doesn't have enough space to store the object. * - EINVAL : Invalid argument. * - EFAULT : Unexpected error. Data structure is not constant. */ static bool put(qhasharr_t *tbl, const char *key, const void *value, size_t size) { if (key == NULL || value == NULL) { errno = EINVAL; return false; } // check full if (tbl->usedslots >= tbl->maxslots) { DEBUG("hasharr: put %s - FULL", key); errno = ENOBUFS; return false; } // get hash integer unsigned int hash = qhashmurmur3_32(key, strlen(key)) % tbl->maxslots; // check, is slot empty if (tbl->slots[hash].count == 0) { // empty slot // put data if (_put_data(tbl, hash, hash, key, value, size, 1) == false) { DEBUG("hasharr: FAILED put(new) %s", key); return false; } DEBUG("hasharr: put(new) %s (idx=%d,hash=%u,tot=%d)", key, hash, hash, tbl->usedslots); } else if (tbl->slots[hash].count > 0) { // same key or hash collision // check same key; int idx = _get_idx(tbl, key, hash); if (idx >= 0) { // same key // remove and recall remove_(tbl, key); return put(tbl, key, value, size); } else { // no same key, just hash collision // find empty slot int idx = _find_empty(tbl, hash); if (idx < 0) { errno = ENOBUFS; return false; } // put data. -1 is used for collision resolution (idx != hash); if (_put_data(tbl, idx, hash, key, value, size, -1) == false) { DEBUG("hasharr: FAILED put(col) %s", key); return false; } // increase counter from leading slot tbl->slots[hash].count++; DEBUG("hasharr: put(col) %s (idx=%d,hash=%u,tot=%d)", key, idx, hash, tbl->usedslots); } } else { // in case of -1 or -2, move it. -1 used for collision resolution, // -2 used for oversized value data. // find empty slot int idx = _find_empty(tbl, hash + 1); if (idx < 0) { errno = ENOBUFS; return false; } // move dup slot to empty _copy_slot(tbl, idx, hash); _remove_slot(tbl, hash); // in case of -2, adjust link of mother if (tbl->slots[idx].count == -2) { tbl->slots[ tbl->slots[idx].hash ].link = idx; if (tbl->slots[idx].link != -1) { tbl->slots[ tbl->slots[idx].link ].hash = idx; } } // store data if (_put_data(tbl, hash, hash, key, value, size, 1) == false) { DEBUG("hasharr: FAILED put(swp) %s", key); return false; } DEBUG("hasharr: put(swp) %s (idx=%u,hash=%u,tot=%d)", key, hash, hash, tbl->usedslots); } return true; }
template<typename T, typename... Args> void remove(T& arg, Args&&... args) { remove_(arg); remove(args...); }
long Tracked_Blip_Buffer::read_samples( blip_sample_t* out, long count ) { count = Blip_Buffer::read_samples( out, count ); remove_( count ); return count; }
bool remove(string const& file_path, const mpi::comm& comm) { return mpi::root_do(comm, [&]() { return remove_(file_path, comm); }); }
Str& Str::operator=(const DStr& dynamic) { remove_(); nset((char*) dynamic, dynamic.length()); return *this; }
~NNModule_(){ for(auto itr : networkMap_){ remove_(itr.second); } }