• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BOOST_ASSERT_MSG函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

 int run()
 {
    switch(type_)
    {
      case parameter: 
         return main_parameter_(context_);
      case singleton: 
         return main_singleton_();
      default: 
      BOOST_ASSERT_MSG(false, 
                       "boost::application handler type is not "
                       "implemented, must be 'parameter' or "
                       "'singleton' type");
    }
    return 0;
 }
开发者ID:respu,项目名称:Boost.Application,代码行数:16,代码来源:server_application_impl.hpp


示例2: BOOST_ASSERT_MSG

size_t global_allocator::calculate_mixin_offset(const char* buffer, size_t mixin_alignment)
{
    // now malloc (or new) should make sure to give us memory that's word aligned
    // that means that buffer should be aligned to sizeof(ptr)

    // WARNING: if you don't have a custom allocator and this assert fails
    // this means that memory not-aligned to the pointer size was allocated
    // Thie platform is strange and creepy and is not supported by the default allocator
    // you should write your own, that does allocate properly aligned memory
    BOOST_ASSERT_MSG(uintptr_t(buffer) % sizeof(object*) == 0,
        "allocators should always return memory aligned to sizeof(void*)");

    uintptr_t mixin_pos = ceil_scale(uintptr_t(buffer + sizeof(object*)), mixin_alignment);

    return mixin_pos - uintptr_t(buffer);
}
开发者ID:iboB,项目名称:boost.mixin,代码行数:16,代码来源:allocators.cpp


示例3: install

void builder::pack(const boost::filesystem::path &src,
                   const boost::filesystem::path &bin,
                   const boost::filesystem::path &archive,
                   const archiver_ptr &archiver_) {
  // prepare empty directories
  filesystem::reset_dir(bin);
  tempfile root_ = tempfile::directory_in_directory(bin);
  tempfile bin_ = tempfile::directory_in_directory(bin);
  root_.auto_remove(false);
  bin_.auto_remove(false);
  // installation
  install(src, bin_.path(), root_.path());
  // packing
  BOOST_ASSERT_MSG(archiver_, "Archiver pointer should not be null");
  archiver_->pack_contents(archive, root_.path());
}
开发者ID:bunsanorg,项目名称:utility,代码行数:16,代码来源:builder.cpp


示例4: LoadStreetNames

    void LoadStreetNames(const boost::filesystem::path &names_file)
    {
        boost::filesystem::ifstream name_stream(names_file, std::ios::binary);

        name_stream >> m_name_table;

        unsigned number_of_chars = 0;
        name_stream.read((char *)&number_of_chars, sizeof(unsigned));
        BOOST_ASSERT_MSG(0 != number_of_chars, "name file broken");
        m_names_char_list.resize(number_of_chars + 1); //+1 gives sentinel element
        name_stream.read((char *)&m_names_char_list[0], number_of_chars * sizeof(char));
        if (0 == m_names_char_list.size())
        {
            util::SimpleLogger().Write(logWARNING) << "list of street names is empty";
        }
    }
开发者ID:PuppetHou,项目名称:osrm-backend,代码行数:16,代码来源:internal_datafacade.hpp


示例5: file

MGallery* MXMLHandler::loadProject(std::string path)
{
    QFile file(QString(path.c_str()));

    if (!file.open(QFile::ReadOnly | QFile::Text))
	return NULL;

    readFile(&file);

    if (!_galleries.size())
	return NULL;

    BOOST_ASSERT_MSG(_galleries.size() == 1, "There must be only one top gallery when exporting.");

    return _galleries.front();
}
开发者ID:macicek,项目名称:MGalleryManager-v2,代码行数:16,代码来源:mxmlhander.cpp


示例6: calc_beta_loglik

 void calc_beta_loglik(std::string const& prior, std::vector<arma::vec> const& beta_hyperp)
 {
     if (prior == "normal") 
     {
         BOOST_ASSERT_MSG(beta_hyperp.size() == 2, "Beta normal prior expects 2 hyperparameters.");
         loglik_beta = arma::accu( -arma::log(beta_hyperp[1]) - 0.5 * arma::square( (beta - beta_hyperp[0])/beta_hyperp[1]) );
     }
     else if (prior == "flat")
     {
          loglik_beta = 0.0;
     }
     else
     {
         throw std::runtime_error("Unknown prior on beta.");
     }
 }
开发者ID:rundel,项目名称:RcppGP,代码行数:16,代码来源:model_state_glm.hpp


