本文整理汇总了C++中ec函数的典型用法代码示例。如果您正苦于以下问题:C++ ec函数的具体用法?C++ ec怎么用?C++ ec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:Ahbee,项目名称:Cinder,代码行数:48,代码来源:win_iocp_socket_recvfrom_op.hpp
示例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();
}
开发者ID:telefonicaid,项目名称:fiware-orion,代码行数:20,代码来源:NotifyContextRequest_test.cpp
示例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);
}
开发者ID:adk9,项目名称:hpx,代码行数:16,代码来源:backtrace.cpp
示例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;
}
开发者ID:rwestenberger,项目名称:Garfield,代码行数:16,代码来源:EnergyMesh.cpp
示例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;
}
}
开发者ID:ALuehmann,项目名称:labstreaminglayer,代码行数:46,代码来源:win_iocp_socket_recv_op.hpp
示例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;
}
开发者ID:Go-LiDth,项目名称:platform,代码行数:17,代码来源:bpfile_UNIX.cpp
示例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));
}
}
开发者ID:emezeske,项目名称:dnp3,代码行数:17,代码来源:LoopbackPhysicalLayerAsync.cpp
示例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;
}
}
开发者ID:boostorg,项目名称:asio,代码行数:46,代码来源:win_iocp_handle_read_op.hpp
示例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;
}
开发者ID:xuanya4202,项目名称:ew_base,代码行数:45,代码来源:plugin_webview.cpp
示例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;
}
}
开发者ID:RobertvonKnobloch,项目名称:LibreCAD,代码行数:54,代码来源:rs_snapper.cpp
示例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();
}
开发者ID:rmamba,项目名称:LibreCAD,代码行数:18,代码来源:rs_actionmodifyoffset.cpp
示例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();
}
}
开发者ID:spolitov,项目名称:lib,代码行数:18,代码来源:PipeNode.cpp
示例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();
}
开发者ID:Danielay,项目名称:AEGIS,代码行数:18,代码来源:AEGIS.cpp
示例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);
}
}
开发者ID:DoBuiThao,项目名称:hoxchess,代码行数:19,代码来源:pipe_select_interrupter.hpp
示例16: ec
void QLCFixtureEditor::slotAddChannel()
{
EditChannel ec(this);
bool ok = false;
while (ok == false)
{
if (ec.exec() == QDialog::Accepted)
{
if (m_fixtureDef->channel(ec.channel()->name()) != NULL)
{
QMessageBox::warning(this,
QString("Channel already exists"),
QString("A channel by the name \"") +
ec.channel()->name() +
QString("\" already exists!"));
ok = false;
}
else if (ec.channel()->name().length() == 0)
{
QMessageBox::warning(this,
QString("Channel has no name"),
QString("You must give the channel a descriptive name!"));
ok = false;
}
else
{
/* Create a new channel to the fixture */
m_fixtureDef->addChannel(
new QLCChannel(ec.channel()));
refreshChannelList();
setModified();
ok = true;
}
}
else
{
ok = true;
}
}
}
开发者ID:speakman,项目名称:qlc,代码行数:44,代码来源:fixtureeditor.cpp
示例17: main
int main() {
std::vector<Node *> nodes;
std::vector<Edge *> edges;
N na("a");
N nb("b");
N nc("c");
N nd("d");
E ea(&na, &nb, 6);
E eb(&nb, &nc, 5);
E ec(&nc, &nd, 4);
E ed(&nd, &na, 3);
E ee(&na, &nc, 2);
E ef(&nb, &nd, 1);
nodes.push_back(&na);
nodes.push_back(&nb);
nodes.push_back(&nc);
nodes.push_back(&nd);
edges.push_back(&ea);
edges.push_back(&eb);
edges.push_back(&ec);
edges.push_back(&ed);
edges.push_back(&ee);
edges.push_back(&ef);
Kruskal k(nodes, edges);
float w = k.solve();
std::cout << "Tree weight: " << std::endl << w << std::endl;
std::cout << "Edges: " << std::endl;
std::vector<Edge *> mst = k.getEdges();
for (std::vector<Edge *>::iterator it = mst.begin(); it != mst.end();
it++) {
N *a = (N *) (*it)->a;
N *b = (N *) (*it)->b;
std::cout << a->name << " - " << b->name << std::endl;
}
return 0;
}
开发者ID:stbnps,项目名称:Kruskal-building-block,代码行数:44,代码来源:main.cpp
示例18: TEST
/* ****************************************************************************
*
* constructors -
*/
TEST(SubscribeContextAvailabilityResponse, constructors)
{
SubscribeContextAvailabilityResponse* scar1 = new SubscribeContextAvailabilityResponse();
SubscribeContextAvailabilityResponse scar2("012345678901234567890123", "PT1S");
StatusCode ec(SccBadRequest, "Detail");
SubscribeContextAvailabilityResponse scar3("012345678901234567890124", ec);
utInit();
EXPECT_EQ("", scar1->subscriptionId.get());
delete(scar1);
EXPECT_EQ("012345678901234567890123", scar2.subscriptionId.get());
EXPECT_EQ("012345678901234567890124", scar3.subscriptionId.get());
EXPECT_EQ(SccBadRequest, scar3.errorCode.code);
utExit();
}
开发者ID:telefonicaid,项目名称:fiware-orion,代码行数:23,代码来源:SubscribeContextAvailabilityResponse_test.cpp
示例19: 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_socket_connect_op* o(
static_cast<win_iocp_socket_connect_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
handler_work<Handler> w(o->handler_);
if (owner)
{
if (o->connect_ex_)
socket_ops::complete_iocp_connect(o->socket_, ec);
else
ec = o->ec_;
}
BOOST_ASIO_HANDLER_COMPLETION((*o));
// 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::binder1<Handler, boost::system::error_code>
handler(o->handler_, ec);
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_));
w.complete(handler, handler.handler_);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
}
开发者ID:CustomOrthopaedics,项目名称:OTS-Boost,代码行数:42,代码来源:win_iocp_socket_connect_op.hpp
示例20: do_completion_impl
static void do_completion_impl(operation* op,
DWORD last_error, size_t bytes_transferred)
{
// Take ownership of the operation object.
typedef read_operation<MutableBufferSequence, Handler> op_type;
op_type* handler_op(static_cast<op_type*>(op));
typedef handler_alloc_traits<Handler, op_type> alloc_traits;
handler_ptr<alloc_traits> ptr(handler_op->handler_, handler_op);
#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
// Check whether buffers are still valid.
typename MutableBufferSequence::const_iterator iter
= handler_op->buffers_.begin();
typename MutableBufferSequence::const_iterator end
= handler_op->buffers_.end();
while (iter != end)
{
boost::asio::mutable_buffer buffer(*iter);
boost::asio::buffer_cast<char*>(buffer);
++iter;
}
#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING)
// Check for the end-of-file condition.
boost::system::error_code ec(last_error,
boost::asio::error::get_system_category());
if (!ec && bytes_transferred == 0 || last_error == 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.
Handler handler(handler_op->handler_);
// Free the memory associated with the handler.
ptr.reset();
// Call the handler.
boost_asio_handler_invoke_helpers::invoke(
bind_handler(handler, ec, bytes_transferred), &handler);
}
开发者ID:SpliFF,项目名称:mingwlibs,代码行数:42,代码来源:win_iocp_handle_service.hpp
注:本文中的ec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论