DisplayObject::~DisplayObject() { if (_parent != 0) { release(_parent); } }
Input::~Input() { stop(); release(); delete m_localFrame; delete m_listener; }
QCLVectorBase::~QCLVectorBase() { release(); }
NE_DLL NEDebugManager::Flag::Flag() : NEObject() { release(); }
tupp::~tupp() // destructor { // release the pointer before deallocating the space for it release(); }
/* Return bytes written, negative on error */ int swrite(rd_t rd, char* s) { if (rd < 0 || rd >= RESOURCE_TABLE_SIZE) { return -1; } int n = 0; if (task_switching) { acquire(curr_task->task->resources[rd]->sem); if (curr_task->task->resources[rd]->swriter) { int ret = curr_task->task->resources[rd]->swriter(s, curr_task->task->resources[rd]->env); if (ret >= 0) { n += ret; } else { n = ret; } } else { while(*s) { int ret = curr_task->task->resources[rd]->writer(*s++, curr_task->task->resources[rd]->env); if (ret >= 0) { n += ret; } else { n = ret; break; } } } release(curr_task->task->resources[rd]->sem); } else { if(default_resources[rd] != NULL) { if (default_resources[rd]->swriter) { int ret = default_resources[rd]->swriter(s, default_resources[rd]->env); if (ret >= 0) { n += ret; } else { n = ret; } } else { while(*s) { int ret = default_resources[rd]->writer(*s++, default_resources[rd]->env); if (ret >= 0) { n += ret; } else { n = ret; break; } } } } else { return -1; } } return n; }
SDOXMLString::~SDOXMLString() { release(); }
void* OPJSupport::decompressJPEG2KWithBuffer ( void* inputBuffer, void* jp2Data, long jp2DataSize, long *decompressedBufferSize, int *colorModel){ opj_dparameters_t parameters; OPJ_BOOL hasFile = OPJ_FALSE; opj_buffer_info_t buf_info; int i, decod_format; int width, height; OPJ_BOOL hasAlpha, fails = OPJ_FALSE; OPJ_CODEC_FORMAT codec_format; unsigned char rc, gc, bc, ac; decode_info_t decodeInfo; memset(&decodeInfo, 0, sizeof(decode_info_t)); memset(&buf_info, 0, sizeof(opj_buffer_info_t)); if (jp2Data != NULL) { buf_info.len = jp2DataSize; buf_info.buf = (OPJ_BYTE*)jp2Data; buf_info.cur = buf_info.buf; } opj_set_default_decoder_parameters(¶meters); decod_format = buffer_format(&buf_info); if(decod_format == -1) { fprintf(stderr,"%s:%d: decode format missing\n",__FILE__,__LINE__); release(&decodeInfo); return 0; } /*-----------------------------------------------*/ if(decod_format == J2K_CFMT) codec_format = OPJ_CODEC_J2K; else if(decod_format == JP2_CFMT) codec_format = OPJ_CODEC_JP2; else if(decod_format == JPT_CFMT) codec_format = OPJ_CODEC_JPT; else { /* clarified in infile_format() : */ release(&decodeInfo); return 0; } parameters.decod_format = decod_format; while(1) { int tile_index=-1, user_changed_tile=0, user_changed_reduction=0; int max_tiles=0, max_reduction=0; fails = OPJ_TRUE; decodeInfo.stream = opj_stream_create_buffer_stream(&buf_info, 1); if(decodeInfo.stream == NULL) { fprintf(stderr,"%s:%d: NO decodeInfo.stream\n",__FILE__,__LINE__); break; } decodeInfo.codec = opj_create_decompress(codec_format); if(decodeInfo.codec == NULL) { fprintf(stderr,"%s:%d: NO coded\n",__FILE__,__LINE__); break; } // opj_set_info_handler(decodeInfo.codec, error_callback, this); // opj_set_info_handler(decodeInfo.codec, warning_callback, this); // opj_set_info_handler(decodeInfo.codec, info_callback, this); if( !opj_setup_decoder(decodeInfo.codec, ¶meters)) { fprintf(stderr,"%s:%d:\n\topj_setup_decoder failed\n",__FILE__,__LINE__); break; } if(user_changed_tile && user_changed_reduction) { int reduction=0; opj_set_decoded_resolution_factor(decodeInfo.codec, reduction); } if( !opj_read_header(decodeInfo.stream, decodeInfo.codec, &decodeInfo.image)) { fprintf(stderr,"%s:%d:\n\topj_read_header failed\n",__FILE__,__LINE__); break; } if( !(user_changed_tile && user_changed_reduction) || (max_tiles <= 0) || (max_reduction <= 0) ) { opj_codestream_info_v2_t *cstr; cstr = opj_get_cstr_info(decodeInfo.codec); max_reduction = cstr->m_default_tile_info.tccp_info->numresolutions; max_tiles = cstr->tw * cstr->th; } if(tile_index < 0) { unsigned int x0, y0, x1, y1; int user_changed_area=0; x0 = y0 = x1 = y1 = 0; if(user_changed_area) { } if( !opj_set_decode_area(decodeInfo.codec, decodeInfo.image, x0, y0, x1, y1)) { fprintf(stderr,"%s:%d:\n\topj_set_decode_area failed\n",__FILE__,__LINE__); break; } if( !opj_decode(decodeInfo.codec, decodeInfo.stream, decodeInfo.image)) { fprintf(stderr,"%s:%d:\n\topj_decode failed\n",__FILE__,__LINE__); break; } } /* if(tile_index < 0) */ else { if( !opj_get_decoded_tile(decodeInfo.codec, decodeInfo.stream, decodeInfo.image, tile_index)) { fprintf(stderr,"%s:%d:\n\topj_get_decoded_tile failed\n",__FILE__,__LINE__); break; } } if( !opj_end_decompress(decodeInfo.codec, decodeInfo.stream)) { fprintf(stderr,"%s:%d:\n\topj_end_decompress failed\n",__FILE__,__LINE__); break; } fails = OPJ_FALSE; break; } decodeInfo.deleteImage = fails; release(&decodeInfo); if(fails) { return 0; } decodeInfo.deleteImage = OPJ_TRUE; if(decodeInfo.image->color_space != OPJ_CLRSPC_SYCC && decodeInfo.image->numcomps == 3 && decodeInfo.image->comps[0].dx == decodeInfo.image->comps[0].dy && decodeInfo.image->comps[1].dx != 1) decodeInfo.image->color_space = OPJ_CLRSPC_SYCC; else if(decodeInfo.image->numcomps <= 2) decodeInfo.image->color_space = OPJ_CLRSPC_GRAY; if(decodeInfo.image->color_space == OPJ_CLRSPC_SYCC) { //disable for now //color_sycc_to_rgb(decodeInfo.image); } if(decodeInfo.image->icc_profile_buf) { #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) color_apply_icc_profile(decodeInfo.image); #endif free(decodeInfo.image->icc_profile_buf); decodeInfo.image->icc_profile_buf = NULL; decodeInfo.image->icc_profile_len = 0; } width = decodeInfo.image->comps[0].w; height = decodeInfo.image->comps[0].h; long depth = (decodeInfo.image->comps[0].prec + 7)/8; long decompressSize = width * height * decodeInfo.image->numcomps * depth; if (decompressedBufferSize) *decompressedBufferSize = decompressSize;; if (!inputBuffer ) { inputBuffer = malloc(decompressSize); } if (colorModel) *colorModel = 0; if ((decodeInfo.image->numcomps >= 3 && decodeInfo.image->comps[0].dx == decodeInfo.image->comps[1].dx && decodeInfo.image->comps[1].dx == decodeInfo.image->comps[2].dx && decodeInfo.image->comps[0].dy == decodeInfo.image->comps[1].dy && decodeInfo.image->comps[1].dy == decodeInfo.image->comps[2].dy && decodeInfo.image->comps[0].prec == decodeInfo.image->comps[1].prec && decodeInfo.image->comps[1].prec == decodeInfo.image->comps[2].prec )/* RGB[A] */ || (decodeInfo.image->numcomps == 2 && decodeInfo.image->comps[0].dx == decodeInfo.image->comps[1].dx && decodeInfo.image->comps[0].dy == decodeInfo.image->comps[1].dy && decodeInfo.image->comps[0].prec == decodeInfo.image->comps[1].prec ) ) /* GA */ { int has_alpha4, has_alpha2, has_rgb; int *red, *green, *blue, *alpha; if (colorModel) *colorModel = 1; alpha = NULL; has_rgb = (decodeInfo.image->numcomps == 3); has_alpha4 = (decodeInfo.image->numcomps == 4); has_alpha2 = (decodeInfo.image->numcomps == 2); hasAlpha = (has_alpha4 || has_alpha2); if(has_rgb) { red = decodeInfo.image->comps[0].data; green = decodeInfo.image->comps[1].data; blue = decodeInfo.image->comps[2].data; if(has_alpha4) { alpha = decodeInfo.image->comps[3].data; } } /* if(has_rgb) */ else { red = green = blue = decodeInfo.image->comps[0].data; if(has_alpha2) { alpha = decodeInfo.image->comps[1].data; } } /* if(has_rgb) */ ac = 255;/* 255: FULLY_OPAQUE; 0: FULLY_TRANSPARENT */ unsigned char* ptrIBody = (unsigned char*)inputBuffer; for(i = 0; i < width*height; i++) { rc = (unsigned char) *red++; gc = (unsigned char)*green++; bc = (unsigned char)*blue++; if(hasAlpha) { ac = (unsigned char)*alpha++; // A R G B unsigned int pixel = (int)((ac<<24) | (rc<<16) | (gc<<8) | bc); *reinterpret_cast<unsigned int*>(ptrIBody) = pixel; ptrIBody += sizeof(unsigned int); } else { *ptrIBody++ = bc; *ptrIBody++ = gc; *ptrIBody++ = rc; } } /* for(i) */ }/* if (decodeInfo.image->numcomps >= 3 */ else if(decodeInfo.image->numcomps == 1) /* Grey */ { /* 1 component 8 or 16 bpp decodeInfo.image */ int *grey = decodeInfo.image->comps[0].data; if(decodeInfo.image->comps[0].prec <= 8) { char* ptrBBody = (char*)inputBuffer; for(i=0; i<width*height; i++) { *ptrBBody++ = *grey++; } /* Replace image8 buffer: */ } else /* prec[9:16] */ { int *grey; int ushift = 0, dshift = 0, force16 = 0; grey = decodeInfo.image->comps[0].data; short* ptrSBody = (short*)inputBuffer; for(i=0; i<width*height; i++) { //disable shift up for signed data: don't know why we are doing this *ptrSBody++ = *grey++; } /* Replace image16 buffer: */ } } else { int *grey; fprintf(stderr,"%s:%d:Can show only first component of decodeInfo.image\n" " components(%d) prec(%d) color_space[%d](%s)\n" " RECT(%d,%d,%d,%d)\n",__FILE__,__LINE__,decodeInfo.image->numcomps, decodeInfo.image->comps[0].prec, decodeInfo.image->color_space,clr_space(decodeInfo.image->color_space), decodeInfo.image->x0,decodeInfo.image->y0,decodeInfo.image->x1,decodeInfo.image->y1 ); for(i = 0; i < decodeInfo.image->numcomps; ++i) { fprintf(stderr,"[%d]dx(%d) dy(%d) w(%d) h(%d) signed(%u)\n",i, decodeInfo.image->comps[i].dx ,decodeInfo.image->comps[i].dy, decodeInfo.image->comps[i].w,decodeInfo.image->comps[i].h, decodeInfo.image->comps[i].sgnd); } /* 1 component 8 or 16 bpp decodeInfo.image */ grey = decodeInfo.image->comps[0].data; if(decodeInfo.image->comps[0].prec <= 8) { char* ptrBBody = (char*)inputBuffer; for(i=0; i<width*height; i++) { *ptrBBody++ = *grey++; } /* Replace image8 buffer: */ } else /* prec[9:16] */ { int *grey; int ushift = 0, dshift = 0, force16 = 0; grey = decodeInfo.image->comps[0].data; short* ptrSBody = (short*)inputBuffer; for(i=0; i<width*height; i++) { *ptrSBody++ = *grey++; } /* Replace image16 buffer: */ } } release(&decodeInfo); return inputBuffer; }
void run(void) { data='w'; while(1) { while(data == 'w') //waiting for signal { } while(data == '\0' ) { stop(); _delay_ms(4000); comintersection(); _delay_ms(100); } if(data=='f') // forward { data='\0'; } if(data=='r') // right { data='\0'; turn_right(); } if(data=='l') // left { data='\0'; turn_left(); } if(data == 'h') // halt { data='\0'; stop(); _delay_ms(100); continue; } if(data == 'o') // origin { data='w'; stop(); _delay_ms(100); continue; } if(data == 'c') //collect item data -> i when the bot is trying to pick up an rfid { data='w'; arm_down(); _delay_ms(2700); stop_arm(); _delay_ms(2000); grab(); arm_up(); _delay_ms(3100); stop_arm(); _delay_ms(2000); lcd_cursor(2,1); lcd_string("Collecting"); _delay_ms(3500); readrfidtag(); clearrfid(); continue; } if(data == 'd') //drop_item { data='w'; go_down(); release(); go_up(); lcd_cursor(2,1); lcd_string("Dropping"); _delay_ms(3500); senddroppedsig(); continue; } while(1) { if(move_bot() == 1) { continue; } else { break; } } } }
port& operator= (port&& rhs) { if (this != &rhs) { release(); m_blob = rhs.m_blob; rhs.m_blob = nullptr; } return *this; }
int main(int argc, char **argv) { tcpport_t port; int last_failed = 0; struct nwio_tcpcl tcplistenopt; struct nwio_tcpconf tcpconf; struct nwio_tcpopt tcpopt; char *tcp_device; struct servent *servent; int tcp_fd, client_fd, count, r; int pfd[2]; unsigned stall= 0; struct sigaction sa; sigset_t chldmask, chldunmask, oldmask; char **progv; #if !PARANOID # define debug 0 # define max_children ((unsigned) -1) arg0= argv[0]; /* Switch to the paranoid version of me if there are flags, or if * there is an access file. */ if (argv[1][0] == '-' || access(_PATH_SERVACCES, F_OK) == 0) { execv("/usr/bin/tcpdp", argv); report("tcpdp"); exit(1); } if (argc < 3) usage(); service= argv[1]; progv= argv+2; #else /* PARANOID */ int debug, i; unsigned max_children; arg0= argv[0]; debug= 0; max_children= -1; i= 1; while (i < argc && argv[i][0] == '-') { char *opt= argv[i++] + 1; unsigned long m; char *end; if (*opt == '-' && opt[1] == 0) break; /* -- */ while (*opt != 0) switch (*opt++) { case 'd': debug= 1; break; case 'm': if (*opt == 0) { if (i == argc) usage(); opt= argv[i++]; } m= strtoul(opt, &end, 10); if (m <= 0 || m > UINT_MAX || *end != 0) usage(); max_children= m; opt= ""; break; default: usage(); } } service= argv[i++]; progv= argv+i; if (i >= argc) usage(); #endif /* The interface to start the service on. */ if ((tcp_device= getenv("TCP_DEVICE")) == NULL) tcp_device= TCP_DEVICE; /* Let SIGCHLD interrupt whatever I'm doing. */ sigemptyset(&chldmask); sigaddset(&chldmask, SIGCHLD); sigprocmask(SIG_BLOCK, &chldmask, &oldmask); chldunmask= oldmask; sigdelset(&chldunmask, SIGCHLD); sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = sigchld; sigaction(SIGCHLD, &sa, NULL); /* Open a socket to the service I'm to serve. */ if ((servent= getservbyname(service, "tcp")) == NULL) { unsigned long p; char *end; p= strtoul(service, &end, 0); if (p <= 0 || p > 0xFFFF || *end != 0) { fprintf(stderr, "%s: %s: Unknown service\n", arg0, service); exit(1); } port= htons((tcpport_t) p); } else { port= servent->s_port; if (debug) { fprintf(stderr, "%s %s: listening to port %u\n", arg0, service, ntohs(port)); } } /* No client yet. */ client_fd= -1; while (1) { if ((tcp_fd= open(tcp_device, O_RDWR)) < 0) { report(tcp_device); #if 0 if (errno == ENOENT || errno == ENODEV || errno == ENXIO) { exit(1); } #endif last_failed = 1; goto bad; } if(last_failed) fprintf(stderr, "%s %s: %s: Ok\n", arg0, service, tcp_device); last_failed = 0; tcpconf.nwtc_flags= NWTC_LP_SET | NWTC_UNSET_RA | NWTC_UNSET_RP; tcpconf.nwtc_locport= port; if (ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf) < 0) { report("Can't configure TCP channel"); exit(1); } tcpopt.nwto_flags= NWTO_DEL_RST; if (ioctl(tcp_fd, NWIOSTCPOPT, &tcpopt) < 0) { report("Can't set TCP options"); exit(1); } if (client_fd != -1) { /* We have a client, so start a server for it. */ tcpopt.nwto_flags= 0; (void) ioctl(client_fd, NWIOSTCPOPT, &tcpopt); fflush(NULL); /* Create a pipe to serve as an error indicator. */ if (pipe(pfd) < 0) { report("pipe"); goto bad; } (void) fcntl(pfd[1], F_SETFD, fcntl(pfd[1], F_GETFD) | FD_CLOEXEC); /* Fork and exec. */ switch (fork()) { case -1: report("fork"); close(pfd[0]); close(pfd[1]); goto bad; case 0: close(tcp_fd); close(pfd[0]); #if PARANOID /* Check if access to this service allowed. */ if (ioctl(client_fd, NWIOGTCPCONF, &tcpconf) == 0 && tcpconf.nwtc_remaddr != tcpconf.nwtc_locaddr && !servxcheck(tcpconf.nwtc_remaddr, argv[1], NULL) ) { exit(1); } #endif sigprocmask(SIG_SETMASK, &oldmask, NULL); dup2(client_fd, 0); dup2(client_fd, 1); close(client_fd); execvp(progv[0], progv); report(progv[0]); write(pfd[1], &errno, sizeof(errno)); exit(1); default: nchildren++; release(&client_fd); close(pfd[1]); r= read(pfd[0], &errno, sizeof(errno)); close(pfd[0]); if (r != 0) goto bad; break; } } while (nchildren >= max_children) { /* Too many clients, wait for one to die off. */ sigsuspend(&chldunmask); } /* Wait for a new connection. */ sigprocmask(SIG_UNBLOCK, &chldmask, NULL); tcplistenopt.nwtcl_flags= 0; while (ioctl(tcp_fd, NWIOTCPLISTEN, &tcplistenopt) < 0) { if (errno != EINTR) { if (errno != EAGAIN || debug) { report("Unable to listen"); } goto bad; } } sigprocmask(SIG_BLOCK, &chldmask, NULL); /* We got a connection. */ client_fd= tcp_fd; tcp_fd= -1; if (debug && ioctl(client_fd, NWIOGTCPCONF, &tcpconf) == 0) { fprintf(stderr, "%s %s: Connection from %s:%u\n", arg0, service, inet_ntoa(tcpconf.nwtc_remaddr), ntohs(tcpconf.nwtc_remport)); } /* All is well, no need to stall. */ stall= 0; continue; bad: /* All is not well, release resources. */ release(&tcp_fd); release(&client_fd); /* Wait a bit if this happens more than once. */ if (stall != 0) { if (debug) { fprintf(stderr, "%s %s: stalling %u second%s\n", arg0, service, stall, stall == 1 ? "" : "s"); } sleep(stall); stall <<= 1; } else { stall= 1; } } }
~port() { release(); }
_XEngineLogo::~_XEngineLogo() { release(); }
SSLContext::~SSLContext() { release(); }
void ScopedCancelHandle::cancel() { release().cancel(); }
WBaseStream::~WBaseStream() { close(); release(); }
//////////////////////////////////////////////////////// // // PerformceAllocScene // //////////////////////////////////////////////////////// void PerformceAllocScene::initWithQuantityOfNodes(unsigned int nNodes) { //kdSrand(time()); auto s = Director::getInstance()->getWinSize(); // Title auto label = LabelTTF::create(title().c_str(), "Arial", 40); addChild(label, 1); label->setPosition(Point(s.width/2, s.height-32)); label->setColor(Color3B(255,255,40)); // Subtitle std::string strSubTitle = subtitle(); if(strSubTitle.length()) { auto l = LabelTTF::create(strSubTitle.c_str(), "Thonburi", 16); addChild(l, 1); l->setPosition(Point(s.width/2, s.height-80)); } lastRenderedCount = 0; currentQuantityOfNodes = 0; quantityOfNodes = nNodes; MenuItemFont::setFontSize(65); auto decrease = MenuItemFont::create(" - ", [&](Object *sender) { quantityOfNodes -= kNodesIncrease; if( quantityOfNodes < 0 ) quantityOfNodes = 0; updateQuantityLabel(); updateQuantityOfNodes(); updateProfilerName(); CC_PROFILER_PURGE_ALL(); kdSrand(0); }); decrease->setColor(Color3B(0,200,20)); auto increase = MenuItemFont::create(" + ", [&](Object *sender) { quantityOfNodes += kNodesIncrease; if( quantityOfNodes > kMaxNodes ) quantityOfNodes = kMaxNodes; updateQuantityLabel(); updateQuantityOfNodes(); updateProfilerName(); CC_PROFILER_PURGE_ALL(); kdSrand(0); }); increase->setColor(Color3B(0,200,20)); auto menu = Menu::create(decrease, increase, NULL); menu->alignItemsHorizontally(); menu->setPosition(Point(s.width/2, s.height/2+15)); addChild(menu, 1); auto infoLabel = LabelTTF::create("0 nodes", "Marker Felt", 30); infoLabel->setColor(Color3B(0,200,20)); infoLabel->setPosition(Point(s.width/2, s.height/2-15)); addChild(infoLabel, 1, kTagInfoLayer); auto menuLayer = new AllocBasicLayer(true, MAX_LAYER, g_curCase); addChild(menuLayer); menuLayer->release(); updateQuantityLabel(); updateQuantityOfNodes(); updateProfilerName(); kdSrand(0); }
~buffer() { release(); }
size_t Keyboard_::write(uint8_t c) { uint8_t p = press(c); // Keydown release(c); // Keyup return p; // just return the result of press() since release() almost always returns 1 }
/* ** デストラクタ */ MonoImage::~MonoImage() { release(); }
inline void OrderAccess::storestore() { release(); }
Mutex::~Mutex() { release(); }
void run() { AutoGetCollectionForRead ctx(&_txn, nss.ns()); Collection* collection = ctx.getCollection(); ASSERT(collection); // Query can be answered by either index on "a" or index on "b". auto statusWithCQ = CanonicalQuery::canonicalize(nss, fromjson("{a: {$gte: 8}, b: 1}")); ASSERT_OK(statusWithCQ.getStatus()); const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); // We shouldn't have anything in the plan cache for this shape yet. PlanCache* cache = collection->infoCache()->getPlanCache(); ASSERT(cache); CachedSolution* rawCachedSolution; ASSERT_NOT_OK(cache->get(*cq, &rawCachedSolution)); // Get planner params. QueryPlannerParams plannerParams; fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams); // Set up queued data stage to take a long time before returning EOF. Should be long // enough to trigger a replan. const size_t decisionWorks = 10; const size_t mockWorks = 1U + static_cast<size_t>(internalQueryCacheEvictionRatio * decisionWorks); auto mockChild = stdx::make_unique<QueuedDataStage>(&_txn, &_ws); for (size_t i = 0; i < mockWorks; i++) { mockChild->pushBack(PlanStage::NEED_TIME); } CachedPlanStage cachedPlanStage( &_txn, collection, &_ws, cq.get(), plannerParams, decisionWorks, mockChild.release()); // This should succeed after triggering a replan. PlanYieldPolicy yieldPolicy(nullptr, PlanExecutor::YIELD_MANUAL); ASSERT_OK(cachedPlanStage.pickBestPlan(&yieldPolicy)); // Make sure that we get 2 legit results back. size_t numResults = 0; PlanStage::StageState state = PlanStage::NEED_TIME; while (state != PlanStage::IS_EOF) { WorkingSetID id = WorkingSet::INVALID_ID; state = cachedPlanStage.work(&id); ASSERT_NE(state, PlanStage::FAILURE); ASSERT_NE(state, PlanStage::DEAD); if (state == PlanStage::ADVANCED) { WorkingSetMember* member = _ws.get(id); ASSERT(cq->root()->matchesBSON(member->obj.value())); numResults++; } } ASSERT_EQ(numResults, 2U); // This time we expect to find something in the plan cache. Replans after hitting the // works threshold result in a cache entry. ASSERT_OK(cache->get(*cq, &rawCachedSolution)); const std::unique_ptr<CachedSolution> cachedSolution(rawCachedSolution); }
/** * Bye command */ void command_bye(void) { printf("bye\n"); release(); exit(0); }
LabelDialog::LabelDialog(wxWindow *parent, TrackFactory &factory, TrackList *tracks, LabelTrack *selectedTrack, int index, ViewInfo &viewinfo, double rate, const wxString & format, const wxString &freqFormat) : wxDialogWrapper(parent, wxID_ANY, _("Edit Labels"), wxDefaultPosition, wxSize(800, 600), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), mFactory(factory), mTracks(tracks) , mSelectedTrack(selectedTrack) , mIndex(index) , mViewInfo(&viewinfo), mRate(rate), mFormat(format) , mFreqFormat(freqFormat) { SetName(GetTitle()); { // Create the main sizer auto vs = std::make_unique<wxBoxSizer>(wxVERTICAL); // A little instruction wxStaticText *instruct = safenew wxStaticText(this, wxID_ANY, _("Press F2 or double click to edit cell contents.")); instruct->SetName(instruct->GetLabel()); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) vs->Add(instruct, 0, wxALIGN_LEFT | wxALL, 5); // Create the main sizer mGrid = safenew Grid(this, wxID_ANY); vs->Add(mGrid, 1, wxEXPAND | wxALL, 5); // Create the action buttons { auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL); hs->Add(safenew wxButton(this, ID_INSERTA, _("Insert &After")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_INSERTB, _("Insert &Before")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_REMOVE, _("&Remove")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_IMPORT, _("&Import...")), 1, wxCENTER | wxALL, 5); hs->Add(safenew wxButton(this, ID_EXPORT, _("&Export...")), 1, wxCENTER | wxALL, 5); vs->Add(hs.release(), 0, wxEXPAND | wxCENTER | wxALL, 5); } // Create the exit buttons vs->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND); // Make it so SetSizer(vs.release()); } // Build the initial (empty) grid mGrid->CreateGrid(0, Col_Max); mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER); /* i18n-hint: (noun). A track contains waves, audio etc.*/ mGrid->SetColLabelValue(0,_("Track")); /* i18n-hint: (noun)*/ mGrid->SetColLabelValue(1,_("Label")); /* i18n-hint: (noun) of a label*/ mGrid->SetColLabelValue(2,_("Start Time")); /* i18n-hint: (noun) of a label*/ mGrid->SetColLabelValue(3,_("End Time")); /* i18n-hint: (noun) of a label*/ mGrid->SetColLabelValue(4,_("Low Frequency")); /* i18n-hint: (noun) of a label*/ mGrid->SetColLabelValue(5,_("High Frequency")); // Create and remember editors. No need to DELETE these as the wxGrid will // do it for us. (The DecRef() that is needed after GetDefaultEditorForType // becomes the duty of the wxGridCellAttr objects after we set them in the grid.) mChoiceEditor = (ChoiceEditor *) mGrid->GetDefaultEditorForType(GRID_VALUE_CHOICE); mTimeEditor = static_cast<NumericEditor*> (mGrid->GetDefaultEditorForType(GRID_VALUE_TIME)); mFrequencyEditor = static_cast<NumericEditor *> (mGrid->GetDefaultEditorForType(GRID_VALUE_FREQUENCY)); // Initialize and set the track name column attributes wxGridCellAttr *attr; mGrid->SetColAttr(Col_Track, (attr = safenew wxGridCellAttr)); attr->SetEditor(mChoiceEditor); mTrackNames.Add(_("New...")); // Initialize and set the time column attributes mGrid->SetColAttr(Col_Stime, (attr = safenew wxGridCellAttr)); // Don't need DecRef() after this GetDefaultRendererForType. attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_TIME)); attr->SetEditor(mTimeEditor); attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER); mGrid->SetColAttr(Col_Etime, attr->Clone()); // Initialize and set the frequency column attributes mGrid->SetColAttr(Col_Lfreq, (attr = safenew wxGridCellAttr)); // Don't need DecRef() after this GetDefaultRendererForType. attr->SetRenderer(mGrid->GetDefaultRendererForType(GRID_VALUE_FREQUENCY)); attr->SetEditor(mFrequencyEditor); attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER); mGrid->SetColAttr(Col_Hfreq, attr->Clone()); // Seems there's a bug in wxGrid. Adding only 1 row does not // allow SetCellSize() to work properly and you will not get // the expected 1 row by 4 column cell. // // So, we set the minimum row height to 0 and basically hide // the extra row by setting its height to 0. And not allowing the // rows to be manually resized prevents the user from ever seeing // the extra row. mGrid->SetRowMinimalAcceptableHeight(0); mGrid->EnableDragRowSize(false); // Locate all labels in current track list FindAllLabels(); // Populate the grid TransferDataToWindow(); // Resize the label name column and ensure it doesn't go below an // arbitrary width. // // This should not be in TransferDataToWindow() since a user might // resize the column and we'd resize it back to the minimum. mGrid->AutoSizeColumn(Col_Label, false ); mGrid->SetColSize(Col_Label, wxMax(150, mGrid->GetColSize(Col_Label))); mGrid->SetColMinimalWidth(Col_Label, mGrid->GetColSize(Col_Label)); // Layout the works Layout(); // Resize width based on width of columns and the vertical scrollbar wxRect r = mGrid->GetGridColLabelWindow()->GetRect(); wxScrollBar sb(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); r.width += sb.GetSize().GetWidth() + 6; SetClientSize(r.width, 300); // Make sure it doesn't go below this size r = GetRect(); SetSizeHints(r.GetWidth(), r.GetHeight()); // Center on display Center(); }
PredictModel::CPredictModel::~CPredictModel() { release(); }
MidiFile::~MidiFile() { ALOGV("MidiFile destructor"); release(); }
Problem::CProblem::~CProblem() { release(); }
inline GpuMat::~GpuMat() { release(); }
Renderer::~Renderer() { release(); }