示例7: lower_result

    //==========================================================================
    // Return lower formatted result
    //==========================================================================
    typename  meta::
              call< tag::expand_
                    ( typename  meta::call<tag::tril_(data_t const&)>::type
                    , nt2_la_int
                    , nt2_la_int
                    )
                  >::type
    lower_result() const
    {
      BOOST_ASSERT_MSG( (uplo_ == 'L')
                      , "Upper Cholesky can't return lower result"
                      );

      nt2_la_int p = info_ > 0 ? info_-1 : height_;
      return nt2::expand(nt2::tril(values_), p, p);
    }
开发者ID:atyuwen,项目名称:nt2,代码行数:19,代码来源:chol.hpp


示例8: readHSGRFromStream

unsigned readHSGRFromStream(const boost::filesystem::path &hsgr_file,
                            std::vector<NodeT> &node_list,
                            std::vector<EdgeT> &edge_list,
                            unsigned *check_sum)
{
    if (!boost::filesystem::exists(hsgr_file))
    {
        throw osrm::exception("hsgr file does not exist");
    }
    if (0 == boost::filesystem::file_size(hsgr_file))
    {
        throw osrm::exception("hsgr file is empty");
    }

    boost::filesystem::ifstream hsgr_input_stream(hsgr_file, std::ios::binary);

    FingerPrint fingerprint_loaded, fingerprint_orig;
    hsgr_input_stream.read((char *)&fingerprint_loaded, sizeof(FingerPrint));
    if (!fingerprint_loaded.TestGraphUtil(fingerprint_orig))
    {
        SimpleLogger().Write(logWARNING) << ".hsgr was prepared with different build.\n"
                                            "Reprocess to get rid of this warning.";
    }

    unsigned number_of_nodes = 0;
    unsigned number_of_edges = 0;
    hsgr_input_stream.read((char *)check_sum, sizeof(unsigned));
    hsgr_input_stream.read((char *)&number_of_nodes, sizeof(unsigned));
    BOOST_ASSERT_MSG(0 != number_of_nodes, "number of nodes is zero");
    hsgr_input_stream.read((char *)&number_of_edges, sizeof(unsigned));

    SimpleLogger().Write() << "number_of_nodes: " << number_of_nodes
                           << ", number_of_edges: " << number_of_edges;

    // BOOST_ASSERT_MSG( 0 != number_of_edges, "number of edges is zero");
    node_list.resize(number_of_nodes);
    hsgr_input_stream.read((char *)&(node_list[0]), number_of_nodes * sizeof(NodeT));

    edge_list.resize(number_of_edges);
    if (number_of_edges > 0)
    {
        hsgr_input_stream.read((char *)&(edge_list[0]), number_of_edges * sizeof(EdgeT));
    }
    hsgr_input_stream.close();

    return number_of_nodes;
}
开发者ID:Gozhack,项目名称:osrm-backend,代码行数:47,代码来源:graph_loader.hpp


示例9: Box

    Box(Eigen::Vector4d &center, Eigen::Vector4d& u, Eigen::Vector4d &v, 
	Eigen::Vector4d &w, unsigned int id, unsigned int matId, 
	double uWidth, double vWidth, double wWidth)
	: QuadricCollection(center, id, matId), u(u), v(v), w(w)  {
	BOOST_ASSERT_MSG(u[3] == 0 && v[3] == 0 && w[3] == 0, "u,v,w must have"
			 " fourth coordinate equal to zero!");//  Got u:\n"
			 // << u << "v:\n" << v << "w:\n" << w)

	// Prepare rotation matrix
	Eigen::Matrix4d R;
	R.row(0) = u;
	R.row(1) =  v;
	R.row(2) =  w;
	R.row(3) = Eigen::Vector4d(0, 0, 0, 1);
	
	/* Make all the planes forming the box (centered at origin). 
	   Plane normals will be unit vectors pointing in positive/negative
	   x, y, z directions. The points x on the plane with normal 
	   n = (a,b,c), distance d to origin satisfy n.p -d = 0, 
	   or x^T Q x = 0 where 
	   Q = |0   0   0   a/2|
	       |0   0   0   b/2|
	       |0   0   0   c/2|
	       |a/2 b/2 c/2  -d|
	  We define planes w.r.t. x, y, z axes, then rotate to u,v,w
	 */
	Eigen::Matrix4d posWPlane, negWPlane, posUPlane, negUPlane,
	    posVPlane, negVPlane;
	posWPlane = negWPlane = posUPlane = negUPlane = posVPlane =  negVPlane
	    = Eigen::Matrix4d::Zero();
	posUPlane.row(3) = posUPlane.col(3) = Eigen::Vector4d(0.5, 0, 0, -uWidth/2.0);
	negUPlane.row(3) = negUPlane.col(3) = Eigen::Vector4d(-0.5, 0, 0, -uWidth/2.0);

	posVPlane.row(3) = posVPlane.col(3) = Eigen::Vector4d(0, 0.5, 0, -vWidth/2.0);
	negVPlane.row(3) = negVPlane.col(3) = Eigen::Vector4d(0, -0.5, 0, -vWidth/2.0);

	posWPlane.row(3) = posWPlane.col(3) = Eigen::Vector4d(0, 0, 0.5, -wWidth/2.0);
	negWPlane.row(3) = negWPlane.col(3) = Eigen::Vector4d(0, 0, -0.5, -wWidth/2.0);

	addQuadric(R.transpose() * posWPlane * R);
	addQuadric(R.transpose() * negWPlane * R);
	addQuadric(R.transpose() * posUPlane * R);
	addQuadric(R.transpose() * negUPlane * R);
	addQuadric(R.transpose() * posVPlane * R);
	addQuadric(R.transpose() * negVPlane * R);
	
    }
