当前位置: 首页>>代码示例>>C++>>正文


C++ LKASSERT函数代码示例

本文整理汇总了C++中LKASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ LKASSERT函数的具体用法?C++ LKASSERT怎么用?C++ LKASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LKASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LKASSERT

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// Checks minimum and maximum waypoint count limits.
///
/// @param decl         task declaration data
/// @param minCount     minimum WP count
/// @param maxCount     maximum WP count
/// @param errBufSize   error message buffer size
/// @param errBuf[]     [out] error message
///
/// @retval true  WP count is in limits
/// @retval false WP count is outside limits (description in @p errBuf)
///
//static
bool DevBase::CheckWPCount(const Declaration_t& decl,
  int minCount, int maxCount, unsigned errBufSize, TCHAR errBuf[])
{
  // Must have at least two, max 12 waypoints
  if (decl.num_waypoints < minCount)
  {
    #if BUGSTOP
    LKASSERT(errBuf!=NULL);
    #endif
    if (errBuf==NULL) return(false);
    // LKTOKEN  [email protected]_ = "Not enough waypoints!"
    _sntprintf(errBuf, errBufSize, _T("%s"), gettext(_T("[email protected]_")));
    return(false);
  }

  if (decl.num_waypoints > maxCount)
  {
    #if BUGSTOP
    LKASSERT(errBuf!=NULL);
    #endif
    if (errBuf==NULL) return(false);
    // LKTOKEN  [email protected]_ = "Too many waypoints!"
    _sntprintf(errBuf, errBufSize, _T("%s"), gettext(_T("[email protected]_")));
    return(false);
  }

  return(true);
} // CheckWPCount()
开发者ID:PhilColbert,项目名称:LK8000,代码行数:41,代码来源:devBase.cpp

示例2: dlgAirspaceShowModal

bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  wf = dlgLoadFromXML(CallBackTable, 
                        ScreenLandscape ? TEXT("dlgAirspace_L.xml") : TEXT("dlgAirspace_P.xml"), 
                        ScreenLandscape ? IDR_XML_AIRSPACE_L : IDR_XML_AIRSPACE_P);
  if (!wf) return false;

  wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  LKASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  wAirspaceListEntry = (WndOwnerDrawFrame*)wf->
  FindByName(TEXT("frmAirspaceListEntry"));
  LKASSERT(wAirspaceListEntry!=NULL);
  wAirspaceListEntry->SetCanFocus(true);

  UpdateList();

  changed = false;

  wf->ShowModal();


  delete wf;

  wf = NULL;

  return changed;
}
开发者ID:PhilColbert,项目名称:LK8000,代码行数:34,代码来源:dlgAirspace.cpp

示例3: LKASSERT

void CSTScreenBuffer::Create(int nWidth, int nHeight)
{
	LKASSERT(nWidth>0);
	LKASSERT(nHeight>0);

	CreateBitmap(nWidth, nHeight);
}
开发者ID:Mazuk,项目名称:LK8000,代码行数:7,代码来源:STScreenBuffer.cpp

示例4: LKASSERT

void CuSondeLevel::updateTemps(double rh, double t)
// calculate dew point
// input:  humi [%RH]
//         temp [degreesC]
// output: dew point [degreesC]
{
   double logEx, adewpoint;

   LKASSERT((237.3+t)!=0);
   logEx=0.66077+7.5*t/(237.3+t)+(log10(rh)-2);
   LKASSERT((0.66077+7.5-logEx)!=0);
   adewpoint = (logEx - 0.66077)*237.3/(0.66077+7.5-logEx);

   // update statistics
   if (0) {
     nmeasurements++;
     dewpoint = (adewpoint+dewpoint*(nmeasurements-1))/nmeasurements;
     airTemp = (t+airTemp*(nmeasurements-1))/nmeasurements;
   } else {
     if (nmeasurements==0) {
       dewpoint = adewpoint;
       airTemp = t;
     } else {
       dewpoint = adewpoint*0.5+dewpoint*0.5;
       airTemp = t*0.5+airTemp*0.5;
     }

     nmeasurements++;
   }
}
开发者ID:LK8000,项目名称:LK8000,代码行数:30,代码来源:Atmosphere.cpp

示例5: dlgAirspaceShowModal

