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


C++ IsoString::AppendFormat方法代码示例

本文整理汇总了C++中IsoString::AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ IsoString::AppendFormat方法的具体用法?C++ IsoString::AppendFormat怎么用?C++ IsoString::AppendFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IsoString的用法示例。


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

示例1: ToSource

IsoString Filter::ToSource() const
{
   IsoString s;
   if ( IsValid() )
   {
      if ( IsSeparable() )
      {
         s += "SeparableFilter {\n";
         s += "   name { " + Separable().Name().ToUTF8() + " }\n";
         s += "   row-vector { ";
         SeparableFilter::coefficient_vector H = Separable().RowFilter();
         for ( int i = 0; i < H.Length(); ++i )
            s.AppendFormat( ( H[i] < 0 ) ? "%.6f " :  " %.6f ", H[i] );
         s += "}\n";
         s += "   col-vector { ";
         SeparableFilter::coefficient_vector V = Separable().ColFilter();
         for ( int i = 0; i < V.Length(); ++i )
            s.AppendFormat( ( V[i] < 0 ) ? "%.6f " :  " %.6f ", V[i] );
         s += "}\n";
      }
      else
      {
         s += "KernelFilter {\n";
         s += "   name { " + Kernel().Name().ToUTF8() + " }\n";
         s += "   coefficients {\n";
         KernelFilter::coefficient_matrix M = Kernel().Coefficients();
         for ( int i = 0; i < M.Rows(); ++i )
         {
            s += "      ";
            for ( int j = 0; ; )
            {
               s.AppendFormat( ( M[i][j] < 0 ) ? "%.6f " :  " %.6f ", M[i][j] );
               if ( ++j == M.Cols() )
                  break;
               s += ' ';
            }
            s += '\n';
         }
         s += "   }\n";
      }
      s += "}\n";
   }

   return s;
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:45,代码来源:FilterLibrary.cpp

示例2: CriticalSignalHandler

static void CriticalSignalHandler( int sig_num )
{
   sigset_t x;
   sigemptyset( &x );
   sigaddset( &x, SIGSEGV );
   sigaddset( &x, SIGBUS );
   sigaddset( &x, SIGFPE );
   sigaddset( &x, SIGILL );
   sigaddset( &x, SIGPIPE );
   //sigprocmask( SIG_UNBLOCK, &x, NULL );
   pthread_sigmask( SIG_UNBLOCK, &x, NULL );

   void* addrList[ STACK_DEPTH ];
   size_t addrLen = backtrace( addrList, sizeof( addrList )/sizeof( void* ) );
   char** symbolList = backtrace_symbols( addrList, addrLen );
   IsoString details;
   if ( symbolList != NULL )
   {
      if ( symbolList[0] != NULL )
      {
         details = STACK_TRACE_TITLE + IsoString().Format( STACK_TRACE_HEADER, sig_num, symbolList[0] );
         for ( size_t i = 1; i < addrLen; ++i )
         {
            if ( symbolList[i] != NULL )
            {
               IsoString addrOffsetStr;
               IsoString demangledFuncname = GetDemangledFunctionName( symbolList[i], addrOffsetStr );
               details.AppendFormat( "%d: ", addrLen-i );
               details += demangledFuncname;
               if ( !addrOffsetStr.IsEmpty() )
               {
                  details += "(+";
                  details += addrOffsetStr;
                  details += ')';
               }
               details += '\n';
            }
         }
         details += STACK_TRACE_BOTTOM;

         fprintf( stderr, "%s", details.c_str() );
      }

      // symbolList must be freed
      free( symbolList );
   }

   switch ( sig_num )
   {
   case SIGSEGV:
      throw EUnixSegmentationViolation( details );
   case SIGBUS:
      throw EUnixBusError( details );
   case SIGFPE:
      throw EUnixFloatingPointException( details );
   case SIGILL:
      throw EUnixIllegalInstructionException( details );
   case SIGPIPE:
      throw EUnixIBrokenPipeException( details );
   default:
      throw UnixSignalException( sig_num, details );
   }
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:63,代码来源:UnixSignalException.cpp


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