本文整理汇总了C++中ec函数的典型用法代码示例。如果您正苦于以下问题:C++ ec函数的具体用法?C++ ec怎么用?C++ ec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ec函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_complete
static void do_complete(void* owner, operation* base,
const asio::error_code& result_ec,
std::size_t bytes_transferred)
{
asio::error_code ec(result_ec);
// Take ownership of the operation object.
win_iocp_socket_recvfrom_op* o(
static_cast<win_iocp_socket_recvfrom_op*>(base));
ptr p = { asio::detail::addressof(o->handler_), o, o };
handler_work<Handler> w(o->handler_);
ASIO_HANDLER_COMPLETION((o));
#if defined(ASIO_ENABLE_BUFFER_DEBUGGING)
// Check whether buffers are still valid.
if (owner)
{
buffer_sequence_adapter<asio::mutable_buffer,
MutableBufferSequence>::validate(o->buffers_);
}
#endif // defined(ASIO_ENABLE_BUFFER_DEBUGGING)
socket_ops::complete_iocp_recvfrom(o->cancel_token_, ec);
// Record the size of the endpoint returned by the operation.
o->endpoint_.resize(o->endpoint_size_);
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made. Even if we're not about to make an upcall, a
// sub-object of the handler may be the true owner of the memory associated
// with the handler. Consequently, a local copy of the handler is required
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::binder2<Handler, asio::error_code, std::size_t>
handler(o->handler_, ec, bytes_transferred);
p.h = asio::detail::addressof(handler.handler_);
p.reset();
// Make the upcall if required.
if (owner)
{
fenced_block b(fenced_block::half);
ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
w.complete(handler, handler.handler_);
ASIO_HANDLER_INVOCATION_END;
}
}
示例2: TEST
/* ****************************************************************************
*
* Constructor -
*/
TEST(NotifyContextResponse, Constructor)
{
StatusCode sc(SccOk, "2");
NotifyContextResponse ncr(sc);
utInit();
EXPECT_EQ(SccOk, ncr.responseCode.code);
ncr.release();
StatusCode ec(SccOk, "4");
NotifyContextResponse ncr2(ec);
EXPECT_EQ(SccOk, ncr2.responseCode.code);
utExit();
}
示例3: trace
std::string backtrace::trace_on_new_stack() const
{
if(frames_.empty())
return std::string();
if (0 == threads::get_self_ptr())
return trace();
lcos::local::futures_factory<std::string()> p(
util::bind(stack_trace::get_symbols, &frames_.front(), frames_.size()));
error_code ec(lightweight);
p.apply(threads::thread_priority_default, threads::thread_stacksize_medium, ec);
if (ec) return "<couldn't retrieve stack backtrace>";
return p.get_future().get(ec);
}
示例4: make_log_mesh_ec
DynLinArr<double> make_log_mesh_ec(double emin, double emax, long q) {
mfunname(
"DynLinArr< double > make_log_mesh_ec(double emin, double emax, long q)");
double rk = pow(emax / emin, (1.0 / double(q)));
double er = emin;
DynLinArr<double> ec(q);
double e1;
double e2 = er;
for (long n = 0; n < q; n++) {
e1 = e2;
e2 = e2 * rk;
ec[n] = (e1 + e2) * 0.5;
}
return ec;
}
示例5: do_complete
static void do_complete(io_service_impl* owner, operation* base,
const lslboost::system::error_code& result_ec,
std::size_t bytes_transferred)
{
lslboost::system::error_code ec(result_ec);
// Take ownership of the operation object.
win_iocp_socket_recv_op* o(static_cast<win_iocp_socket_recv_op*>(base));
ptr p = { lslboost::asio::detail::addressof(o->handler_), o, o };
BOOST_ASIO_HANDLER_COMPLETION((o));
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
// Check whether buffers are still valid.
if (owner)
{
buffer_sequence_adapter<lslboost::asio::mutable_buffer,
MutableBufferSequence>::validate(o->buffers_);
}
#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
socket_ops::complete_iocp_recv(o->state_, o->cancel_token_,
buffer_sequence_adapter<lslboost::asio::mutable_buffer,
MutableBufferSequence>::all_empty(o->buffers_),
ec, bytes_transferred);
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made. Even if we're not about to make an upcall, a
// sub-object of the handler may be the true owner of the memory associated
// with the handler. Consequently, a local copy of the handler is required
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::binder2<Handler, lslboost::system::error_code, std::size_t>
handler(o->handler_, ec, bytes_transferred);
p.h = lslboost::asio::detail::addressof(handler.handler_);
p.reset();
// Make the upcall if required.
if (owner)
{
fenced_block b(fenced_block::half);
BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
lslboost_asio_handler_invoke_helpers::invoke(handler, handler.handler_);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
}
示例6: getTempPath
bfs::path
getTempPath(const bfs::path& tempDir,
const string& prefix)
{
bfs::path rval;
bfs::path p = tempDir / bfs::path(prefix + "-XXXXXX");
char* tmpl = new char[p.string().size() + 1];
strcpy(tmpl, p.c_str());
char* s = ::mktemp(tmpl);
if (!s) {
boost::system::error_code ec(errno, boost::system::system_category());
throw bfs::filesystem_error("::mktemp fails", tempDir, bfs::path(prefix), ec);
}
rval = s;
delete[] s;
return rval;
}
示例7: ec
void LoopbackPhysicalLayerAsync::CheckForReadDispatch()
{
if(mReadSize > 0 && mWritten.size() > 0) {
size_t num = (mReadSize < mWritten.size()) ? mReadSize : mWritten.size();
for(size_t i=0; i<num; ++i) {
mpReadBuff[i] = mWritten.front();
mWritten.pop_front();
}
mReadSize = 0;
error_code ec(errc::success, get_generic_category());
mpService->post(bind(&LoopbackPhysicalLayerAsync::OnReadCallback, this, ec, mpReadBuff, num));
}
}
示例8: do_complete
static void do_complete(void* owner, operation* base,
const boost::system::error_code& result_ec,
std::size_t bytes_transferred)
{
boost::system::error_code ec(result_ec);
// Take ownership of the operation object.
win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
if (owner)
{
// Check whether buffers are still valid.
buffer_sequence_adapter<boost::asio::mutable_buffer,
MutableBufferSequence>::validate(o->buffers_);
}
#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
// Map non-portable errors to their portable counterparts.
if (ec.value() == ERROR_HANDLE_EOF)
ec = boost::asio::error::eof;
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made. Even if we're not about to make an upcall, a
// sub-object of the handler may be the true owner of the memory associated
// with the handler. Consequently, a local copy of the handler is required
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::binder2<Handler, boost::system::error_code, std::size_t>
handler(o->handler_, ec, bytes_transferred);
p.h = boost::asio::detail::addressof(handler.handler_);
p.reset();
// Make the upcall if required.
if (owner)
{
fenced_block b(fenced_block::half);
BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
w.complete(handler, handler.handler_);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
}
示例9: ec
bool PluginWebView::OnAttach()
{
EvtManagerTop& ec(wm.evtmgr);
ec.link_a<String>("Webview.script");
ec.table["Webview.script"].ref<String>();
ec.append(new EvtCommand("Webview.Exec"));
ec.append(new EvtCommand("Webview.Clear"));
AttachEvent("Webview.Exec");
AttachEvent("Webview.Clear");
WndModelWvScript* pmdl=new WndModelWvScript(wm);
ec.append(pmdl);
ec.gp_beg("OtherWindow");
ec.gp_add(new EvtCommandShowModel("Webview.Script",pmdl));
ec.gp_end();
ec.gp_beg(_kT("Webview.Page"));
ec.gp_add("Forward");
ec.gp_end();
ec.gp_beg("Menu.Extra");
ec.gp_add("Webview.Page");
ec.gp_end();
ec["Webview.Page"].flags.add(EvtCommand::FLAG_HIDE_UI);
ec.gp_beg(_kT("tb.WebView"));
ec.gp_add(new EvtCommandCtrl("WebView.URL","searchctrl",WndProperty().width(320)));
ec.gp_add(new EvtCommand(_kT("WebView.Go")));
ec.gp_end();
AttachEvent("WebView.URL");
AttachEvent("WebView.Go");
ec.gp_beg("ToolBar.default");
ec.gp_add("tb.WebView");
ec.gp_end();
return true;
}
示例10: ec
/**
* Catches an entity which is close to the given position 'pos'.
*
* @param pos A graphic coordinate.
* @param level The level of resolving for iterating through the entity
* container
* @enType, only search for a particular entity type
* @return Pointer to the entity or NULL.
*/
RS_Entity* RS_Snapper::catchEntity(const RS_Vector& pos, RS2::EntityType enType,
RS2::ResolveLevel level) {
RS_DEBUG->print("RS_Snapper::catchEntity");
// std::cout<<"RS_Snapper::catchEntity(): enType= "<<enType<<std::endl;
// set default distance for points inside solids
RS_EntityContainer ec(NULL,false);
for(RS_Entity* en= container->firstEntity(level);en!=NULL;en=container->nextEntity(level)){
if(en->isVisible()==false) continue;
if(en->rtti() != enType && RS2::isContainer(enType)){
//whether this entity is a member of member of the type enType
RS_Entity* parent(en->getParent());
bool matchFound(false);
while(parent != NULL) {
// std::cout<<"RS_Snapper::catchEntity(): parent->rtti()="<<parent->rtti()<<" enType= "<<enType<<std::endl;
if(parent->rtti() == enType) {
matchFound=true;
break;
}
parent=parent->getParent();
}
if(matchFound==false) continue;
}
ec.addEntity(en);
}
if (ec.count() == 0 ) return NULL;
double dist(0.);
RS_Entity* entity = ec.getNearestEntity(pos, &dist, RS2::ResolveNone);
int idx = -1;
if (entity!=NULL && entity->getParent()!=NULL) {
idx = entity->getParent()->findEntity(entity);
}
if (entity!=NULL && dist<=getSnapRange()) {
// highlight:
RS_DEBUG->print("RS_Snapper::catchEntity: found: %d", idx);
return entity;
} else {
RS_DEBUG->print("RS_Snapper::catchEntity: not found");
return NULL;
}
}
示例11: ec
void RS_ActionModifyOffset::mouseMoveEvent(QMouseEvent* e) {
// RS_DEBUG->print("RS_ActionModifyOffset::mouseMoveEvent begin");
data->coord=snapPoint(e);
RS_EntityContainer ec(nullptr,true);
for(auto en: *container){
if(en->isSelected()) ec.addEntity(en->clone());
}
if(ec.isEmpty()) return;
RS_Modification m(ec, nullptr, false);
m.offset(*data);
deletePreview();
preview->addSelectionFrom(ec);
drawPreview();
}
示例12: CreateNamedPipeW
void PipeNode::doListen(const std::wstring & name)
{
HANDLE handle = CreateNamedPipeW((L"\\\\.\\pipe\\" + name).c_str(), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, 0x1000, 0x1000, 0, NULL);
pipe_.reset(new boost::asio::windows::stream_handle(ioService_, handle));
boost::asio::windows::overlapped_ptr overlapped(ioService_, boost::bind(&PipeNode::handleConnected, this, _1, name));
bool ok = ConnectNamedPipe(pipe_->native(), overlapped.get()) != FALSE;
DWORD error = GetLastError();
if(!ok && error != ERROR_IO_PENDING)
{
boost::system::error_code ec(error, boost::asio::error::get_system_category());
overlapped.complete(ec, 0);
} else {
overlapped.release();
}
}
示例13: TEST
/* ****************************************************************************
*
* response -
*
*/
TEST(UpdateContextAvailabilitySubscriptionRequest, response)
{
UpdateContextAvailabilitySubscriptionResponse ucas;
StatusCode ec(SccBadRequest, "Detail");
UpdateContextAvailabilitySubscriptionResponse ucas2(ec);
std::string out;
utInit();
EXPECT_EQ(ucas2.errorCode.code, SccBadRequest);
ucas.subscriptionId.set("012345678901234567890123");
out = ucas.check("");
EXPECT_EQ("OK", out);
utExit();
}
开发者ID:telefonicaid,项目名称:fiware-orion,代码行数:23,代码来源:UpdateContextAvailabilitySubscriptionRequest_test.cpp
示例14: main
void main(void)
{
pr();
lev1();
choose();
system("cls");
pr();
gotoxy(1,11);
printf("반드시 프로그램 경로까지 입력해야 하며( Ex. C:\\test.txt)");
gotoxy(1,12);
printf("AEGIS프로그램과 같은 폴더내에 있는 경우는 경로를 생략해도 됩니다.");
gotoxy(1,14);
printf("※ 파일 이름에 띄어쓰기가 있는 경우에는 올바르게 실행되지 않습니다!");
gotoxy(1,8);
printf("잠금 또는 잠금해제(암호화 또는 복호화)할 파일명(확장자 필수!!) : ");
scanf("%s",&inf);
ec();
}
示例15: pipe_select_interrupter
// Constructor.
pipe_select_interrupter()
{
int pipe_fds[2];
if (pipe(pipe_fds) == 0)
{
read_descriptor_ = pipe_fds[0];
::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK);
write_descriptor_ = pipe_fds[1];
::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK);
}
else
{
asio::error_code ec(errno,
asio::error::get_system_category());
asio::system_error e(ec, "pipe_select_interrupter");
boost::throw_exception(e);
}
}