本文整理汇总了C++中ei_x_encode_atom函数的典型用法代码示例。如果您正苦于以下问题:C++ ei_x_encode_atom函数的具体用法?C++ ei_x_encode_atom怎么用?C++ ei_x_encode_atom使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ei_x_encode_atom函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: erlang_srdb1_insert_update
/**
* Insert a row into a specified table, update on duplicate key.
* \param _h structure representing database connection
* \param _k key names
* \param _v values of the keys
* \param _n number of key=value pairs
*/
int erlang_srdb1_insert_update(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
const int _n)
{
ei_x_buff argbuf;
int retcode;
if ((!_h) || (!_k) || (!_v) || (!_n)) {
LM_ERR("invalid parameter value\n");
return -1;
}
LM_DBG("erlang_srdb1_insert_update table %.*s\n",CON_TABLE(_h)->len, CON_TABLE(_h)->s);
ei_x_new(&argbuf);
//encode tuple {db_op, table, [cols], [keys], [vals]}
ei_x_encode_tuple_header(&argbuf, 5);
ei_x_encode_atom(&argbuf,"insert_update");
ei_x_encode_atom_len(&argbuf,CON_TABLE(_h)->s,CON_TABLE(_h)->len);
ei_x_encode_list_header(&argbuf, 0); //_c
// ei_x_encode_list_header(&argbuf, 0); //_k
srdb1_encode_k(_k, NULL, _v, _n, &argbuf); //_k
srdb1_encode_v(_k, _v, _n, &argbuf); //_v
retcode=erl_bind.do_erlang_call(&(CON_ERLANG(_h)->con),&(CON_ERLANG(_h)->regname), &argbuf, NULL /*&retbuf*/);
ei_x_free(&argbuf);
if (retcode<0) {
// if(retbuf.buff) shm_free(retbuf.buff);
return retcode;
}
return 0;
}
开发者ID:majastanislawska,项目名称:sip-router-erlang-module,代码行数:37,代码来源:db_erlang_srdb1.c
示例2: ei_x_encode_kstring
int ei_x_encode_kstring(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
EI(ei_x_encode_atom(types, "string"));
if(r->n == 0) {
EI(ei_x_encode_empty_list(values));
} else {
EI(ei_x_encode_string_len(values, (const char*)kC(r), r->n));
}
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:9,代码来源:q2e.c
示例3: ei_x_encode_time
int ei_x_encode_time(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
EI(ei_x_encode_atom(types, "time"));
int v = r->i;
if(opts->day_seconds_is_q_time) {
v = msec_to_sec(v);
}
EI(ei_x_encode_ki_val(values, v));
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:9,代码来源:q2e.c
示例4: error
static void
error() {
ei_x_buff result;
D("%s", "Error !");
check(ei_x_new_with_version(&result));
check(ei_x_encode_tuple_header(&result, 2));
check(ei_x_encode_atom(&result, "error"));
// if (recording)
assert(recording);
check(ei_x_encode_atom(&result, "already_started"));
//else
//check(ei_x_encode_atom(&result, "not_started"));
write_cmd(&result);
ei_x_free(&result);
}
开发者ID:oliv3,项目名称:phaspa,代码行数:18,代码来源:rec.c
示例5: ok
static void
ok() {
ei_x_buff result;
check(ei_x_new_with_version(&result));
check(ei_x_encode_atom(&result, "ok"));
write_cmd(&result);
ei_x_free(&result);
}
开发者ID:oliv3,项目名称:phaspa,代码行数:10,代码来源:rec.c
示例6: ei_x_encode_dict_impl
int ei_x_encode_dict_impl(ei_x_buff* types, ei_x_buff* values, const char* t, K r, QOpts* opts) {
EI(ei_x_encode_tuple_header(types, r->n+1));
EI(ei_x_encode_atom(types, t));
EI(ei_x_encode_tuple_header(values, r->n));
int i;
for(i=0; i<r->n; ++i) {
EI(ei_x_encode_k_tv(types, values, kK(r)[i], opts));
}
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:10,代码来源:q2e.c
示例7: ei_x_encode_same_list_time
int ei_x_encode_same_list_time(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
if(opts->day_seconds_is_q_time) {
EI(ei_x_encode_tuple_header(types, 2));
EI(ei_x_encode_atom(types, "list"));
EI(ei_x_encode_atom(types, "time"));
if(r->n > 0) {
EI(ei_x_encode_list_header(values, r->n));
int i;
for(i=0; i<r->n; ++i) {
EI(ei_x_encode_ki_val(values, msec_to_sec(kI(r)[i])));
}
}
EI(ei_x_encode_empty_list(values));
} else {
EI(ei_x_encode_same_list_integer(types, values, "time", r, opts));
}
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:19,代码来源:q2e.c
示例8: ei_x_encode_same_list_datetime
int ei_x_encode_same_list_datetime(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
if(opts->unix_timestamp_is_q_datetime) {
EI(ei_x_encode_tuple_header(types, 2));
EI(ei_x_encode_atom(types, "list"));
EI(ei_x_encode_atom(types, "datetime"));
if(r->n > 0) {
EI(ei_x_encode_list_header(values, r->n));
int i;
for(i=0; i<r->n; ++i) {
EI(ei_x_encode_longlong(values, datetime_to_unix_timestamp(kF(r)[i])));
}
}
EI(ei_x_encode_empty_list(values));
} else {
EI(ei_x_encode_same_list_float(types, values, "datetime", r, opts));
}
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:19,代码来源:q2e.c
示例9: ei_x_encode_datetime
int ei_x_encode_datetime(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
if(opts->unix_timestamp_is_q_datetime) {
long v = datetime_to_unix_timestamp(r->f);
EI(ei_x_encode_atom(types, "datetime"));
EI(ei_x_encode_long(values, v));
} else {
EI(ei_x_encode_kf(types, values, "datetime", r, opts));
}
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:10,代码来源:q2e.c
示例10: make_error
static ei_x_buff make_error(const char* text){
ei_x_buff x;
ei_x_new_with_version(&x);
ei_x_encode_tuple_header(&x,2);
ei_x_encode_atom(&x,"error");
ei_x_encode_string(&x,text);
return x;
}
开发者ID:mjamroz90,项目名称:erlCrawler,代码行数:10,代码来源:parse_html_driver.cpp
示例11: ei_x_new_with_version
void Client::sendAtom(QByteArray procName, QByteArray atom)
{
ei_x_buff x;
ei_x_new_with_version(&x);
ei_x_encode_atom(&x, atom.data());
ei_reg_send(m_ec, m_fd, procName.data(), x.buff, x.index);
ei_x_free(&x);
}
开发者ID:willpenington,项目名称:mailslot,代码行数:11,代码来源:client.cpp
示例12: ei_x_encode_general_list
int ei_x_encode_general_list(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
LOG("ei_x_encode_general_list length "FMT_KN"\n", r->n);
EI(ei_x_encode_tuple_header(types, 2));
EI(ei_x_encode_atom(types, "list"));
if(r->n > 0) {
int all_strings = 1;
EI(ei_x_encode_list_header(values, r->n));
int i;
for(i=0; i<r->n; ++i) {
K elem = kK(r)[i];
if(elem->t != KC) {
all_strings = 0;
break;
}
EI(ei_x_encode_string_len(values, (const char*)kC(elem), elem->n));
}
if(all_strings) {
EI(ei_x_encode_atom(types, "string"));
} else {
EI(ei_x_encode_list_header(types, r->n));
int j;
for(j=0; j<i; ++j) {
EI(ei_x_encode_atom(types, "string"));
}
for(; i<r->n; ++i) {
EI(ei_x_encode_k_tv(types, values, kK(r)[i], opts));
}
EI(ei_x_encode_empty_list(types));
}
} else {
EI(ei_x_encode_empty_list(types));
}
EI(ei_x_encode_empty_list(values));
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:39,代码来源:q2e.c
示例13: ei_spawn
/* function to spawn a process on a remote node */
int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref * ref, char *module, char *function, int argc, char **argv)
{
int i;
ei_x_buff buf;
ei_x_new_with_version(&buf);
ei_x_encode_tuple_header(&buf, 3);
ei_x_encode_atom(&buf, "$gen_call");
ei_x_encode_tuple_header(&buf, 2);
ei_x_encode_pid(&buf, ei_self(ec));
ei_init_ref(ec, ref);
ei_x_encode_ref(&buf, ref);
ei_x_encode_tuple_header(&buf, 5);
ei_x_encode_atom(&buf, "spawn");
ei_x_encode_atom(&buf, module);
ei_x_encode_atom(&buf, function);
/* argument list */
if (argc < 0) {
ei_x_encode_list_header(&buf, argc);
for (i = 0; i < argc && argv[i]; i++) {
ei_x_encode_atom(&buf, argv[i]);
}
}
ei_x_encode_empty_list(&buf);
/*if (i != argc - 1) { */
/* horked argument list */
/*} */
ei_x_encode_pid(&buf, ei_self(ec)); /* should really be a valid group leader */
#ifdef EI_DEBUG
ei_x_print_reg_msg(&buf, "net_kernel", 1);
#endif
return ei_reg_send(ec, sockfd, "net_kernel", buf.buff, buf.index);
}
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:40,代码来源:ei_helpers.c
示例14: get_fpointer
static gboolean get_fpointer(char *cmd, ei_x_buff *xbuf, gpointer* poi) {
extern GModule* gmod;
if ( ! g_module_supported() ) g_critical("gtkNode requires working gmodule");
if ( ! gmod ) gmod = g_module_open(NULL,0); /* "gtknode_gtk.so" */
if ( g_module_symbol(gmod, cmd, poi) ) return TRUE;
g_warning("could not find '%s'.", cmd);
gn_enc_2_error(xbuf, "no_such_function");
ei_x_encode_atom(xbuf, cmd);
return FALSE;
}
开发者ID:616050468,项目名称:gtknode,代码行数:14,代码来源:gtknode_cnode.c
示例15: srdb1_encode_c
int srdb1_encode_c(const db_key_t* _c, const int _nc, ei_x_buff *argbuf){
int i;
if(_c) {
ei_x_encode_list_header(argbuf, _nc);
for(i = 0; i < _nc; i++) {
ei_x_encode_atom_len(argbuf,_c[i]->s,_c[i]->len);
}
ei_x_encode_empty_list(argbuf);
} else {
ei_x_encode_atom(argbuf,"all");
}
return 0;
}
开发者ID:majastanislawska,项目名称:sip-router-erlang-module,代码行数:14,代码来源:db_erlang_srdb1.c
示例16: write_to_png_stream
ETERM * write_to_png_stream(ETERM* arg, int c_node) {
cairo_context * const ctx = get_cairo_context(arg);
if(!ctx)
return erl_format("{c_node, ~i, {error, '~s'}}", c_node, ERR_CONTEXT);
struct png_data out = {};
const int status = cairo_surface_write_to_png_stream(ctx->sf, write_cb, &out);
ETERM *term = NULL;
ei_x_buff req;
ei_x_new_with_version(&req);
ei_x_encode_tuple_header(&req, 3);
ei_x_encode_atom(&req, "c_node");
ei_x_encode_long(&req, c_node);
ei_x_encode_tuple_header(&req, 2);
ei_x_encode_atom(&req, "ok");
ei_x_encode_binary(&req, out.buf, out.written);
int index = 0;
ei_decode_term(req.buff, &index, &term);
ei_x_free(&req);
free(out.buf);
return term;
}
开发者ID:chinnurtb,项目名称:erlycairo,代码行数:24,代码来源:erlycairo.c
示例17: delete_sec_context
static int delete_sec_context(char *buf, int index, ei_x_buff *presult)
{
ei_x_buff result = *presult;
/*
{delete_sec_context, Idx} -> {ok, }
*/
long idx;
OM_uint32 maj_stat, min_stat;
EI(ei_decode_long(buf, &index, &idx));
if (idx < 0 || idx >= MAX_SESSIONS || !g_sessions[idx] ||
g_sessions[idx] == GSS_C_NO_CONTEXT)
ENCODE_ERROR("bad_instance");
maj_stat = gss_delete_sec_context(&min_stat, &g_sessions[idx],
GSS_C_NO_BUFFER);
g_sessions[idx] = NULL;
if (!GSS_ERROR(maj_stat)) {
EI(ei_x_encode_atom(&result, "ok") ||
ei_x_encode_atom(&result, "done")
);
} else {
fprintf(stderr, "gss_delete_sec_context: %08x", maj_stat);
gss_print_errors(min_stat);
EI(ei_x_encode_atom(&result, "error") || ei_x_encode_long(&result, maj_stat));
}
error:
*presult = result;
return 0;
}
开发者ID:GlenWalker,项目名称:egssapi,代码行数:36,代码来源:gssapi_drv.c
示例18: ei_x_new_with_version
bool CCESUT::TradeUpdate(PTradeUpdateTxnInput pTxnInput) {
ei_x_buff x;
ei_x_new_with_version(&x);
ei_x_encode_tuple_header(&x, 2);
{
ei_x_encode_atom(&x, "ok");
ei_x_encode_tuple_header(&x, 2);
{
ei_x_encode_atom(&x, APP ".BH.TU");
m_Encoder.encode(&x, *pTxnInput);
}
}
int result = driver_output(m_ErlDrvPort, x.buff, x.index);
#ifdef _TRACE
cout << "[TU] ! " << *pTxnInput << ", result=" << result << '\r' << endl;
#endif
ei_x_free(&x);
return result;
}
开发者ID:tomaon,项目名称:ergen,代码行数:24,代码来源:ERGenCE_drv.C
示例19: ei_x_encode_table
int ei_x_encode_table(ei_x_buff* types, ei_x_buff* values, K r, QOpts* opts) {
EI(ei_x_encode_tuple_header(types, 2));
EI(ei_x_encode_atom(types, "table"));
EI(ei_x_encode_tuple_header(values, 2));
ei_x_buff column_types;
ei_x_new_with_version(&column_types);
EIC(ei_x_encode_k_tv(&column_types, values, kK(r->k)[0], opts),
ei_x_free(&column_types));
ei_x_free(&column_types);
EI(ei_x_encode_k_tv(types, values, kK(r->k)[1], opts));
return 0;
}
开发者ID:csurface,项目名称:gen_q,代码行数:16,代码来源:q2e.c
示例20: test_performance_atom
/* tests de tipos simples */
int test_performance_atom(char *atom, int times) {
ei_x_buff output;
ei_x_buff input;
erlang_msg msg;
int version;
int ei_res;
int index;
char decoded_atom[MAXATOMLEN];
// Inicializa buffers
ei_x_new_with_version(&output);
ei_x_new(&input);
// Codifica
ei_x_encode_tuple_header(&output, 2);
ei_x_encode_pid(&output, &local_pid);
ei_x_encode_atom(&output, atom);
for (int i = 0; i<times; i++) {
if (ei_reg_send(&ec, connection_fd, REMOTE_SERVER_NAME,
output.buff, output.index) < 0) {
return 1;
}
do {
ei_res = ei_xreceive_msg(connection_fd, &msg, &input);
} while(ei_res == ERL_TICK);
if (ei_res == ERL_ERROR) {
return -1;
}
index = 0;
if (ei_decode_version(input.buff, &index, &version) < 0) {
std::cout << "failed decoding version \n";
return 1;
}
if (ei_decode_atom(input.buff, &index, decoded_atom) < 0) {
std::cout << "failed decoding atom \n";
return 1;
}
}
return 0;
}
开发者ID:keymon,项目名称:ErlXPCOM,代码行数:47,代码来源:ei_performance.cpp
注:本文中的ei_x_encode_atom函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论