bool dlgAirspaceShowModal(bool coloredit){

  colormode = coloredit;

  ItemIndex = -1;

  if (!ScreenLandscape) {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace_L.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE_L"));
  } else {
    TCHAR filename[MAX_PATH];
    LocalPathS(filename, TEXT("dlgAirspace.xml"));
    wf = dlgLoadFromXML(CallBackTable, 
                        filename, 
                        hWndMainWindow,
                        TEXT("IDR_XML_AIRSPACE"));
  }
  if (!wf) return false;

  wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList"));
  LKASSERT(wAirspaceList!=NULL);
  wAirspaceList->SetBorderKind(BORDERLEFT);
  wAirspaceList->SetEnterCallback(OnAirspaceListEnter);

  wAirspaceListEntry = (WndOwnerDrawFrame*)wf->
  FindByName(TEXT("frmAirspaceListEntry"));
  LKASSERT(wAirspaceListEntry!=NULL);
  wAirspaceListEntry->SetCanFocus(true);

  // ScrollbarWidth is initialised from DrawScrollBar in WindowControls, so it might not be ready here
  if ( wAirspaceList->ScrollbarWidth == -1) {
   #if defined (PNA)
   #define SHRINKSBFACTOR 1.0 // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #else
   #define SHRINKSBFACTOR 0.75  // shrink width factor.  Range .1 to 1 where 1 is very "fat"
   #endif
   wAirspaceList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale * SHRINKSBFACTOR);

  }
  wAirspaceListEntry->SetWidth(wAirspaceList->GetWidth() - wAirspaceList->ScrollbarWidth - 5);


  UpdateList();

  changed = false;

  wf->ShowModal();


  delete wf;

  wf = NULL;

  return changed;
}
开发者ID:IvanSantanna,项目名称:LK8000,代码行数:59,代码来源:dlgAirspace.cpp

示例6: A2

bool PGCicrcleTaskPt::CrossPoint(const ProjPt& prev, const ProjPt& next, ProjPt& optimized) {
    ProjPt A = prev - m_Center;
    ProjPt B = next - m_Center;
    ProjPt A2(A.m_X * A.m_X, A.m_Y * A.m_Y);
    ProjPt B2(B.m_X * B.m_X, B.m_Y * B.m_Y);
    double R2 = (m_Radius * m_Radius);

    bool PrevOutside = (A2.m_X + A2.m_Y) > R2;
    bool NextOutside = (B2.m_X + B2.m_Y) > R2;

    if (!PrevOutside && !NextOutside) {
        return false; // no cross point
    }

    ProjPt AB = B - A;

    double a = (AB.m_X * AB.m_X) + (AB.m_Y * AB.m_Y);
    double b = 2 * ((AB.m_X * A.m_X) + (AB.m_Y * A.m_Y));
    double c = A2.m_X + A2.m_Y - R2;

    double bb4ac = (b * b) -(4 * a * c);
    if (bb4ac < 0.0) {
        return false;
    }

    bool bCrossPoint = false;
    double k = 0.0;
    if (bb4ac == 0.0) {
        LKASSERT(a);
        // one point
        k = -b / (2 * a);
        bCrossPoint = true;
    }

    if (bb4ac > 0.0) {
        // Two point,
        if ((PrevOutside && m_bExit) || (!PrevOutside && NextOutside)) {
            LKASSERT(a);
            k = (-b + sqrt(bb4ac)) / (2 * a); // ouput : prev ouside && Exit TP || prev inside && next outside
            bCrossPoint = true;
        } else {
            LKASSERT(a);
            k = (-b - sqrt(bb4ac)) / (2 * a); // input : prev outside && Enter TP
            bCrossPoint = true;
        }
    }

    if (bCrossPoint) {
        ProjPt O = prev + ((next - prev) * k);
        if (dot_product((next - prev), O - prev) > 0.0 &&
                dot_product((prev - next), O - next) > 0.0) {
            optimized = O;
            return true;
        }
    }

    // no point
    return false;
}
开发者ID:rkalman,项目名称:LK8000,代码行数:59,代码来源:PGCicrcleTaskPt.cpp

示例7: LKSurface