开发者ID:drewbarbs,项目名称:class-raytracer,代码行数:47,代码来源:Box.hpp


示例10: perror

// @return  The IP4 address of the 'net_interface'.
vector<string> NetHelper::getIP4Address(const std::string& net_interface) {
    vector<string> ret_ip4_addr;

    //which family do we require , AF_INET or AF_INET6
    const int fm = AF_INET;

    struct ifaddrs *ifaddr = NULL;
    if (getifaddrs(&ifaddr) == -1) {
        perror("getifaddrs");
        BOOST_ASSERT(false);
        return ret_ip4_addr;
    }


    for (struct ifaddrs *ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
        if (ifa->ifa_addr == NULL) {
            continue;
        }

        bool is_this_netif = (strcmp(ifa->ifa_name, net_interface.c_str()) == 0);
        if (is_this_netif) {
            const int family = ifa->ifa_addr->sa_family;
            if (family == fm) {
                char host[NI_MAXHOST];
                int s = getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host,
                        NI_MAXHOST, NULL, 0, NI_NUMERICHOST);

                if (s != 0) {
                    ostringstream err;
                    err << "getnameinfo() failed: " << gai_strerror(s);
                    BOOST_ASSERT_MSG(false, err.str().c_str());
                    break;
                }
                else {
                    ret_ip4_addr.push_back(host);
                }
            }
        }
    }

    // clear
    freeifaddrs(ifaddr);
    ifaddr = NULL;

    // return
    return ret_ip4_addr;
}
开发者ID:dionysusxie,项目名称:multicast,代码行数:48,代码来源:NetHelper.cpp


示例11: BOOST_ASSERT_MSG

HRESULT directx_samplegrabber_callback::SampleCB(double time,
                                                 IMediaSample *sample) {
    // Point the image sample to the media sample we have and then set the flag
    // to tell the application it can process it.
    BOOST_ASSERT_MSG(_stayAlive, "Should be alive when samplecb is called");
    sampleExchange_->signalSampleProduced(sample);

    // Wait for either this object to be destroyed/shutdown (_stayAlive ==
    // false), or for the application/consumer to finish with this sample (which
    // would return true from the wait function, rather than false as a timeout
    // does).
    while (_stayAlive &&
           !sampleExchange_->waitForSampleConsumed(WAIT_FOR_CONSUMER_TIMEOUT)) {
    }

    return S_OK;
}
开发者ID:6DB,项目名称:OSVR-Core,代码行数:17,代码来源:directx_samplegrabber_callback.cpp


示例12: listen_backlog

inline session_manager_config::session_manager_config(
    const endpoint_type& the_accepting_endpoint,
    std::size_t the_max_session_count,
    std::size_t the_recycled_session_count,
    std::size_t the_max_stopping_sessions,
    int the_listen_backlog,
    const session_config& the_managed_session_config)
  : listen_backlog(the_listen_backlog)
  , max_session_count(the_max_session_count)
  , recycled_session_count(the_recycled_session_count)
  , max_stopping_sessions(the_max_stopping_sessions)
  , accepting_endpoint(the_accepting_endpoint)
  , managed_session_config(the_managed_session_config)
{
  BOOST_ASSERT_MSG(the_max_session_count > 0,
      "max_session_count must be > 0");
}
开发者ID:jeromewang-github,项目名称:asio_samples,代码行数:17,代码来源:session_manager_config.hpp


