这篇教程C++ vprASSERT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vprASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ vprASSERT函数的具体用法?C++ vprASSERT怎么用?C++ vprASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vprASSERT函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: vprASSERT/** * Callback when display is added to display manager. * @pre Must be in kernel controlling thread. * @note This function can only be called by the display manager * functioning on behalf of a thread the holds the kernel * reconfiguration lock. * This guarantees that we are not rendering currently. * We will most likely be waiting for a render trigger. */void D3dDrawManager::addDisplay(DisplayPtr disp){ vprASSERT(disp != NULL); // Can't add a null display vprDEBUG(vrjDBG_DRAW_MGR, 0) << "========= vrj::D3dDrawManager::addDisplay: " << disp << std::endl << vprDEBUG_FLUSH; // -- Finish Simulator setup std::vector<vrj::Viewport*>::size_type num_vp(disp->getNumViewports()); std::vector<vrj::Viewport*>::size_type i; for ( i = 0 ; i < num_vp ; ++i ) { Viewport* vp = disp->getViewport(i); if (vp->isSimulator()) { jccl::ConfigElementPtr vp_element = vp->getConfigElement(); SimViewport* sim_vp(NULL); sim_vp = dynamic_cast<SimViewport*>(vp); vprASSERT(NULL != sim_vp); sim_vp->setDrawSimInterface(DrawSimInterfacePtr()); // Create the simulator stuff vprASSERT(1 == vp_element->getNum("simulator_plugin") && "You must supply a simulator plugin."); // Create the simulator stuff jccl::ConfigElementPtr sim_element = vp_element->getProperty<jccl::ConfigElementPtr>("simulator_plugin"); vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL) << "D3dDrawManager::addDisplay() creating simulator of type '" << sim_element->getID() << "'/n" << vprDEBUG_FLUSH; DrawSimInterfacePtr new_sim_i( D3dSimInterfaceFactory::instance()->createObject(sim_element->getID()) ); // XXX: Change this to an error once the new simulator loading code is // more robust. -PH (4/13/2003) vprASSERT(NULL != new_sim_i.get() && "Failed to create draw simulator"); sim_vp->setDrawSimInterface(new_sim_i); new_sim_i->initialize(sim_vp); new_sim_i->config(sim_element); } } // -- Create a window for new display // -- Store the window in the wins vector // Create the gl window object. NOTE: The glPipe actually "creates" the opengl window and context later D3dWindow* new_win = new D3dWindow(); new_win->configWindow(disp); // Configure it mNewWins.push_back(new_win); // Add to our local window list //vprASSERT(isValidWindow(new_win)); // Make sure it was added to draw manager}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:69,
示例2: vprASSERT/** * Updates to the sampled data. * * @pre None. * @post Most recent value is copied over to temp area. */void TrackdController::updateData(){ vprASSERT(mTrackdController != NULL && "Make sure that trackd controller has been initialized"); vprASSERT((unsigned)mTrackdController->numButtons() <= mCurButtons.size()); vprASSERT((unsigned)mTrackdController->numValuators() <= mCurValuators.size() ); for (int i=0;i<mTrackdController->numButtons();i++) { mCurButtons[i] = static_cast<DigitalState::State>(mTrackdController->getButton(i)); mCurButtons[i].setTime(); } for (int j=0;j<mTrackdController->numValuators();j++) { mCurValuators[j] = mTrackdController->getValuator(j); mCurValuators[j].setTime(); } addDigitalSample(mCurButtons); swapDigitalBuffers(); addAnalogSample(mCurValuators); swapAnalogBuffers();}
开发者ID:baibaiwei,项目名称:vrjuggler,代码行数:31,
示例3: vprASSERTbool FastrakStandalone::getStationStatus(const vpr::Uint16 station){ vprASSERT(station >= 1 && station <= 4 && "Station index must between 1-4"); std::string data = boost::lexical_cast<std::string>(station) + "/r"; sendCommand(Fastrak::Command::StationStatus, data); std::vector<vpr::Uint8> data_record; try { mSerialPort->read(data_record, 9, mReadTimeout); } catch (vpr::IOException&) { throw vpr::Exception("Failed to get station status.", VPR_LOCATION); } vprASSERT('2' == data_record[0]); vprASSERT('l' == data_record[2]); mStationStatus.resize(4, false); mStationStatus[0] = boost::lexical_cast<bool>(data_record[3]); mStationStatus[1] = boost::lexical_cast<bool>(data_record[4]); mStationStatus[2] = boost::lexical_cast<bool>(data_record[5]); mStationStatus[3] = boost::lexical_cast<bool>(data_record[6]); // Save the number of active stations. mNumActiveStations = std::count(mStationStatus.begin(), mStationStatus.end(), true); // Fastrak uses 1-4 indexes, but in memory we store as 0-3. return mStationStatus[station-1];}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:32,
示例4: vprASSERTvoid ThreadPosix::setFunctor(const vpr::thread_func_t& functor){ vprASSERT(! mRunning && "Thread already running."); vprASSERT(! functor.empty() && "Invalid functor."); mUserThreadFunctor = functor;}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:7,
示例5: vprASSERTbool User::config(jccl::ConfigElementPtr element){ vprASSERT(element.get() != NULL); vprASSERT(element->getID() == "user"); vprDEBUG_BEGIN(vrjDBG_KERNEL, vprDBG_STATE_LVL) << "vjUser::config: Creating a new user/n" << vprDEBUG_FLUSH; // Assign user id mUserId = mNextUserId++; // Setup user name mName = element->getName(); // Initialize the head stuff std::string head_alias = element->getProperty<std::string>("head_position"); mHead.init(head_alias); // Initialize interocular distance mInterocularDist = element->getProperty<float>("interocular_distance"); if(mInterocularDist == 0.0f) { vprDEBUG(vrjDBG_KERNEL,vprDBG_CONFIG_LVL) << clrOutNORM(clrRED, "WARNING:") << "User: " << mName << " has interocular distance is set to 0.0f. This is probably not what you wanted./n" << vprDEBUG_FLUSH; } vprDEBUG(vrjDBG_KERNEL,vprDBG_STATE_LVL) << "id: " << mUserId << " Name:" << mName.c_str() << " head_positon:" << head_alias.c_str() << " interocular_distance:" << mInterocularDist << std::endl << vprDEBUG_FLUSH; return true;}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:33,
示例6: vprASSERTvoid ThreadSGI::setFunctor(const vpr::thread_func_t& functor){ vprASSERT(! mRunning && "Thread already running"); vprASSERT(! functor.empty()); mUserThreadFunctor = functor;}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:7,
示例7: vprASSERT/** * Updates to the sampled data. * * @pre None. * @post Most recent value is copied over to temp area. */void TrackdController::updateData(){ vprASSERT(mTrackdController != NULL && "Make sure that trackd controller has been initialized"); vprASSERT((unsigned)mTrackdController->numButtons() <= mCurButtons.size()); vprASSERT((unsigned)mTrackdController->numValuators() <= mCurValuators.size() ); for (int i=0;i<mTrackdController->numButtons();i++) { mCurButtons[i] = mTrackdController->getButton(i); mCurButtons[i].setTime(); } for (int j=0;j<mTrackdController->numValuators();j++) { // TrackdController doesn't have a sample, so we do // normalization here... float f; this->normalizeMinToMax (mTrackdController->getValuator(j), f); mCurValuators[j] = f; mCurValuators[j].setTime(); } addDigitalSample(mCurButtons); swapDigitalBuffers(); addAnalogSample(mCurValuators); swapAnalogBuffers();}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:34,
示例8: vprASSERT/** * Closes the given display. * * @pre disp is a display we know about. * @post disp has been removed from the list of displays * (notifyDrawMgr == true) && (drawMgr != NULL) && (disp is active) * ==> Draw manager has been told to clode the window for the display */int DisplayManager::closeDisplay(DisplayPtr disp, bool notifyDrawMgr){ vprASSERT(isMemberDisplay(disp)); // Make sure that display actually exists vprDEBUG(vrjDBG_DISP_MGR, vprDBG_STATE_LVL) << "[vrj::DisplayManager::closeDisplay()] Closing display named '" << disp->getName() << "'" << std::endl << vprDEBUG_FLUSH; // Notify the draw manager to get rid of it // Note: if it is not active, then the draw manager doesn't know about it if ((notifyDrawMgr) && (mDrawManager != NULL) && (disp->isActive())) { mDrawManager->removeDisplay(disp); } // Remove it from local data structures size_t num_before_close = mActiveDisplays.size() + mInactiveDisplays.size(); mActiveDisplays.erase( std::remove(mActiveDisplays.begin(), mActiveDisplays.end(), disp), mActiveDisplays.end()); mInactiveDisplays.erase( std::remove(mInactiveDisplays.begin(), mInactiveDisplays.end(), disp), mInactiveDisplays.end()); vprASSERT(num_before_close == (1+mActiveDisplays.size() + mInactiveDisplays.size())); boost::ignore_unused_variable_warning(num_before_close); return 1;}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:34,
示例9: vprASSERTvoid Digital::readObject(vpr::ObjectReader* reader){ //std::cout << "[Remote Input Manager] In Digital read" << std::endl; vprASSERT(reader->attribExists("rim.timestamp.delta")); vpr::Uint64 delta = reader->getAttrib<vpr::Uint64>("rim.timestamp.delta"); // ASSERT if this data is really not Digital Data reader->beginTag(Digital::getInputTypeName()); reader->beginAttribute(gadget::tokens::DataTypeAttrib); vpr::Uint16 temp = reader->readUint16(); reader->endAttribute(); // XXX: Should there be error checking for the case when vprASSERT() // is compiled out? -PH 8/21/2003 vprASSERT(temp==MSG_DATA_DIGITAL && "[Remote Input Manager]Not Digital Data"); boost::ignore_unused_variable_warning(temp); std::vector<DigitalData> dataSample; unsigned numDigitalDatas; vpr::Uint32 value; vpr::Uint64 timeStamp; DigitalData temp_digital_data; reader->beginAttribute(gadget::tokens::SampleBufferLenAttrib); unsigned numVectors = reader->readUint16(); reader->endAttribute(); //std::cout << "Stable Digital Buffer Size: " << numVectors << std::endl; mDigitalSamples.lock(); for ( unsigned i=0;i<numVectors;i++ ) { reader->beginTag(gadget::tokens::BufferSampleTag); reader->beginAttribute(gadget::tokens::BufferSampleLenAttrib); numDigitalDatas = reader->readUint16(); reader->endAttribute(); dataSample.clear(); for ( unsigned j=0;j<numDigitalDatas;j++ ) { reader->beginTag(gadget::tokens::DigitalValue); reader->beginAttribute(gadget::tokens::TimeStamp); timeStamp = reader->readUint64(); // read Time Stamp vpr::Uint64 reader->endAttribute(); value = reader->readUint32(); // read Digital Data(int) reader->endTag(); temp_digital_data.setDigital(value); temp_digital_data.setTime(vpr::Interval(timeStamp + delta,vpr::Interval::Usec)); dataSample.push_back(temp_digital_data); } mDigitalSamples.addSample(dataSample); reader->endTag(); } mDigitalSamples.unlock(); mDigitalSamples.swapBuffers(); reader->endTag();}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:59,
示例10: vprASSERT// Look for items in the active list that don't have their dependencies filled// anymore.//// POST: Any elements in active with dependencies not filled are added to the// the pending list. (A remove and an add are added to the pending).// RETURNS: The number of lost dependencies found.int ConfigManager::scanForLostDependencies(){ vprASSERT(0 == mActiveLock.test()); // We can't hold the lock upon entry vpr::DebugOutputGuard og(vprDBG_ALL, vprDBG_CONFIG_LVL, "ConfigManager::scanForLostDependencies()/n", "ConfigManager::scanForLostDependencies() done./n"); DependencyManager* dep_mgr = DependencyManager::instance(); std::vector<ConfigElementPtr> elements; int num_lost_deps(0); // NOTE: can't hold this lock because the isSatisfied routines make // use of the activeLock as well // NOTE: Make the copy of the elements so that we can iterate without // fear of active changing mActiveLock.acquire(); elements = mActiveConfig.vec(); // Get a copy of the elements mActiveLock.release(); // Now test them for ( unsigned int i=0;i<elements.size();i++ ) { if ( !dep_mgr->isSatisfied(elements[i]) ) // We are not satisfied { vprDEBUG_NEXT(vprDBG_ALL, vprDBG_WARNING_LVL) << elements[i]->getName() << " type: " << elements[i]->getID() << " has lost dependencies./n" << vprDEBUG_FLUSH; num_lost_deps++; // Keep a count of the number lost deps found // Add the pending removal PendingElement pending; pending.mType = PendingElement::REMOVE; pending.mElement = elements[i]; vprASSERT(1 == mPendingLock.test()); addPending(pending); // Add the pending re-addition// ConfigElementPtr copy_of_element; // Need a copy so that the remove can delete the element// copy_of_element = new ConfigElement(*elements[i]); pending.mType = PendingElement::ADD; pending.mElement = elements[i];//copy_of_element; vprASSERT(1 == mPendingLock.test()); addPending(pending); // Add the add item } } return num_lost_deps;}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:60,
示例11: vprASSERTvoid GlWindow::setViewport(float xo, float yo, float xSize, float ySize){ vprASSERT( ((xo+xSize) <= 1.0f) && "X viewport sizes are out of range"); vprASSERT( ((yo+ySize) <= 1.0f) && "Y viewport sizes are out of range"); unsigned ll_x = unsigned(xo * float(mWindowWidth)); unsigned ll_y = unsigned(yo * float(mWindowHeight)); unsigned x_size = unsigned(xSize * float(mWindowWidth)); unsigned y_size = unsigned(ySize * float(mWindowHeight)); glViewport(ll_x, ll_y, x_size, y_size);}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:12,
示例12: vprASSERT /** * Updates to the sampled data. * * @pre None. * @post Most recent value is copied over to temp area */ void TrackdSensor::updateData() { vprASSERT(mTrackdSensors != NULL && "Make sure that trackd sensors has been initialized"); vprASSERT((unsigned)mTrackdSensors->numSensors() <= mCurSensorValues.size()); for(int i=0;i<mTrackdSensors->numSensors();i++) { mCurSensorValues[i].mPosData = mTrackdSensors->getSensorPos(i); mCurSensorValues[i].setTime(); } // Update the data buffer addPositionSample(mCurSensorValues); swapPositionBuffers(); }
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:21,
示例13: vprASSERTBOOL ExtensionLoaderWGL::wglQueryMaxSwapGroupsNV(HDC hdc, GLuint* maxGroups, GLuint* maxBarriers){ vprASSERT(mWglFuncs->wglQueryMaxSwapGroupsNV != NULL && "Attemped to call unsupported extension."); return mWglFuncs->wglQueryMaxSwapGroupsNV(hdc, maxGroups, maxBarriers);}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:7,
示例14: vprThreadFunctorFunctionunsigned __stdcall vprThreadFunctorFunction(void* arg){ vpr::thread_func_t& func = *((vpr::thread_func_t*) arg); vprASSERT(! func.empty()); func(); return 0;}
开发者ID:carlsonp,项目名称:vrjuggler,代码行数:7,
示例15: vprThreadPriorityToPOSIX// Set this thread's priority.void ThreadPosix::setPrio(VPRThreadPriority prio){#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING sched_param_t sched_param; sched_param.sched_priority = vprThreadPriorityToPOSIX(prio); const int result = pthread_setschedparam(mThread, SCHED_RR, &sched_param); if ( EINVAL == result || ENOTSUP == result ) { std::ostringstream msg_stream; msg_stream << "Invalid priority value " << sched_param.sched_priority; throw vpr::IllegalArgumentException(msg_stream.str(), VPR_LOCATION); } else if ( ESRCH == result ) { throw vpr::IllegalArgumentException( "Cannot set priority for invalid thread", VPR_LOCATION ); } vprASSERT(result == 0);#else boost::ignore_unused_variable_warning(prio); std::cerr << "vpr::ThreadPosix::setPrio(): Not supported/n";#endif}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:28,
示例16: pthread_joinvoid ThreadPosix::join(void** status){ const int result = pthread_join(mThread, status); if ( EINVAL == result ) { throw vpr::IllegalArgumentException("Cannot join an unjoinable thread", VPR_LOCATION); } else if ( ESRCH == result ) { throw vpr::IllegalArgumentException("Cannot join an invalid thread", VPR_LOCATION); } else if ( EDEADLK == result ) { throw vpr::DeadlockException("Deadlock detected when joining thread", VPR_LOCATION); } vprASSERT(result == 0); if ( mCaughtException ) { throw mException; }}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:27,
示例17: pthread_getschedparam// Get this thread's priority.BaseThread::VPRThreadPriority ThreadPosix::getPrio() const{#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING int policy; sched_param_t fifo_sched_param; const int result = pthread_getschedparam(mThread, &policy, &fifo_sched_param); if ( ESRCH == result ) { throw vpr::IllegalArgumentException( "Cannot query priority for invalid thread", VPR_LOCATION ); } vprASSERT(result == 0); return posixThreadPriorityToVPR(fifo_sched_param.sched_priority);#else std::cerr << "vpr::ThreadPosix::getPrio(): Not supported/n"; return VPR_PRIORITY_NORMAL;#endif}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:26,
示例18: vprDEBUGbool DataGloveUltraWireless::config(jccl::ConfigElementPtr e){ vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL) << "*** DataGloveUltraWireless::config() ***" << std::endl << vprDEBUG_FLUSH; if(! (Input::config(e) && Analog::config(e) && Command::config(e) ) ) { return false; } mPortName = e->getProperty<std::string>("port"); mBaudRate = e->getProperty<int>("baud"); mPortAEnabled = e->getProperty<bool>("port_a_enabled"); mPortBEnabled = e->getProperty<bool>("port_b_enabled"); mGlove.setGestureThresholds( e->getProperty<float>("gesture_upper_threshold"), e->getProperty<float>("gesture_lower_threshold") ); mGlove.setAutoRangeReset( e->getProperty<bool>("auto_range_reset") ); vprASSERT(mThread == NULL); // This should have been set by Input(c) return true;}
开发者ID:Michael-Lfx,项目名称:vrjuggler,代码行数:25,
示例19: vprASSERTRegistryEntryPtrRegistry::findNewestVersionEntry(const std::string& moduleName) const{ vprASSERT(moduleName.find(plugin::Info::getSeparator()) == std::string::npos); std::priority_queue< RegistryEntryPtr, std::vector<RegistryEntryPtr>, is_version_less<RegistryEntry> > queue; typedef registry_type::const_iterator iter_type; for ( iter_type i = mRegistry.begin(); i != mRegistry.end(); ++i ) { if ( boost::algorithm::starts_with((*i).first, moduleName) ) { queue.push((*i).second); } } RegistryEntryPtr entry; if ( ! queue.empty() ) { entry = queue.top(); } return entry;}
开发者ID:patrickhartling,项目名称:vrkit,代码行数:28,
示例20: vprDEBUGbool InputWindowXWin::startSampling(){ if (mThread != NULL) { vprDEBUG(vprDBG_ERROR,vprDBG_CRITICAL_LVL) << clrOutNORM(clrRED,"ERROR") << ": gadget::InputWindowXWin: startSampling called, when already sampling./n" << vprDEBUG_FLUSH; vprASSERT(false); } bool started(false); mExitFlag = false; // Create a new thread to handle the control try { mThread = new vpr::Thread(boost::bind(&InputWindowXWin::controlLoop, this)); started = true; } catch (vpr::Exception& ex) { vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL) << clrOutBOLD(clrRED, "ERROR") << ": Failed to spawn thread for X11 input window driver!/n" << vprDEBUG_FLUSH; vprDEBUG_NEXT(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL) << ex.what() << std::endl << vprDEBUG_FLUSH; } return started;}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:33,
示例21: sem_closeSemaphorePosix::~SemaphorePosix(){ // ---- Delete the semaphore --- //#ifdef VPR_USE_NAMED_SEMAPHORE const int result = sem_close(mSema); vprASSERT(result == 0); sem_unlink(mSemaFile); std::free(mSemaFile);#else const int result = sem_destroy(mSema); vprASSERT(result == 0); std::free(mSema);#endif}
开发者ID:rpavlik,项目名称:vrjuggler-2.2-debs,代码行数:16,
注:本文中的vprASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vprDEBUG函数代码示例 C++ vpn_progress函数代码示例 |