LKPaintSurface::LKPaintSurface(HWND hWnd) : LKSurface(), _hWnd(hWnd) {
    LKASSERT(hWnd);
    LKASSERT(::IsWindow(hWnd));

    if (!Attach(::BeginPaint(hWnd, &_ps))) {
        LKASSERT(false);
    }
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:8,代码来源:LKWindowSurface.cpp

示例8: dlgMultiSelectListShowModal

ListElement* dlgMultiSelectListShowModal(void) {

    ItemIndex = -1;

    if (iNO_ELEMENTS == 0) {

        return NULL;
    }

    wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_MULTISELECTLIST_L : IDR_XML_MULTISELECTLIST_P);

    if (!wf) return NULL;

    wf->SetTimerNotify(1000, OnTimer);
    wMultiSelectListList = (WndListFrame*) wf->FindByName(TEXT("frmMultiSelectListList"));
    LKASSERT(wMultiSelectListList != NULL);
    wMultiSelectListList->SetBorderKind(BORDERLEFT);
    wMultiSelectListList->SetEnterCallback(OnMultiSelectListListEnter);

    wMultiSelectListListEntry = (WndOwnerDrawFrame*) wf->FindByName(TEXT("frmMultiSelectListListEntry"));
    if(wMultiSelectListListEntry) {
        /*
         * control height must contains 2 text Line 
         * Check and update Height if necessary
         */
        LKWindowSurface windowSurface(MainWindow);
        LKBitmapSurface tmpSurface(windowSurface, 1, 1);

        const auto oldFont = tmpSurface.SelectObject(wMultiSelectListListEntry->GetFont());
        const int minHeight = 2 * tmpSurface.GetTextHeight(_T("dp")) + 2 * DLGSCALE(2);
        tmpSurface.SelectObject(oldFont);
        const int wHeight = wMultiSelectListListEntry->GetHeight();
        if(minHeight > wHeight) {
            wMultiSelectListListEntry->SetHeight(minHeight);
        }
        wMultiSelectListListEntry->SetCanFocus(true);
    } else LKASSERT(0);

    UpdateList();

    wf->ShowModal();

    delete wf;

    wf = NULL;

    iNO_ELEMENTS = 0;

    NoAirfields = 0;
    NoOutlands = 0;
    NoWaypoints = 0;
    NoAirspace = 0;
    NoTaskPoints = 0;

    return pResult;
}
开发者ID:lshachar,项目名称:LK8000,代码行数:56,代码来源:dlgMultiSelectList.cpp

示例9: LKASSERT

bool LKSurface::Attach(HDC hDC) {
    LKASSERT(NULL == _OutputDC); // only attach once.
    LKASSERT(NULL == _AttribDC);
    if (NULL == hDC) {
        return false;
    }
    _OutputDC = hDC;

    return true;
}
开发者ID:LK8000,项目名称:LK8000,代码行数:10,代码来源:LKSurface.cpp

示例10: LKASSERT

