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


C++ BOOST_ASSERT_MSG函数代码示例

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


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


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