本文整理汇总了C++中parse_data函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_data函数的具体用法?C++ parse_data怎么用?C++ parse_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parse_deconvolutional
deconvolutional_layer parse_deconvolutional(list *options, size_params params)
{
int n = option_find_int(options, "filters",1);
int size = option_find_int(options, "size",1);
int stride = option_find_int(options, "stride",1);
char *activation_s = option_find_str(options, "activation", "logistic");
ACTIVATION activation = get_activation(activation_s);
int batch,h,w,c;
h = params.h;
w = params.w;
c = params.c;
batch=params.batch;
if(!(h && w && c)) error("Layer before deconvolutional layer must output image.");
deconvolutional_layer layer = make_deconvolutional_layer(batch,h,w,c,n,size,stride,activation);
char *weights = option_find_str(options, "weights", 0);
char *biases = option_find_str(options, "biases", 0);
parse_data(weights, layer.filters, c*n*size*size);
parse_data(biases, layer.biases, n);
#ifdef GPU
if(weights || biases) push_deconvolutional_layer(layer);
#endif
return layer;
}
开发者ID:yangmeitang,项目名称:darknet,代码行数:26,代码来源:parser.c
示例2: parse_convolutional
convolutional_layer parse_convolutional(list *options, size_params params)
{
int n = option_find_int(options, "filters",1);
int size = option_find_int(options, "size",1);
int stride = option_find_int(options, "stride",1);
int pad = option_find_int(options, "pad",0);
char *activation_s = option_find_str(options, "activation", "logistic");
ACTIVATION activation = get_activation(activation_s);
int batch,h,w,c;
h = params.h;
w = params.w;
c = params.c;
batch=params.batch;
if(!(h && w && c)) error("Layer before convolutional layer must output image.");
int batch_normalize = option_find_int_quiet(options, "batch_normalize", 0);
int binary = option_find_int_quiet(options, "binary", 0);
int xnor = option_find_int_quiet(options, "xnor", 0);
convolutional_layer layer = make_convolutional_layer(batch,h,w,c,n,size,stride,pad,activation, batch_normalize, binary, xnor);
layer.flipped = option_find_int_quiet(options, "flipped", 0);
layer.dot = option_find_float_quiet(options, "dot", 0);
char *weights = option_find_str(options, "weights", 0);
char *biases = option_find_str(options, "biases", 0);
parse_data(weights, layer.filters, c*n*size*size);
parse_data(biases, layer.biases, n);
#ifdef GPU
if(weights || biases) push_convolutional_layer(layer);
#endif
return layer;
}
开发者ID:EricDoug,项目名称:darknet,代码行数:32,代码来源:parser.c
示例3: handle_data
int handle_data(int fd1, int fd2, int fd3)
{
char buf1[MAX];
char buf2[MAX];
int data1[3];
int data2[3];
int data3[3];
char result[MAX];
read_line(fd1,buf1,sizeof(buf1));//读第一行
read_line(fd2,buf2,sizeof(buf2));
if(strcmp(buf1,"begin") != 0 || strcmp(buf2,"begin") != 0)//只要buf1 buf2中有一个不是以begin开头的 就不成立
{
return -1;
}
write(fd3,"begin",strlen("begin"));//把begin写到fd3所指的文件中去
write(fd3,"\n",1);//换行
memset(buf1,0,sizeof(buf1));//清空buf指针所指的内存中的内容
memset(buf2,0,sizeof(buf2));
read_line(fd1,buf1,sizeof(buf1));//读下一行
read_line(fd2,buf2,sizeof(buf2));
while(strcmp(buf1,"end") != 0 && strcmp(buf2,"end") != 0)//当buf1 buf2都没有到最后一行(end)时,进入循环
{
parse_data(buf1,data1);字符串转换成数字
parse_data(buf2,data2);
add(data1,data2,data3);
sprintf(result,"%d %d %d%c",data3[0],data3[1],data3[2],'\n');
write(fd3,result,strlen(result));//将进行加法运算后的数据写进fd3所指向的文件中
memset(buf1,0,sizeof(buf1));
memset(buf2,0,sizeof(buf2));
read_line(fd1,buf1,sizeof(buf1));
read_line(fd2,buf2,sizeof(buf2));
}
write(fd3,"end",strlen("end"));//将fd3所指的文件在最后面添上end 以表结束
write(fd3,"\n",1);//换行符
}
开发者ID:NJITPeiYuan,项目名称:Linux_address,代码行数:50,代码来源:main.c
示例4: parse_file
static int parse_file(const char *name)
{
int fd, size, result = 0;
char *data = 0;
fd = open(name, O_RDONLY);
if (fd < 0) return 0;
size = lseek(fd, 0, SEEK_END);
if (size < 0) goto parse_fail;
if (lseek(fd, 0, SEEK_SET) != 0)
goto parse_fail;
data = (char *)malloc(size+1);
if (!data) goto parse_fail;
if (read(fd, data, size) != size)
goto parse_fail;
data[size] = '\0';
result = parse_data(data, &confParser);
parse_fail:
if (data)
free(data);
close(fd);
return result;
}
开发者ID:4Fwolf,项目名称:mt6572_x201,代码行数:31,代码来源:custom_prop.c
示例5: NSC_DEBUG_MSG_STD
void CheckMKClient::send(connection_data con) {
try {
NSC_DEBUG_MSG_STD("Connection details: " + con.to_string());
if (con.ssl.enabled) {
#ifndef USE_SSL
NSC_LOG_ERROR_STD(_T("SSL not avalible (compiled without USE_SSL)"));
return response;
#endif
}
socket_helpers::client::client<check_mk::client::protocol> client(con, boost::shared_ptr<client_handler>(new client_handler()));
client.connect();
std::string dummy;
check_mk::packet packet = client.process_request(dummy);
boost::optional<scripts::command_definition<lua::lua_traits> > cmd = scripts_->find_command("check_mk", "c_callback");
if (cmd) {
parse_data(cmd->information, cmd->function, packet);
} else {
NSC_LOG_ERROR_STD("No check_mk callback found!");
}
//lua_runtime_->on_query()
client.shutdown();
} catch (std::runtime_error &e) {
NSC_LOG_ERROR_EXR("Failed to send", e);
} catch (std::exception &e) {
NSC_LOG_ERROR_EXR("Failed to send", e);
} catch (...) {
NSC_LOG_ERROR_EX("Failed to send");
}
}
开发者ID:TaylorMonacelli,项目名称:nscp,代码行数:29,代码来源:CheckMKClient.cpp
示例6: main
int main(int argc, char *argv[])
{
int s, t, len;
struct sockaddr_un remote;
char str[BUFLEN];
char sock_path[256] = { '\0' };
haproxy_dir = getenv("OPENSHIFT_HAPROXY_DIR");
app_name = getenv("OPENSHIFT_APP_NAME");
gear_uuid = getenv("OPENSHIFT_GEAR_UUID");
const char *gear_dns = getenv("OPENSHIFT_GEAR_DNS");
const char *beg = strchr(gear_dns, '-');
const char *end = strchr(gear_dns, '.');
gear_namespace = (char *)malloc(end - beg + 1);
strncpy(gear_namespace, beg + 1, end - beg - 1);
std::cout << "Gear dns:" << gear_dns << std::endl;
std::cout << "Gear namespace:" << gear_namespace << std::endl;
snprintf(sock_path, 256, "%s/run/stats", haproxy_dir);
signal(SIGPIPE, SIG_IGN);
while (1) {
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}
std::cout << "Gathering stats from HAProxy" << std::endl;
std::cout << "============================================" << std::endl << std::endl;
remote.sun_family = AF_UNIX;
strcpy(remote.sun_path, sock_path);
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
if (connect(s, (struct sockaddr *)&remote, len) == -1) {
perror("connect");
exit(1);
}
//printf("Connected!\n");
if (send(s, STATUS_CMD, strlen(STATUS_CMD), 0) == -1) {
perror("send");
exit(1);
}
std::string data = "";
while ((t = recv(s, str, BUFLEN, 0)) > 0) {
//write(STDOUT_FILENO, str, t);
data.append(str, t);
}
parse_data(data);
if (t < 0) perror("recv");
close(s);
sleep(3);
}
return 0;
}
开发者ID:carriercomm,项目名称:haproxy-ctld-cpp,代码行数:60,代码来源:haproxyctld.cpp
示例7: cgi_init_get
static void cgi_init_get()
{
char* buf;
if ((buf = getenv("QUERY_STRING")) != NULL && *buf) {
has_get = parse_data(buf, GET);
}
}
开发者ID:Jeremagician,项目名称:apricot,代码行数:7,代码来源:cgi.c
示例8: parse_include
void parse_include(char *lumpname)
{
int lumpnum;
char *lump, *end;
char *saved_rover;
if(-1 == (lumpnum = W_GetNumForName(lumpname)) )
{
script_error("include lump '%s' not found!\n", lumpname);
return;
}
lump = W_CacheLumpNum(lumpnum, PU_STATIC);
// realloc bigger for NULL at end
lump = Z_Realloc(lump, W_LumpLength(lumpnum)+10, PU_STATIC, NULL);
saved_rover = rover; // save rover during include
rover = lump; end = lump+W_LumpLength(lumpnum);
*end = 0;
// preprocess the include
// we assume that it does not include sections or labels or
// other nasty things
process_find_char(lump, 0);
// now parse the lump
parse_data(lump, end);
// restore rover
rover = saved_rover;
// free the lump
Z_Free(lump);
}
开发者ID:dorienh,项目名称:smmu,代码行数:35,代码来源:t_prepro.c
示例9: main
int main()
{
parse_data();
while(T <= 10){
printf("Test %d:\n", T++);
N = extract_int();
extract_string(bracets + 1);
M = extract_int();
build(1, 1, N);
while(M--){
operation = extract_int();
if(!operation){
printf("%s\n", !NODES[1].opening_excessive && !NODES[1].closing_excessive ? "YES" : "NO");
continue;
}
// flip it
// and let the update propagate through segmented tree.
bracets[operation] = bracets[operation] == ')' ? '(' : ')';
update(1, 1, N, operation);
}
}
return 0;
}
开发者ID:ChrisEelmaa,项目名称:SPOJ,代码行数:26,代码来源:BRCKTS.cpp
示例10: search_artist_thread
static gpointer
search_artist_thread(SearchData *data)
{
XmrService *srv = xmr_service_new();
GString *result_data = g_string_new("");
gchar *escape_keyword = curl_escape(data->keyword, 0);
gchar *url = g_strdup_printf(SEARCH_URL"%s", escape_keyword);
gint result = xmr_service_get_url_data(srv, url, result_data);
g_object_unref(srv);
if (result == CURLE_OK)
parse_data(data->box, result_data);
else
post_event(data->box, EVENT_NETWORK_ERROR, NULL);
g_free(url);
curl_free(escape_keyword);
g_string_free(result_data, TRUE);
post_event(data->box, EVENT_FINISH, NULL);
g_free(data->keyword);
g_free(data);
return NULL;
}
开发者ID:EmbolismSoil,项目名称:xmradio,代码行数:27,代码来源:xmrsearchbox.c
示例11: get_det_read
int16 get_det_read(int8 store, int8 display)
{
int8 r, record;
for(r=0;r<3;++r){
record = det_read(store, display);
if(record==2) break;
else{
fprintf(COM_A, "@RTY,%u\r\n", (r+1));
output_bit(VDET,OFF);
delay_ms(1000);
output_bit(VDET,ON);
delay_ms(1000);
cmd='K';
arg=detector_ch;
det_cmd();
delay_ms(1000);
cmd='L';
arg=detector_li;
det_cmd();
}
}
parse_data();
data_available = TRUE;
macro_flag = 900;
return (record);
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:30,代码来源:detector.c
示例12: parse_temp
int16 parse_temp()
{
int16 temp = 0;
temp = parse_data();
return (temp);
}
开发者ID:frazahod,项目名称:SUBGEN-NuLAB-EcoLAB-,代码行数:7,代码来源:detector.c
示例13: tracking_printall
retvalue tracking_printall(trackingdb t) {
struct cursor *cursor;
retvalue result, r;
struct trackedpackage *pkg;
const char *key, *value, *data;
size_t datalen;
r = table_newglobalcursor(t->table, &cursor);
if (!RET_IS_OK(r))
return r;
result = RET_NOTHING;
while (cursor_nextpair(t->table, cursor,
&key, &value, &data, &datalen)) {
r = parse_data(key, value, data, datalen, &pkg);
if (RET_IS_OK(r)) {
print(t->codename, pkg);
trackedpackage_free(pkg);
}
RET_UPDATE(result, r);
}
r = cursor_close(t->table, cursor);
RET_ENDUPDATE(result, r);
return result;
}
开发者ID:Noctem,项目名称:reprepro,代码行数:26,代码来源:tracking.c
示例14: seen_merge_cb
/* Look up the unique id in the new file, if it is there, compare the
* last change times, and ensure that the database uses the newer of
* the two */
static int seen_merge_cb(void *rockp,
const char *key, size_t keylen,
const char *newdata, size_t newlen)
{
int r = 0;
struct seen *seendb = (struct seen *)rockp;
struct seendata oldsd, newsd;
char *uniqueid = xstrndup(key, keylen);
int dirty = 0;
parse_data(newdata, newlen, &newsd);
if (seen_lockread(seendb, uniqueid, &oldsd)) {
dirty = 1; /* no record */
}
else {
if (newsd.lastuid > oldsd.lastuid) dirty = 1;
if (newsd.lastread > oldsd.lastread) dirty = 1;
}
if (dirty) {
/* write back data from new entry */
r = seen_write(seendb, uniqueid, &newsd);
}
free(uniqueid);
return r;
}
开发者ID:gnb,项目名称:cyrus-imapd,代码行数:32,代码来源:seen_db.c
示例15: tracking_tidyall
retvalue tracking_tidyall(trackingdb t) {
struct cursor *cursor;
retvalue result, r;
struct trackedpackage *pkg;
const char *key, *value, *data;
size_t datalen;
r = table_newglobalcursor(t->table, &cursor);
if (!RET_IS_OK(r))
return r;
result = RET_NOTHING;
while (cursor_nextpair(t->table, cursor,
&key, &value, &data, &datalen)) {
r = parse_data(key, value, data, datalen, &pkg);
if (RET_WAS_ERROR(r)) {
result = r;
break;
}
r = trackedpackage_tidy(t, pkg);
RET_UPDATE(result, r);
r = tracking_saveatcursor(t, cursor, pkg);
RET_UPDATE(result, r);
trackedpackage_free(pkg);
}
r = cursor_close(t->table, cursor);
RET_UPDATE(result, r);
return result;
}
开发者ID:Noctem,项目名称:reprepro,代码行数:30,代码来源:tracking.c
示例16: parse_data
void parse_data(aClient *robotptr) {
int next;
while((robotptr->read < robotptr->write)
&& ((robotptr->buffer[robotptr->read] == '\r')
|| (robotptr->buffer[robotptr->read] == '\n')))
robotptr->read++;
for(next=robotptr->read; next<=robotptr->write; next++) {
if ((robotptr->buffer[next] == '\r')
|| (robotptr->buffer[next] == '\n'))
break;
}
if (next<robotptr->write) {
robotptr->buffer[next]=0;
next++;
parse_line(robotptr);
robotptr->read=next;
parse_data(robotptr);
}
if (robotptr->read == robotptr->write) {
robotptr->read=robotptr->write=0;
} else {
bcopy((robotptr->buffer + robotptr->read),
(robotptr->buffer), (robotptr->write-robotptr->read));
robotptr->write-=robotptr->read;
robotptr->read=0;
}
}
开发者ID:blank4,项目名称:unrealircd,代码行数:31,代码来源:burst.c
示例17: output
args_t::args_t( int argc, const char * argv[] ) :
output( stdout ),
input( stdin ),
ambig( DEFAULT_AMBIG ),
data ( DEFAULT_DATA ),
counts_in_name ( DEFAULT_COUNTS_IN_NAME ),
quiet (false)
{
// skip arg[0], it's just the program name
for (int i = 1; i < argc; ++i ) {
const char * arg = argv[i];
if ( arg[0] == '-' && arg[1] == '-' ) {
if ( !strcmp( &arg[2], "help" ) ) help();
else
ERROR( "unknown argument: %s", arg );
}
else if ( arg[0] == '-' ) {
if ( !strcmp( &arg[1], "h" ) ) help();
else if ( arg[1] == 'o' ) parse_output( next_arg (i, argc, argv) );
else if ( arg[1] == 'a') parse_ambig( next_arg (i, argc, argv) );
else if ( arg[1] == 't') parse_data ( next_arg (i, argc, argv) );
else if ( arg[1] == 'd') parse_counts_in_name( next_arg (i, argc, argv) );
else if ( arg[1] == 'q') parse_quiet ( );
else
ERROR( "unknown argument: %s", arg );
}
else
if (i == argc-1) {
parse_input (arg);
} else {
ERROR( "unknown argument: %s", arg );
}
}
}
开发者ID:spond,项目名称:TN93,代码行数:35,代码来源:argparse_cf.cpp
示例18: ethernet_frame
public: ethernet_frame(::boost::uint8_t const* pkt, ::boost::uint32_t sz)
: p_hdr_(0),
p_hdr_8021q_(0),
p_data_(0),
data_sz_(0)
{
parse_data(pkt, sz);
}
开发者ID:sguazt,项目名称:dcsxx-network,代码行数:8,代码来源:ethernet.hpp
示例19: parse_connected
connected_layer parse_connected(list *options, size_params params)
{
int output = option_find_int(options, "output",1);
char *activation_s = option_find_str(options, "activation", "logistic");
ACTIVATION activation = get_activation(activation_s);
connected_layer layer = make_connected_layer(params.batch, params.inputs, output, activation);
char *weights = option_find_str(options, "weights", 0);
char *biases = option_find_str(options, "biases", 0);
parse_data(biases, layer.biases, output);
parse_data(weights, layer.weights, params.inputs*output);
#ifdef GPU
if(weights || biases) push_connected_layer(layer);
#endif
return layer;
}
开发者ID:yangmeitang,项目名称:darknet,代码行数:17,代码来源:parser.c
示例20: on_telemetry_received
void on_telemetry_received()
{
char buf[200];
size_t const data_len = get_telemetry_receiver_buffer_length();
read_telemetry_data(buf,data_len);
for (size_t i = 0; i < data_len; ++i){
parse_data(buf[i]);
}
}
开发者ID:ericyao2013,项目名称:quantracker,代码行数:9,代码来源:rx_telemetry.cpp
注:本文中的parse_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论