void LKWindowSurface::Create(Window& Wnd){
#ifdef WIN32
    HWND hWnd = Wnd.Handle();
    LKASSERT(hWnd);
    LKASSERT(::IsWindow(hWnd));

    if(!Attach(::GetDC(hWnd))) {
        LKASSERT(false);
    }
#else
    _pCanvas = new WindowCanvas(Wnd);
#endif
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:13,代码来源:LKWindowSurface.cpp

示例11: dlgHelpShowModal

void dlgHelpShowModal(const TCHAR* Caption, const TCHAR* HelpText) {
  if (!Caption || !HelpText) {
    return;
  }
  InitHelp();

  wf = dlgLoadFromXML(CallBackTable, 
                        ScreenLandscape ? TEXT("dlgHelp_L.xml") : TEXT("dlgHelp_P.xml"),
                        ScreenLandscape ? IDR_XML_HELP_L : IDR_XML_HELP_P);

  LKASSERT(wf);
  if (!wf) goto _getout;

  TCHAR fullcaption[100];
  _stprintf(fullcaption,TEXT("%s: %s"), gettext(TEXT("[email protected]_")), Caption); // Help
  wf->SetCaption(fullcaption);

  wHelp = (WndListFrame*)wf->FindByName(TEXT("frmDetails"));
  wHelpEntry = (WndOwnerDrawFrame *)NULL;
  DrawListIndex=0;

  LKASSERT(wHelp!=NULL);
  if (!wHelp) goto _getout;

  wHelp->SetBorderKind(BORDERLEFT);
  
  wHelpEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry"));
  LKASSERT(wHelpEntry);
  if (!wHelpEntry) goto _getout;
  wHelpEntry->SetCanFocus(true);

  {
    LKWindowSurface Surface(*wHelpEntry);
    Surface.SelectObject(wHelpEntry->GetFont());
    aTextLine.update(Surface, wHelpEntry->GetWidth(), LKgethelptext(HelpText));
  }

  wHelp->ResetList();
  wHelp->Redraw();
  wf->ShowModal();
  delete wf;
  
  aTextLine.clear();
  

_getout:
  wf = NULL;

}
开发者ID:PhilColbert,项目名称:LK8000,代码行数:49,代码来源:dlgHelp.cpp

示例12: SetKRT2Station

/*****************************************************************************
 * this function set the station name and frequency on the KRT2
 *
 * ComPort        index of the comport the KRT2 is attached
 * Active_Passive Active or passive station switch
 * fFrequency     station frequency
 * Station        station Name string
 *
 *****************************************************************************/
int  SetKRT2Station(TCHAR *Command ,int Active_Passive, double fFrequency, TCHAR* Station)
{
TCHAR cActivePassive  = 'U';
unsigned int len = 8;
unsigned int i;
int MHz= (int) fFrequency;
int kHz= (int) (fFrequency *1000.0 - MHz *1000  + 0.5);
int Chan = kHz/5;
//char Command[MAX_ANSWER_LEN];
char Airfield[10]={"   ---   "};
LKASSERT(Station !=NULL)
LKASSERT(Command !=NULL)
if(Command == NULL )
    return false;
if(Station != NULL)
{
  if( len > _tcslen(Station))
    len =_tcslen(Station);

    for (i= 0; i < len ; i++) {
      Airfield[i] = Station[i];
    }
 }
  switch (Active_Passive)
  {
      case ACTIVE_STATION:
        cActivePassive = 'U';
      break;
      default:
      case PASSIVE_STATION:
        cActivePassive = 'R';
      break;
  }

  _stprintf(Command, _T("%c%c%c%c%c%c%c%c%c%c%c%c%c"),STX,cActivePassive,  (unsigned char)MHz,  (unsigned char)Chan,
			  Airfield[0],
                                                        Airfield[1],
			  Airfield[2],
			  Airfield[3],
			  Airfield[4],
			  Airfield[5],
			  Airfield[6],
			  Airfield[7],
			(unsigned char)MHz ^ (unsigned char)Chan );
//  SendDataBufferISR(ComPort, Command, 13);
//  sprintf(szLastCommandSend, Command); lastComPort = ComPort; // remember for 2nd try in case it fails
  return 13;
}
开发者ID:PhilColbert,项目名称:LK8000,代码行数:57,代码来源:devKRT2.cpp

示例13: switch

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/// Show declaration progress dialog.
///
/// @param dlgType  message type to be shown
///
//static
void DevBase::ShowProgress(DeclDlg dlgType)
{
  const TCHAR* msgId;

  switch (dlgType)
  {
    case decl_enable:
      // LKTOKEN  [email protected]_ = "Enabling declaration mode"
      msgId = _T("[email protected]_"); break;

    case decl_disable:
      // LKTOKEN  [email protected]_ = "Disabling declaration mode"
      msgId = _T("[email protected]_"); break;

    case decl_send:
      // LKTOKEN  [email protected]_ = "Sending declaration"
      msgId = _T("[email protected]_"); break;

    default:
      #if BUGSTOP
      LKASSERT(0);
      #endif
      msgId = _T("[email protected]_"); break;
      return;
  }

  TCHAR buffer[max_dlg_msg_sz];

  _sntprintf(buffer, max_dlg_msg_sz, _T("%s..."), gettext(msgId));

  CreateProgressDialog(buffer);

} // ShowProgress()
开发者ID:PhilColbert,项目名称:LK8000,代码行数:39,代码来源:devBase.cpp

示例14: InitSineTable

void InitSineTable(void)
{
  int i;
  double angle;
  double cosa, sina;

  for(i=0;i<4096; i++)
    {
      angle = DEG_TO_RAD*((double)i*360)/4096;
      cosa = cos(angle);
      sina = sin(angle);
      SINETABLE[i] = sina;
      COSTABLE[i] = cosa;
      ISINETABLE[i] = iround(sina*1024);
      ICOSTABLE[i] = iround(cosa*1024);
      if ((cosa>0) && (cosa<1.0e-8)) {
	cosa = 1.0e-8;
      }
      if ((cosa<0) && (cosa>-1.0e-8)) {
	cosa = -1.0e-8;
      }
      LKASSERT(cosa!=0);
      INVCOSINETABLE[i] = 1.0/cosa;
    }
}
开发者ID:Tomas1,项目名称:LK8000,代码行数:25,代码来源:MathFunctions.cpp

示例15: _MulDiv

int _MulDiv(int nNumber, int nNumerator, int nDenominator) {
    long long res = nNumber;
    res *= nNumerator;
    LKASSERT(nDenominator!=0);
    res /= nDenominator;
    return res;
}
开发者ID:Tomas1,项目名称:LK8000,代码行数:7,代码来源:MathFunctions.cpp


注:本文中的LKASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。