示例13: compute

 void compute( const FUNC& f, const X & ranges, const o_t & o)
 {
     init(o);
     itab_t facts =  ranges(nt2::_,begin_+1, nt2::_)-ranges(nt2::_,begin_, nt2::_);
     itab_t vols = nt2::prod(facts);
     input_t total_vol = globalasum1(vols);
     itab_t coefs = real_t(maxfunccnt_)*nt2::abs(vols)*nt2::rec(total_vol);
     BOOST_ASSERT_MSG(size(ranges, 2) == 2, "ranges must be a nx2xm expression");
     size_t l = size(ranges, 3);
     res_ = nt2::Zero<value_t>();
     for(size_t i=1; i <= l; ++i)
     {
         nbpts_ = coefs(i);
         res_ += compute(f, ranges(nt2::_,nt2::_,i), vols(i), facts(i));
         fcnt_+= nbpts_;
     }
 }
开发者ID:kevinushey,项目名称:nt2,代码行数:17,代码来源:qmtc.hpp


示例14: properties

PROPS & properties() {
    fibers::fiber_properties * props = fibers::context::active()->get_properties();
    if ( ! props) {
        // props could be nullptr if the thread's main fiber has not yet
        // yielded (not yet passed through algorithm_with_properties::
        // awakened()). Address that by yielding right now.
        yield();
        // Try again to obtain the fiber_properties subclass instance ptr.
        // Walk through the whole chain again because who knows WHAT might
        // have happened while we were yielding!
        props = fibers::context::active()->get_properties();
        // Could still be hosed if the running manager isn't a subclass of
        // algorithm_with_properties.
        BOOST_ASSERT_MSG( props, "this_fiber::properties not set");
    }
    return dynamic_cast< PROPS & >( * props );
}
开发者ID:kumakoko,项目名称:KumaGL,代码行数:17,代码来源:operations.hpp


示例15: conf_bounds

 BOOST_FORCEINLINE static void conf_bounds(const A0& a0, A1& a1,
                                           const value_type& alpha )
 {
   typedef nt2::memory::container<tag::table_, value_type, nt2::_2D>  semantic;
   NT2_AS_TERMINAL_IN(semantic, pcov, boost::proto::child_c<3>(a0));
   const In0& p  = boost::proto::child_c<0>(a0);
   const In1& mu = boost::proto::child_c<1>(a0);
   const In2& sigma = boost::proto::child_c<2>(a0);
   auto logx0 = -Sqrt_2<A0>()*erfcinv( nt2::Two<A0>()*p);
   auto xvar =   fma(fma(pcov(2,2), logx0, Two<value_type>()*pcov(1,2)), logx0, pcov(1,1));
   BOOST_ASSERT_MSG(nt2::globalall(nt2::is_nltz(xvar)), "Covariance matrix must be positive");
   value_type normz = -nt2::norminv(alpha*nt2::Half<value_type>());
   auto halfwidth = normz*nt2::sqrt(xvar);
   boost::proto::child_c<0>(a1) = exp(fma(sigma, logx0, mu));
   auto coef = exp(-halfwidth);
   boost::proto::child_c<1>(a1) = boost::proto::child_c<0>(a1)*coef;
   boost::proto::child_c<2>(a1) = boost::proto::child_c<0>(a1)/coef;
 }
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:18,代码来源:logninv.hpp


示例16: BOOST_ASSERT_MSG

void
Signal<Owner, TArgs...>::disconnect(typename SlotList::iterator it)
{
  if (m_isExecuting) {
    // during signal emission, only the currently executing handler can be disconnected
    BOOST_ASSERT_MSG(it == m_currentSlot, "cannot disconnect another handler from a handler");

    // this serves to indicate that the current slot needs to be erased from the list
    // after it finishes executing; we cannot do it here because of bug #2333
    m_currentSlot = m_slots.end();

    // expire all weak_ptrs, to prevent double disconnections
    it->disconnect.reset();
  }
  else {
    m_slots.erase(it);
  }
}
开发者ID:cawka,项目名称:ndn-cxx,代码行数:18,代码来源:signal.hpp


示例17: ReturnDistance

