Relationship::Relationship(Distribution *d, Guideline *g1, Guideline *g2, bool no_undo) { commonInit(); relType = REL_Distr; assert(g1); assert(g2); distro = d; guide = g1; guide2 = g2; activate(no_undo); }
MBlockChunk::MBlockChunk(const CkArrayID &threads_) { commonInit(); threads=threads_; migInit(); update.nRecd = 0; update.wait_seqnum = -1; messages = CmmNew(); thread->semaPut(MBLOCK_TCHARM_SEMAID,this); }
RawKeyword::RawKeyword(const std::string& name , const std::string& filename, size_t lineNR , size_t inputSize, bool isTableCollection ) { commonInit(name,filename,lineNR); if (isTableCollection) { m_sizeType = Raw::TABLE_COLLECTION; m_numTables = inputSize; } else { m_sizeType = Raw::FIXED; m_fixedSize = inputSize; if (m_fixedSize == 0) m_isFinished = true; else m_isFinished = false; } }
RFunction(const std::string& name, const Param1Type& param1, const Param2Type& param2, const Param3Type& param3, const Param4Type& param4, const Param5Type& param5) : functionSEXP_(R_UnboundValue) { commonInit(name); addParam(param1); addParam(param2); addParam(param3); addParam(param4); addParam(param5); }
void outStream_initCommand(PacketOutputStream *stream, jint id, jbyte flags, jbyte commandSet, jbyte command) { commonInit(stream); /* * Command-specific initialization */ stream->packet.type.cmd.id = id; stream->packet.type.cmd.cmdSet = commandSet; stream->packet.type.cmd.cmd = command; stream->packet.type.cmd.flags = flags; }
void pixyInit(void) #endif { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); #ifdef KEIL IPC_haltSlave(); #endif // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // start slave #ifdef KEIL if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } #else cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); #endif // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpUsb->setRecvTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); }
RKEditorDataFrame::RKEditorDataFrame (RContainerObject* object, QWidget *parent) : TwinTable (parent) { RK_TRACE (EDITOR); commonInit (); RK_ASSERT (!object->isPending ()); RKEditor::object = object; RK_ASSERT (object->isDataFrame ()); setGlobalContextProperty ("current_object", object->getFullName()); RKVarEditDataFrameModel* model = new RKVarEditDataFrameModel (object, this); initTable (model, object); connect (model, SIGNAL (modelObjectDestroyed()), this, SLOT (detachModel())); waitForLoad (); }
RKCaughtX11Window::RKCaughtX11Window (RKGraphicsDevice* rkward_device, int device_number) : RKMDIWindow (0, X11Window) { RK_TRACE (MISC); commonInit (device_number); rk_native_device = rkward_device; xembed_container->setFixedSize (rk_native_device->viewPort ()->size ()); resize (xembed_container->size ()); rk_native_device->viewPort ()->setParent (xembed_container); connect (rkward_device, SIGNAL (captionChanged(QString)), this, SLOT (setCaption(QString))); connect (rkward_device, SIGNAL (goingInteractive(bool,QString)), this, SLOT (deviceInteractive(bool,QString))); stop_interaction->setVisible (true); stop_interaction->setEnabled (false); setCaption (rkward_device->viewPort ()->windowTitle ()); QTimer::singleShot (0, this, SLOT (doEmbed())); }
int main(int argc, char **argv) { new QApplication(argc, argv); commonInit(); progname = argv[0]; if(argc >= 2) { for(int i = 0; modules[i].name != NULL; i++) { if(!strcasecmp(argv[1], modules[i].name)) { return modules[i].main(argc - 1, &argv[1]); } } } return usage(); }
UserPrompt(int type, const std::string& caption, const std::string& message, const std::string& yesLabel, const std::string& noLabel, bool includeCancel, bool yesIsDefault) { commonInit(type, caption, message, yesLabel, noLabel, includeCancel, yesIsDefault); }
ParserKeyword::ParserKeyword(const Json::JsonObject& jsonConfig) { if (jsonConfig.has_item("name")) { ParserKeywordSizeEnum sizeType = UNKNOWN; commonInit(jsonConfig.get_string("name"), sizeType); } else throw std::invalid_argument("Json object is missing the 'name' property"); if (jsonConfig.has_item("deck_names") || jsonConfig.has_item("deck_name_regex") ) // if either the deck names or the regular expression for deck names are // explicitly specified, we do not implicitly add the contents of the 'name' // item to the deck names... clearDeckNames(); initSize(jsonConfig); initDeckNames(jsonConfig); initSectionNames(jsonConfig); initMatchRegex(jsonConfig); if (jsonConfig.has_item("items") && jsonConfig.has_item("records")) throw std::invalid_argument("Fatal error in " + getName() + " configuration. Can NOT have both records: and items:"); if (jsonConfig.has_item("items")) { const Json::JsonObject itemsConfig = jsonConfig.get_item("items"); addItems(itemsConfig); } if (jsonConfig.has_item("records")) { const Json::JsonObject recordsConfig = jsonConfig.get_item("records"); if (recordsConfig.is_array()) { size_t num_records = recordsConfig.size(); for (size_t i = 0; i < num_records; i++) { const Json::JsonObject itemsConfig = recordsConfig.get_array_item(i); addItems(itemsConfig); } } else throw std::invalid_argument("The records item must point to an array item"); } if (jsonConfig.has_item("data")) initData(jsonConfig); if (jsonConfig.has_item("description")) { m_Description = jsonConfig.get_string("description"); } }
/** \fn ctor \brief this one is used when converting a type 1 avi to type 2 */ aviIndexOdml::aviIndexOdml(aviWrite *father,aviIndexAvi *cousin ) : aviIndexBase(father,cousin->_masterList,cousin->odmlChunkPosition) { commonInit(); ADM_info("Creating Odml file from avi/type1... \n"); LMovie = cousin->LMovie; // steal movie from cousin cousin->LMovie=NULL; nbVideoFrame=cousin->nbVideoFrame; for(int i=0;i<ADM_AVI_MAX_AUDIO_TRACK;i++) audioFrameCount[i]=cousin->audioFrameCount[i]; // Convert cousin's index int n=cousin->myIndex.size(); bool done[1+ADM_AVI_MAX_AUDIO_TRACK]; for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) { indexes[j].indexPosition=cousin->placeHolder[j]; } for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) { uint32_t trackFcc=superIndex.trackIndeces[j].fcc; for(int i=0;i<n;i++) { IdxEntry trx=cousin->myIndex[i]; // if(trx.fcc==trackFcc) { odmIndexEntry ix; ix.flags=trx.flags; ix.offset=trx.offset; ix.size=trx.len; indexes[j].listOfChunks.push_back(ix); convertIndex(indexes+j,j); } } } // cousin->myIndex.clear(); // empty cousin index for(int j=0;j<ADM_AVI_MAX_AUDIO_TRACK+1;j++) printf("Track %d, found %d entries\n",j,(int)indexes[j].listOfChunks.size()); startNewRiff(); }
Evolvable :: Evolvable(int numChr, int sizeD, int sizeB, int sizeI, int sizeC, const double& loBound, const double& hiBound, Chromosome* extraModifier, long& setSeed, const pStr& thePars) { Btrue = elem(thePars.intGlob,"NUM_INPUTS"); numChromosomes_ = numChr; boolStart_ = sizeD; intStart_ = boolStart_ + sizeB; charStart_ = intStart_ + sizeI; sizeChromosome_ = charStart_ + sizeC; currentSelection_ = 0; myChromosomes_.resize(numChr); for (int i = 0; i < numChr; ++i) { myChromosomes_[i] = new Chromosome(sizeD, sizeB, sizeI, sizeC, loBound, hiBound, setSeed, thePars); }; commonInit(extraModifier, thePars); };
Evolvable :: Evolvable(int numChr, int sizeD, int sizeB, int sizeI, int sizeC, const std::vector<double>& range, Chromosome* extraModifier, long& setSeed, const pStr& thePars) { Btrue = elem(thePars.intGlob,"NUM_INPUTS"); numChromosomes_ = numChr; boolStart_ = sizeD; intStart_ = boolStart_ + sizeB; charStart_ = intStart_ + sizeI; sizeChromosome_ = charStart_ + sizeC; currentSelection_ = 0; myChromosomes_.resize(numChr); for (int i = 0; i < numChr; ++i) { myChromosomes_[i] = new Chromosome(sizeD, sizeB, sizeI, sizeC, range, setSeed, thePars); // cout << "i = " << i << " " << sizeD << " " << sizeB << " " << sizeI << " " << sizeC << endl; }; commonInit(extraModifier, thePars); };
RKEditorDataFrame::RKEditorDataFrame (const QString& new_object_name, QWidget* parent) : TwinTable (parent) { RK_TRACE (EDITOR); commonInit (); QString valid = RObjectList::getGlobalEnv ()->validizeName (new_object_name); if (valid != new_object_name) KMessageBox::sorry (this, i18n ("The name you specified was already in use or not valid. Renamed to %1", valid), i18n ("Invalid Name")); RKVarEditDataFrameModel* model = new RKVarEditDataFrameModel (valid, RObjectList::getGlobalEnv (), open_chain, 5, this); RKEditor::object = model->getObject (); RK_ASSERT (object->isDataFrame ()); setGlobalContextProperty ("current_object", object->getFullName()); initTable (model, object); connect (model, SIGNAL (modelObjectDestroyed()), this, SLOT (deleteLater())); RKGlobals::rInterface ()->closeChain (open_chain); }
//void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) void pixyInit(void) { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); /* IPC_startSlave(); */ // start slave /* if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); } */ // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // run M0 cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); if (prm_init(g_chirpUsb)<0) // error, let user know (don't just continue like nothing's happened) showError(1, 0x0000ff, "Flash is corrupt, parameters have been lost\n"); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
void MetavoxelServer::run() { commonInit(METAVOXEL_SERVER_LOGGING_NAME, NodeType::MetavoxelServer); NodeList* nodeList = NodeList::getInstance(); nodeList->addNodeTypeToInterestSet(NodeType::Agent); connect(nodeList, &NodeList::nodeAdded, this, &MetavoxelServer::maybeAttachSession); connect(nodeList, &NodeList::nodeKilled, this, &MetavoxelServer::maybeDeleteSession); // initialize Bitstream before using it in multiple threads Bitstream::preThreadingInit(); // create the senders, each with its own thread int threadCount = QThread::idealThreadCount(); if (threadCount == -1) { const int DEFAULT_THREAD_COUNT = 4; threadCount = DEFAULT_THREAD_COUNT; } qDebug() << "Creating" << threadCount << "sender threads"; for (int i = 0; i < threadCount; i++) { QThread* thread = new QThread(this); MetavoxelSender* sender = new MetavoxelSender(this); sender->moveToThread(thread); connect(thread, &QThread::finished, sender, &QObject::deleteLater); thread->start(); QMetaObject::invokeMethod(sender, "start"); _senders.append(sender); } // create the persister and start it in its own thread _persister = new MetavoxelPersister(this); QThread* persistenceThread = new QThread(this); _persister->moveToThread(persistenceThread); connect(persistenceThread, &QThread::finished, _persister, &QObject::deleteLater); persistenceThread->start(); // queue up the load QMetaObject::invokeMethod(_persister, "load"); }
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { // write stack guard word STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // start slave if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... SMLink *smLink = new SMLink; g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
//------------ST7735_InitR------------ // Initialization for ST7735R screens (green or red tabs). // Input: option one of the enumerated options depending on tabs // Output: none void ST7735_InitR(enum initRFlags option) { commonInit(Rcmd1); if(option == INITR_GREENTAB) { commandList(Rcmd2green); ColStart = 2; RowStart = 1; } else { // colstart, rowstart left at default '0' values commandList(Rcmd2red); } commandList(Rcmd3); // if black, change MADCTL color filter if (option == INITR_BLACKTAB) { writecommand(ST7735_MADCTL); writedata(0xC0); } TabColor = option; ST7735_SetCursor(0,0); StTextColor = ST7735_YELLOW; ST7735_FillScreen(0); // set screen to black }
void MetavoxelServer::run() { commonInit(METAVOXEL_SERVER_LOGGING_NAME, NodeType::MetavoxelServer); NodeList* nodeList = NodeList::getInstance(); nodeList->addNodeTypeToInterestSet(NodeType::Agent); connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), SLOT(maybeAttachSession(const SharedNodePointer&))); _lastSend = QDateTime::currentMSecsSinceEpoch(); _sendTimer.start(SEND_INTERVAL); // initialize Bitstream before using it in multiple threads Bitstream::preThreadingInit(); // create the persister and start it in its own thread _persister = new MetavoxelPersister(this); QThread* persistenceThread = new QThread(this); _persister->moveToThread(persistenceThread); persistenceThread->start(); // queue up the load QMetaObject::invokeMethod(_persister, "load"); }
void Adafruit_ST7789::init(uint16_t width, uint16_t height, uint8_t mode) { // Save SPI data mode. commonInit() calls begin() (in Adafruit_ST77xx.cpp), // which in turn calls initSPI() (in Adafruit_SPITFT.cpp), passing it the // value of spiMode. It's done this way because begin() really should not // be modified at this point to accept an SPI mode -- it's a virtual // function required in every Adafruit_SPITFT subclass and would require // updating EVERY such library...whereas, at the moment, we know that // certain ST7789 displays are the only thing that may need a non-default // SPI mode, hence this roundabout approach... spiMode = mode; // (Might get added similarly to other display types as needed on a // case-by-case basis.) commonInit(NULL); _colstart = ST7789_240x240_XSTART; _rowstart = ST7789_240x240_YSTART; _width = width; _height = height; displayInit(cmd_240x240); setRotation(0); }
void initForApplication(const std::string& dir) { commonInit(dir); }
int main(int argc, char **argv) { const char *progname = argv[0]; commonInit(); if(argc < 2) return usage(progname); if(!strcmp(argv[1], "optim")) { double cStart = -5., cStop = 15., cStep = 2.; double gStart = -15., gStop = 3., gStep = 2.; argc -= 1; argv = &argv[1]; while(1) { int opt = getopt(argc, argv, "c:g:"); if(opt == -1) break; if(opt != 'c' && opt != 'g') return usage(progname); QStringList sl = QString(optarg).split(","); if(sl.count() != 3) { fprintf(stderr, "-c and -g options require a list of three numbers: start, stop and step\n"); return 1; } bool ok1 = false, ok2 = false, ok3 = false; double optStart = sl.at(0).toDouble(&ok1); double optStop = sl.at(1).toDouble(&ok2); double optStep = sl.at(2).toDouble(&ok3); if(!ok1 || !ok2 || !ok3) { fprintf(stderr, "invalid numbers passed to -c or -g arguments\n"); return 1; } if(opt == 'c') { cStart = optStart; cStop = optStop; cStep = optStep; } else if(opt == 'g') { gStart = optStart; gStop = optStop; gStep = optStep; } } if(argc - optind != 4) return usage(progname); WindowFile trainA(argv[optind]); if(!trainA.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind]); return 1; } WindowFile trainB(argv[optind+1]); if(!trainB.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+1]); return 1; } WindowFile crossA(argv[optind+2]); if(!crossA.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+2]); return 1; } WindowFile crossB(argv[optind+3]); if(!crossB.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[optind+3]); return 1; } cmd_optim(trainA, trainB, crossA, crossB, cStart, cStop, cStep, gStart, gStop, gStep); trainA.close(); trainB.close(); crossA.close(); crossB.close(); } else if(!strcmp(argv[1], "train")) { if(argc != 7) return usage(progname); char *modelfile = argv[2]; bool ok1 = false, ok2 = false; double cParam = QString(argv[3]).toDouble(&ok1); double gParam = QString(argv[4]).toDouble(&ok2); if(!ok1 || !ok2) { fprintf(stderr, "invalid number passed as 'c' or 'g' parameter\n"); return 1; } WindowFile trainA(argv[5]); if(!trainA.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[5]); return 1; } WindowFile trainB(argv[6]); if(!trainB.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[6]); return 1; } cmd_train(modelfile, cParam, gParam, trainA, trainB); trainA.close(); trainB.close(); } else if(!strcmp(argv[1], "cross")) { if(argc != 7) return usage(progname); bool ok1 = false, ok2 = false, ok3 = false; int nFold = QString(argv[2]).toInt(&ok1); double cParam = QString(argv[3]).toDouble(&ok2); double gParam = QString(argv[4]).toDouble(&ok3); if(!ok1 || !ok2 || !ok3) { fprintf(stderr, "invalid number passed as n-fold or 'c' or 'g' parameter\n"); return 1; } WindowFile trainA(argv[5]); if(!trainA.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[5]); return 1; } WindowFile trainB(argv[6]); if(!trainB.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[6]); return 1; } cmd_cross(nFold, cParam, gParam, trainA, trainB); trainA.close(); trainB.close(); } else if(!strcmp(argv[1], "test")) { if(argc != 5) return usage(progname); svm_model *model = svm_load_model(argv[3]); if(model == NULL) { fprintf(stderr, "can't open model file '%s' for reading\n", argv[3]); return 1; } WindowFile testFile(argv[4]); if(!testFile.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[4]); return 1; } if(!strcmp(argv[2], "count")) cmd_test_count(model, testFile); else if(!strcmp(argv[2], "list")) cmd_test_list(model, testFile); else return usage(progname); svm_free_and_destroy_model(&model); testFile.close(); } else if(!strcmp(argv[1], "roc")) { if(argc != 5) return usage(progname); svm_model *model = svm_load_model(argv[2]); if(model == NULL) { fprintf(stderr, "can't open model file '%s' for reading\n", argv[2]); return 1; } WindowFile testA(argv[3]); if(!testA.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[3]); return 1; } WindowFile testB(argv[4]); if(!testB.open(QIODevice::ReadOnly)) { fprintf(stderr, "can't open feature file '%s' for reading\n", argv[4]); return 1; } cmd_roc(model, testA, testB); testA.close(); testB.close(); } else return usage(progname); return 0; }
MapGrid::MapGrid(unsigned int size_x, unsigned int size_y, double s, double x, double y) : size_x_(size_x), size_y_(size_y), scale(s), origin_x(x), origin_y(y) { commonInit(); }
explicit RFunction(const std::string& name) : functionSEXP_(R_UnboundValue) { commonInit(name); }
MapGrid::MapGrid(unsigned int size_x, unsigned int size_y) : size_x_(size_x), size_y_(size_y) { commonInit(); }
//Begin function void OLED_SSD1331::begin(void) { commonInit(); if (_inited) chipInit(); }
RFunction(const std::string& name, const ParamType& param) : functionSEXP_(R_UnboundValue) { commonInit(name); addParam(param); }
SWMgr::SWMgr(SWFilterMgr *filterMgr, bool multiMod) { commonInit(0, 0, true, filterMgr, multiMod); }
SWMgr::SWMgr(SWConfig *iconfig, SWConfig *isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod) { commonInit(iconfig, isysconfig, autoload, filterMgr, multiMod); }