本文整理汇总了C++中BOOST_VERIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_VERIFY函数的具体用法?C++ BOOST_VERIFY怎么用?C++ BOOST_VERIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOOST_VERIFY函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: inet_aton
NetworkAddress::NetworkAddress (string const &server) {
auto off = server.find(':');
if (off == server.npos || off + 1 >= server.size()) {
h = server;
p = -1;
}
else {
h = server.substr(0, off);
p = boost::lexical_cast<int>(server.substr(off+1));
}
// translate hostname to IP address
struct in_addr in;
int r = inet_aton(h.c_str(), &in);
if (r == 0) {
// invalid IP address, use getent to convert to IP address
string cmd(format("getent ahostsv4 %s", h));
FILE *fp = popen(cmd.c_str(), "r");
BOOST_VERIFY(fp);
char line[4000];
while (fgets(line, 4000, fp)) {
if (strstr(line, "STREAM") && strstr(line, h.c_str())) {
char *sp = strchr(line, ' ');
string ip(line, sp);
LOG(info) << "IP resolving " << h << " to " << ip;
h = ip;
break;
}
}
pclose(fp);
}
}
开发者ID:aaalgo,项目名称:donkey,代码行数:32,代码来源:donkey.cpp
示例2: set_current_thread_data
void set_current_thread_data(detail::thread_data_base* new_data)
{
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
if (current_thread_tls_key!=TLS_OUT_OF_INDEXES)
{
BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
}
else
{
// If we attempted to set the data to a null pointer, don't flag an error.
// This happens at shutdown, where boost has a race between thread and
// process exit handlers.
BOOST_VERIFY(!new_data);
//boost::throw_exception(thread_resource_error());
}
}
开发者ID:CeperaCPP,项目名称:mongo,代码行数:16,代码来源:thread.cpp
示例3: AcquireSRWLockExclusive
BOOST_LOG_API bool once_block_sentry::enter_once_block() const
{
AcquireSRWLockExclusive(&g_OnceBlockMutex);
once_block_flag volatile& flag = m_Flag;
while (flag.status != once_block_flag::initialized)
{
if (flag.status == once_block_flag::uninitialized)
{
flag.status = once_block_flag::being_initialized;
ReleaseSRWLockExclusive(&g_OnceBlockMutex);
// Invoke the initializer block
return false;
}
else
{
while (flag.status == once_block_flag::being_initialized)
{
BOOST_VERIFY(SleepConditionVariableSRW(
&g_OnceBlockCond, &g_OnceBlockMutex, INFINITE, 0));
}
}
}
ReleaseSRWLockExclusive(&g_OnceBlockMutex);
return true;
}
开发者ID:Fabiz,项目名称:log,代码行数:29,代码来源:once_block.cpp
示例4: disable
// reset buffer chain to initial state
void disable()
{
if (enabled) {
BOOST_VERIFY(&buffer_data == sink.chain_buffering(prev_buffer));
enabled = false;
}
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:8,代码来源:output_iterator.hpp
示例5: sizeof
int UDPSocket::recv(void * data, int size) {
int bytes;
struct sockaddr_storage saddr;
socklen_t length = sizeof (saddr);
BOOST_ASSERT(data != NULL);
BOOST_ASSERT(sock >= 0);
bytes = ::recvfrom(sock, data, size, 0, (struct sockaddr *) &saddr, &length);
// TODO: Implement status error (eg. Conn closed, ...)
if (bytes < 0)
throw ErrException("UDPSocket", "recvfrom");
if (bytes == 0) {
//Socket is now closed
BOOST_VERIFY(sock < 0);
return 0;
}
/**
* recv doesn't set the after-the-last byte to zero. We must do it to
* avoid some issues.
* (writing into a prefilled longer data buffer fucks everything up)
*/
if (bytes < size)
((char*) data)[bytes] = 0;
lastRecvAddr = SockAddress((const sockaddr *) &saddr);
return bytes;
}
开发者ID:fishilico,项目名称:ipovermesh,代码行数:27,代码来源:udpsocket.cpp
示例6: pgm_allocrow
void
PGMImageWriter::beginOfImage(int cols, int rows) {
_cols = cols;
_outputRow = pgm_allocrow(cols);
BOOST_VERIFY(_outputRow != NULL);
pgm_writepgminit(_output, cols, rows, 255, 1);
}
开发者ID:arnaudetitia,项目名称:DGtalTools,代码行数:7,代码来源:PGMImageWriter.cpp
示例7: release_shared_waiters
void release_shared_waiters(state_data old_state)
{
if(old_state.shared_waiting || old_state.exclusive_waiting)
{
BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0);
}
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:7,代码来源:shared_mutex.hpp
示例8: rebuild
virtual void rebuild () { // insert must not happen at this time
if (flavor == KGRAPH_LINEAR) {
BOOST_VERIFY(indexed_size == 0);
return;
}
if (entries.size() == indexed_size) return;
if (flavor == KGRAPH_LITE) {
indexed_size = 0;
delete kg_index;
kg_index = nullptr;
return;
}
KGraph *kg = nullptr;
if (entries.size() >= min_index_size) {
kg = KGraph::create();
LOG(info) << "Rebuilding index for " << entries.size() << " features.";
IndexOracle oracle(this, index_params_l1);
kg->build(oracle, index_params, NULL);
LOG(info) << "Swapping on new index...";
}
indexed_size = entries.size();
std::swap(kg, kg_index);
if (kg) {
delete kg;
}
}
开发者ID:aaalgo,项目名称:donkey,代码行数:30,代码来源:index-kgraph.cpp
示例9: test_on_the_fly_merge
void test_on_the_fly_merge (const Container & values)
{
using nested_container_type = typename Container::value_type;
std::vector<boost::iterator_range<typename nested_container_type::const_iterator>> ranges;
boost::for_each(values,
[& ranges] (const nested_container_type & values)
{
ranges.push_back(boost::make_iterator_range(values));
});
clock_t merge_time = clock();
auto merged_range = burst::merge(boost::make_iterator_range(ranges));
auto distance = static_cast<std::size_t>(std::distance(merged_range.begin(), merged_range.end()));
merge_time = clock() - merge_time;
BOOST_VERIFY
(
distance ==
std::accumulate(values.begin(), values.end(), 0ul,
[] (std::size_t current_value, const nested_container_type & vector)
{
return current_value + vector.size();
})
);
std::cout << "Слияние на лету:" << std::endl;
std::cout << "\t" << static_cast<double>(merge_time) / CLOCKS_PER_SEC << std::endl;
std::cout << std::endl;
}
开发者ID:4144,项目名称:burst,代码行数:30,代码来源:merge_iterator.cpp
示例10: afterSegmentReceivedCb
void
SegmentFetcher::sendInterest(uint64_t segNum, const Interest& interest, bool isRetransmission)
{
weak_ptr<SegmentFetcher> weakSelf = m_this;
++m_nSegmentsInFlight;
auto pendingInterest = m_face.expressInterest(interest,
[this, weakSelf] (const Interest& interest, const Data& data) {
afterSegmentReceivedCb(interest, data, weakSelf);
},
[this, weakSelf] (const Interest& interest, const lp::Nack& nack) {
afterNackReceivedCb(interest, nack, weakSelf);
},
nullptr);
auto timeout = m_options.useConstantInterestTimeout ? m_options.maxTimeout : getEstimatedRto();
auto timeoutEvent = m_scheduler.schedule(timeout, [this, interest, weakSelf] {
afterTimeoutCb(interest, weakSelf);
});
if (isRetransmission) {
updateRetransmittedSegment(segNum, pendingInterest, timeoutEvent);
return;
}
PendingSegment pendingSegment{SegmentState::FirstInterest, time::steady_clock::now(),
pendingInterest, timeoutEvent};
bool isNew = m_pendingSegments.emplace(segNum, std::move(pendingSegment)).second;
BOOST_VERIFY(isNew);
m_highInterest = segNum;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:31,代码来源:segment-fetcher.cpp
示例11: BOOST_VERIFY
void JpegPayload::setMbz(boost::uint8_t mbz)
{
boost::uint_t<MBZ_BIT_SIZE>::fast MbzMaxValue =
boost::low_bits_mask_t<MBZ_BIT_SIZE>::sig_bits;
BOOST_VERIFY(mbz <= MbzMaxValue);
m_mbz = mbz;
}
开发者ID:zhenyouluo,项目名称:alber_rtsp_server,代码行数:8,代码来源:jpeg_payload.cpp
示例12: set_current_thread_data
void set_current_thread_data(detail::thread_data_base* new_data)
{
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
#if BOOST_PLAT_WINDOWS_RUNTIME
current_thread_data_base = new_data;
#else
if (current_thread_tls_key != TLS_OUT_OF_INDEXES)
{
BOOST_VERIFY(TlsSetValue(current_thread_tls_key, new_data));
}
else
{
BOOST_VERIFY(false);
//boost::throw_exception(thread_resource_error());
}
#endif
}
开发者ID:wpbest,项目名称:Boost,代码行数:17,代码来源:thread.cpp
示例13: make_record
inline typename boost::log::basic_core< CharT >::record_type make_record(
boost::log::basic_attribute_set< CharT > const& src_attrs)
{
BOOST_VERIFY(!!aux::make_record_sink_holder< CharT >::instance); // to force sink registration
typedef boost::log::basic_core< CharT > core_type;
return core_type::get()->open_record(src_attrs);
}
开发者ID:yhager,项目名称:boost-log,代码行数:8,代码来源:make_record.hpp
示例14: set_current_thread_data
void set_current_thread_data(detail::thread_data_base* new_data)
{
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
if(current_thread_tls_key)
BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
else
boost::throw_exception(thread_resource_error());
}
开发者ID:mhough,项目名称:DSI-Studio,代码行数:8,代码来源:thread.cpp
示例15: call_once
void call_once(once_flag& flag,Function f)
{
static riakboost::uintmax_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE;
static riakboost::uintmax_t const being_initialized=uninitialized_flag+1;
riakboost::uintmax_t const epoch=flag.epoch;
riakboost::uintmax_t& this_thread_epoch=detail::get_once_per_thread_epoch();
if(epoch<this_thread_epoch)
{
pthread::pthread_mutex_scoped_lock lk(&detail::once_epoch_mutex);
while(flag.epoch<=being_initialized)
{
if(flag.epoch==uninitialized_flag)
{
flag.epoch=being_initialized;
#ifndef BOOST_NO_EXCEPTIONS
try
{
#endif
pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex);
f();
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...)
{
flag.epoch=uninitialized_flag;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
throw;
}
#endif
flag.epoch=--detail::once_global_epoch;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
}
else
{
while(flag.epoch==being_initialized)
{
BOOST_VERIFY(!pthread_cond_wait(&detail::once_epoch_cv,&detail::once_epoch_mutex));
}
}
}
this_thread_epoch=detail::once_global_epoch;
}
}
开发者ID:4ukuta,项目名称:core,代码行数:45,代码来源:once.hpp
示例16: lock
void lock()
{
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
while(is_locked)
{
BOOST_VERIFY(!pthread_cond_wait(&cond,&m));
}
is_locked=true;
}
开发者ID:Axitonium,项目名称:sourcesdkpython,代码行数:9,代码来源:mutex.hpp
示例17: unlock
void unlock()
{
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
if(!--count)
{
is_locked=false;
}
BOOST_VERIFY(!pthread_cond_signal(&cond));
}
开发者ID:3DJ,项目名称:ofxOgre,代码行数:9,代码来源:recursive_mutex.hpp
示例18: OverrideConfig
void OverrideConfig (std::vector<std::string> const &overrides, Config *config) {
for (std::string const &D: overrides) {
size_t o = D.find("=");
if (o == D.npos || o == 0 || o + 1 >= D.size()) {
std::cerr << "Bad parameter: " << D << std::endl;
BOOST_VERIFY(0);
}
config->put<std::string>(D.substr(0, o), D.substr(o + 1));
}
}
开发者ID:hanjb,项目名称:donkey,代码行数:10,代码来源:donkey.cpp
注:本文中的BOOST_VERIFY函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论