// computes the distance of a given permutation
EdgeWeight ReturnDistance(const DistTableWrapper<EdgeWeight> &dist_table,
                          const std::vector<NodeID> &location_order,
                          const EdgeWeight min_route_dist,
                          const std::size_t component_size)
{
    EdgeWeight route_dist = 0;
    std::size_t i = 0;
    while (i < location_order.size() && (route_dist < min_route_dist))
    {
        route_dist += dist_table(location_order[i], location_order[(i + 1) % component_size]);
        BOOST_ASSERT_MSG(dist_table(location_order[i], location_order[(i + 1) % component_size]) !=
                             INVALID_EDGE_WEIGHT,
                         "invalid route found");
        ++i;
    }

    return route_dist;
}
开发者ID:7890,项目名称:osrm-backend,代码行数:19,代码来源:trip_brute_force.hpp


示例18: conf_bounds

 BOOST_FORCEINLINE static void conf_bounds(const A0& a0, A1& a1,
                                           const value_type& alpha )
 {
   typedef nt2::memory::container<tag::table_, value_type, nt2::_2D>  semantic;
   NT2_AS_TERMINAL_IN(semantic, pcov, boost::proto::child_c<3>(a0));
   const In0& x  = boost::proto::child_c<0>(a0);
   const In1& mu = boost::proto::child_c<1>(a0);
   const In2& sigma = boost::proto::child_c<2>(a0);
   auto z = (log(if_zero_else(is_lez(x), x))-mu)/sigma;
   // this is [1, x0]*pcov*[1; x0]
   auto zvar = fma(fma(pcov(2,2), z, Two<value_type>()*pcov(1,2)), z, pcov(1,1));
   BOOST_ASSERT_MSG(nt2::globalall(nt2::is_gez(zvar)), "Covariance matrix must be positive");
   value_type normz = -nt2::norminv(alpha*nt2::Half<value_type>());
   auto halfwidth =  normz*nt2::sqrt(zvar)/sigma;
   boost::proto::child_c<0>(a1) = Half<value_type>()*nt2::erfc(-Sqrt_2o_2<value_type>()*z);
   boost::proto::child_c<1>(a1) = Half<value_type>()*nt2::erfc(-Sqrt_2o_2<value_type>()*(z-halfwidth));
   boost::proto::child_c<2>(a1) = Half<value_type>()*nt2::erfc(-Sqrt_2o_2<value_type>()*(z+halfwidth));
 }
开发者ID:JanVogelgesang,项目名称:nt2,代码行数:18,代码来源:logncdf.hpp


示例19: operator

    result_type operator()(Worker & w, std::size_t begin, std::size_t size, std::size_t grain)
    {

#ifndef BOOST_NO_EXCEPTIONS
      boost::exception_ptr exception;
#endif

      BOOST_ASSERT_MSG( size % grain == 0, "Reduce size not divisible by grain");
      std::ptrdiff_t nblocks  = size/grain;
      result_type reduced_out = w.neutral_(nt2::meta::as_<result_type>());

      #pragma omp parallel
      {
        // Dispatch group of blocks over each threads
        #pragma omp for schedule(static)
        for(std::ptrdiff_t n=0;n<nblocks;++n)
        {
          result_type out = w.neutral_(nt2::meta::as_<result_type>());

#ifndef BOOST_NO_EXCEPTIONS
          try
          {
#endif
            // Call operation
            w(out,begin+(std::size_t)n*grain,grain);

            #pragma omp critical
            reduced_out = w.bop_(reduced_out, out);

#ifndef BOOST_NO_EXCEPTIONS
          }
          catch(...)
          {

            #pragma omp critical
            exception = boost::current_exception();
          }
#endif

         }
      }

      return reduced_out;
    }
开发者ID:atyuwen,项目名称:nt2,代码行数:44,代码来源:fold.hpp


示例20: operator

    BOOST_FORCEINLINE void operator()(Expr& x, Sz const& sz, boost::mpl::true_)
    {
      #ifndef NDEBUG
      // Assert that we don't resize out of storage_size if
      // storage duration is not dynamic_
      typedef typename meta::option<Expr, tag::storage_size_>::type     ss_t;
      typedef typename meta::option<Expr, tag::storage_duration_>::type sd_t;
      typedef boost::is_same< typename sd_t::storage_duration_type
                            , nt2::dynamic_
                            >                                   is_dynamic_t;
      #endif

      BOOST_ASSERT_MSG
      (  is_dynamic_t::value || nt2::numel(sz) <= ss_t::storage_size_type::value
      , "Resizing over available storage size"
      );

      boost::proto::value(x).resize(sz);
    }
开发者ID:hljhttp,项目名称:pythran,代码行数:19,代码来源:resize.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BOOST_AUTO函数代码示例发布时间:2022-05-30
下一篇:
C++ BOOST_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap