void C_vector_any::_PushBack(const void *val){ if(used_size == res_size){ res_size = Max(1ul, res_size+grow_size); byte *new_a = new(true) byte[res_size*elem_size]; MemCpy(new_a, array, used_size*elem_size); delete[] array; array = new_a; } void *ptr = _End(); _Construct(ptr); _Copy(ptr, val); ++used_size; }
void C_vector_any::_Resize(dword n, const void *val){ if(n<used_size){ byte *ptr = (byte*)_End(); for(int i=used_size-n; i--; ){ ptr -= elem_size; _Destruct(ptr); } used_size = n; }else{ _Reserve(n); while(used_size<n) _PushBack(val); } }
void CFlowEntropyViewerWin::_SetTransferFunc(const void *pTf, GLenum eType, GLenum eFormat, int iNrOfTfEntries) { _Begin(); // upload the transfer func. as a 1D texture glActiveTexture(GL_TEXTURE0 + 1); if( !t1dTf ) glGenTextures(1, &t1dTf); glBindTexture(GL_TEXTURE_1D, t1dTf); glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA32F_ARB, iNrOfTfEntries, 0, eType, eFormat, pTf); _End(); }
/** * Called when the command has been removed. * This will call {@link Command#interrupted() interrupted()} or {@link Command#end() end()}. */ void Command::Removed() { if (m_initialized) { if (IsCanceled()) { Interrupted(); _Interrupted(); } else { End(); _End(); } } m_initialized = false; m_canceled = false; m_running = false; if (m_table != NULL) m_table->PutBoolean(kRunning, false); }
void CommandGroup::_Interrupted() { _End(); }
void CTfUi::_PlotSpline(int c, bool bEnhance) { _Begin(); switch(c) { case 0: glColor4f(1.0, 0.0f, 0.0f, 1.0f); break; case 1: glColor4f(0.0, 1.0f, 0.0f, 1.0f); break; case 2: glColor4f(0.0, 0.0f, 1.0f, 1.0f); break; case 3: glColor4f(0.3, 0.3f, 0.3f, 1.0f); break; } glPushAttrib(GL_LINE_BIT); if( true == bEnhance ) glLineWidth(3.0f); glBegin(GL_LINE_STRIP); for(list<CKnot>::iterator viKnot = pcTransFunc->plSplines[c].begin(); viKnot != pcTransFunc->plSplines[c].end(); viKnot++) glVertex2f(viKnot->fX, viKnot->fY); glEnd(); glPopAttrib(); // glPushAttrib(GL_LINE_BIT); if( false == bEnhance ) return; glPushAttrib(GL_POINT_BIT); // plot the selected knots glPointSize(8.0); glBegin(GL_POINTS); for(vector<list<CKnot>::iterator>::iterator viliKnot = pviSelectedKnots[c].begin(); viliKnot != pviSelectedKnots[c].end(); viliKnot++) { list<CKnot>::iterator liKnot = *viliKnot; glVertex2f(liKnot->fX, liKnot->fY); } glEnd(); // plot the selected knots glPointSize(6.0); glPushAttrib(GL_CURRENT_BIT); glColor4f(0.0f, 0.0f, 0.0f, 1.0f); glBegin(GL_POINTS); for(vector<list<CKnot>::iterator>::iterator viliKnot = pviSelectedKnots[c].begin(); viliKnot != pviSelectedKnots[c].end(); viliKnot++) { list<CKnot>::iterator liKnot = *viliKnot; glVertex2f(liKnot->fX, liKnot->fY); } glEnd(); glPopAttrib(); // glPushAttrib(GL_CURRENT_BIT); // plot the knots glPointSize(4.0); glBegin(GL_POINTS); for(list<CKnot>::iterator viKnot = pcTransFunc->plSplines[c].begin(); viKnot != pcTransFunc->plSplines[c].end(); viKnot++) glVertex2f(viKnot->fX, viKnot->fY); glEnd(); glPopAttrib(); // glPushAttrib(GL_POINT_BIT); _End(); }
void PIDCommand::_Interrupted() { _End(); }
void Autonomous::Cancel(){ std::cout << "Autonomous::Cancel"<<std::endl; _End(); CommandGroup::Cancel(); Robot::drivetrain->EndTravel(); }
void Autonomous::Interrupted() { std::cout << "Autonomous::Interruped"<<std::endl; _End(); }
void C_vector_any::_PopBack(){ assert(used_size); --used_size; _Destruct(_End()); }