本文整理汇总了C++中print_map函数的典型用法代码示例。如果您正苦于以下问题:C++ print_map函数的具体用法?C++ print_map怎么用?C++ print_map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_map函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
//printf("Some random hashes:\n");
//printf("\tBazinga: %d\n", map_hash_key("Bazinga"));
//printf("\tFlabagoobie: %d\n", map_hash_key("Flabagoobie"));
//printf("\tScooby: %d\n", map_hash_key("Scooby"));
//printf("\tMcDooby: %d\n", map_hash_key("McDooby"));
//printf("\tagnizaB: %d\n", map_hash_key("agnizaB"));
Map map;
map_init(&map);
map_set(&map, "bazinga", "bazonga");
map_set(&map, "zabinga", "zabonga");
map_set(&map, "zabniga", "maponya");
map_set(&map, "kabanooga", "daboogawoofa");
MapItem *item;
print_map(&map);
map_get(&map, "abzinga");
printf("================================\n");
print_map(&map);
map_free(&map);
}
开发者ID:Najaf,项目名称:boba,代码行数:27,代码来源:bmaptest.c
示例2: ikev2_pld_eap
int
ikev2_pld_eap(struct iked *env, struct ikev2_payload *pld,
struct iked_message *msg, size_t offset, size_t left)
{
struct eap_header hdr;
struct eap_message *eap = NULL;
struct iked_sa *sa = msg->msg_sa;
size_t len;
if (ikev2_validate_eap(msg, offset, left, pld, &hdr))
return (-1);
len = betoh16(hdr.eap_length);
if (len < sizeof(*eap)) {
log_info("%s: %s id %d length %d", __func__,
print_map(hdr.eap_code, eap_code_map),
hdr.eap_id, betoh16(hdr.eap_length));
} else {
/* Now try to get the indicated length */
if ((eap = ibuf_seek(msg->msg_data, offset, len)) == NULL) {
log_debug("%s: invalid EAP length", __func__);
return (-1);
}
log_info("%s: %s id %d length %d EAP-%s", __func__,
print_map(eap->eap_code, eap_code_map),
eap->eap_id, betoh16(eap->eap_length),
print_map(eap->eap_type, eap_type_map));
}
if (eap_parse(env, sa, &hdr, msg->msg_response) == -1)
return (-1);
return (0);
}
开发者ID:toddfries,项目名称:OpenBSD-sbin-patches,代码行数:35,代码来源:ikev2_pld.c
示例3: main
int main(int argc, char* argv[]) {
//Set
std::cout << "Set:" << std::endl;
std::set<int> std_set;
std_set.insert(20);
std_set.insert(20);
std_set.insert(10);
print_container(std_set);
//MultiSet
std::cout << "MultiSet:" << std::endl;
std::multiset<int> std_multiset;
std_multiset.insert(20);
std_multiset.insert(20);
std_multiset.insert(10);
print_container(std_multiset);
//Map
std::cout << "Map:" << std::endl;
std::map<std::string, int> std_map;
std_map.insert(std::pair<std::string ,int>("Hello", 10));
std_map["World"]=20;
std_map.insert(std::pair<std::string ,int>("Hello", 20));
print_map(std_map);
//MultiMap
std::cout << "MultiMap:" << std::endl;
std::multimap<std::string, int> std_multimap;
std_multimap.insert(std::pair<std::string ,int>("Hello", 10));
std_multimap.insert(std::pair<std::string ,int>("World", 20));
std_multimap.insert(std::pair<std::string ,int>("Hello", 20));
print_map(std_multimap);
}
开发者ID:KIT-CSD-WS14-15,项目名称:LectureCode,代码行数:33,代码来源:AssociativeContainers.cpp
示例4: main
int main()
{
Stack s;
init_stack(&s);
int i = 0;
sElemType start = {
0,
{
1,
1,
}
};
sElemType curpos = start;
welcome();
printf("\n\n");
print_map();
printf("\n\nI'm going...........................\n\n");
i = walk_maze(&curpos, s);
printf("(@[email protected])\n\n");
print_map();
if(i == 1)
printf("\n\nDone!\n\n");
else
printf("\n\nI'm missing!\n\n");
return 0;
}
开发者ID:Kermit95,项目名称:Playground,代码行数:27,代码来源:maze.c
示例5: or_map
struct map *
or_map(struct map *mp1, struct map *mp2)
{
#ifdef MAP_DEBUG
if (Mflag) {
printf("Oring maps");
print_map(mp1);
printf(" and");
print_map(mp2);
}
#endif
if (POSMAP(mp1))
if (POSMAP(mp2))
mp1 = (struct map *)or_bitmap((struct bitmap *) mp1,
(struct bitmap *) mp2);
else
mp1 = NOT_MAP(bic_bitmap(MAP(mp2), (struct bitmap *) mp1));
else if (POSMAP(mp2))
mp1 = NOT_MAP(bic_bitmap(MAP(mp1), (struct bitmap *) mp2));
else
mp1 = NOT_MAP(and_bitmap(MAP(mp1), MAP(mp2)));
#ifdef MAP_DEBUG
if (Mflag) {
printf(" ->");
print_map(mp1);
printf("\n");
}
#endif
return mp1;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:30,代码来源:map.c
示例6: add_map
struct map *
add_map(struct map *parm, int node)
{
struct bitmap *map;
int bit;
int x, page;
#ifdef MAP_DEBUG
if (Aflag) {
printf("add_map: adding %d to [", node);
print_map(parm);
printf(" ] ");
}
#endif
bit = NUMBERTOBIT(node);
x = NUMBERTOINDEX(node);
page = NUMBERTOPAGE(node);
bit = 1L << bit;;
for (map = MAP(parm); map; map = map->m_next)
if (map->m_page == page)
break;
if (!map) {
map = (struct bitmap *)malloc(sizeof *map);
if (!map) {
#ifdef PRINT_MAP_ERROR
printf("No memory!\n");
#endif
free_map((struct map *)map);
return 0;
}
map->m_page = page;
memset( map->m_data, 0, sizeof map->m_data);
if (NEGMAP(parm)) {
int i;
for (i = 0; i < MDATA; ++i)
map->m_data[i] = ~0;
}
map->m_next = MAP(parm);
if (POSMAP(parm))
parm = (struct map *)map;
else
parm = NOT_MAP(map);
}
if (POSMAP(parm))
map->m_data[x] |= bit;
else
map->m_data[x] &= ~bit;
#ifdef MAP_DEBUG
if (Aflag) {
printf(" ->");
print_map(parm);
printf("\n");
}
#endif
return (struct map *)parm;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:58,代码来源:map.c
示例7: Drone_pick_up
void Drone_pick_up(void *self, int id){
Drone *obj = self;
setPosition((*obj).curr_y, (*obj).curr_x, id);
print_map();
printf("\x1b[32mDrone %d ready for pick up \n\x1b[0m", id);
sleep(1);
print_map();
printf("\x1b[33mDrone %d requesting payload \n\x1b[0m", id);
sleep(1);
print_map();
printf("\x1b[32mDrone %d payload picked up \n\x1b[0m", id);
Drone_return_home(self, id);
}
开发者ID:NolanFoster,项目名称:dcas,代码行数:14,代码来源:drone_func.c
示例8: main
/********************MAIN*****************/
int main(int argc, char **argv){
srand(time(NULL));
initialize("cyclotron.dat");
print_map(map);
max=0;RANGE=13; /* Set max and RANGE*/
search(map); /* Searching*/
show_result(optimum,max); /* Show result*/
printf("\n");
max=0; RANGE=13; /* Reset max and RANGE*/
print_map(map1);
search(map1);
show_result(optimum,max);
return 0;
}
开发者ID:letrungkien211,项目名称:SoftwareII,代码行数:15,代码来源:10.c
示例9: main
int main(int argc, char** argv) {
madness::World& world = madness::initialize(argc,argv);
std::size_t m = 20;
std::size_t n = 10;
std::size_t M = 200;
std::size_t N = 100;
std::shared_ptr<TiledArray::Pmap> blocked_pmap(new TiledArray::detail::BlockedPmap(world, m * n));
std::vector<ProcessID> blocked_map = make_map(m, n, blocked_pmap);
std::shared_ptr<TiledArray::Pmap> cyclic_pmap(new TiledArray::detail::CyclicPmap(world, m, n, M, N));
std::vector<ProcessID> cyclic_map = make_map(m, n, cyclic_pmap);
std::shared_ptr<TiledArray::Pmap> hash_pmap(new TiledArray::detail::HashPmap(world, m * n));
std::vector<ProcessID> hash_map = make_map(m, n, hash_pmap);
if(world.rank() == 0) {
std::cout << "Block\n";
print_map(m, n, blocked_map);
std::cout << "\n";
}
print_local(world, blocked_pmap);
world.gop.fence();
if(world.rank() == 0) {
std::cout << "\n\nCyclic\n";
print_map(m, n, cyclic_map);
std::cout << "\n";
}
print_local(world, cyclic_pmap);
world.gop.fence();
if(world.rank() == 0) {
std::cout << "\n\nHash\n";
print_map(m, n, hash_map);
std::cout << "\n";
}
print_local(world, hash_pmap);
madness::finalize();
return 0;
}
开发者ID:hapsunday,项目名称:tiledarray,代码行数:49,代码来源:pmap.cpp
示例10: copy_map
struct map *
copy_map(struct map *parm)
{
struct bitmap *result, **mpp, *map;
#ifdef MAP_DEBUG
if (Mflag) {
printf("copymap:");
print_map(parm);
printf("\n");
}
#endif
map = MAP(parm);
for (mpp = &result; (*mpp = 0), map; map = map->m_next) {
*mpp = (struct bitmap *)malloc(sizeof **mpp);
if (!*mpp) {
#ifdef MAP_DEBUG
if (Mflag)
printf("copy_map: out of memory\n");
#endif
free_map((struct map *)result);
result = 0;
break;
}
**mpp = *map;
mpp = &(*mpp)->m_next;
}
if (NEGMAP(parm))
return NOT_MAP(result);
else
return (struct map *)result;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:31,代码来源:map.c
示例11: main
int main(int ac, char **av)
{
int i;
int j;
char *tab;
t_sq sq;
char **map;
(void)ac;
j = 1;
while (av[j])
{
i = 0;
tab = read_file(av[j]);
write(1, "lo1", 3);
map = map_error(tab);
write(1, "lo2", 3);
sq = bsq(map);
write(1, "lo3", 3);
print_map(map, &sq);
write(1, "lo4", 3);
++j;
}
return(0);
}
开发者ID:jgan42,项目名称:bsq,代码行数:25,代码来源:main.c
示例12: MemAllocFree
void MemAllocFree(MemAlloc *ma, void *addr)
{
MemAllocChunk *c;
assert(ma != NULL);
if (addr == NULL) {
return;
}
c = (MemAllocChunk *)(((int8_t *) addr) - sizeof (MemAllocChunk));
c->id = MEMALLOC_CHUNK_ID_FREE;
if (c->next != 0) {
MemAllocChunk *nc = next_chunk(c);
if (nc->id == MEMALLOC_CHUNK_ID_FREE) {
c->size += sizeof (MemAllocChunk) + nc->size;
c->next = nc->next;
}
}
if (c->prev != 0) {
MemAllocChunk *pc = prev_chunk(c);
if (pc->id == MEMALLOC_CHUNK_ID_FREE) {
pc->size += sizeof (MemAllocChunk) + c->size;
pc->next = c->next;
}
}
#ifdef ENABLE_PRINT_MAP
print_map(ma);
#endif
}
开发者ID:iwadon,项目名称:junk,代码行数:27,代码来源:memalloc.c
示例13: assert
void *MemAllocAllocate(MemAlloc *ma, size_t size)
{
size_t sz;
assert(ma != NULL);
sz = (size + (MEMALLOC_ALIGN_SIZE - 1)) / MEMALLOC_ALIGN_SIZE * MEMALLOC_ALIGN_SIZE;
MemAllocChunk *c = ma->top;
while (!0) {
if (c->id == MEMALLOC_CHUNK_ID_FREE && c->size >= sz) {
break;
}
if (c->next == 0) {
return NULL;
}
c = next_chunk(c);
}
if (c->size > sizeof (MemAllocChunk) + sz) {
MemAllocChunk *c2 = (MemAllocChunk *)(((int8_t *) c) + sizeof (MemAllocChunk) + sz);
c2->id = MEMALLOC_CHUNK_ID_FREE;
c2->size = c->size - sizeof (MemAllocChunk) - sz;
c2->prev = sizeof (MemAllocChunk) + sz;
c2->next = c->next;
c->next = c2->prev;
}
c->id = MEMALLOC_CHUNK_ID_USED;
c->size = sz;
#ifdef ENABLE_PRINT_MAP
print_map(ma);
#endif
return ((int8_t *) c) + sizeof (MemAllocChunk);
}
开发者ID:iwadon,项目名称:junk,代码行数:30,代码来源:memalloc.c
示例14: ikev2_msg_send
int
ikev2_msg_send(struct iked *env, struct iked_message *msg)
{
struct ibuf *buf = msg->msg_data;
u_int32_t natt = 0x00000000;
struct ike_header *hdr;
if (buf == NULL || (hdr = ibuf_seek(msg->msg_data,
msg->msg_offset, sizeof(*hdr))) == NULL)
return (-1);
log_info("%s: %s from %s to %s, %ld bytes", __func__,
print_map(hdr->ike_exchange, ikev2_exchange_map),
print_host(&msg->msg_local, NULL, 0),
print_host(&msg->msg_peer, NULL, 0),
ibuf_length(buf));
if (msg->msg_natt || (msg->msg_sa && msg->msg_sa->sa_natt)) {
if (ibuf_prepend(buf, &natt, sizeof(natt)) == -1) {
log_debug("%s: failed to set NAT-T", __func__);
return (-1);
}
}
if ((sendto(msg->msg_fd, ibuf_data(buf), ibuf_size(buf), 0,
(struct sockaddr *)&msg->msg_peer, msg->msg_peerlen)) == -1) {
log_warn("%s: sendto", __func__);
return (-1);
}
return (0);
}
开发者ID:sofuture,项目名称:bitrig,代码行数:32,代码来源:ikev2_msg.c
示例15: count_map
int
count_map(struct map *parm)
{
int nf;
struct bitmap *map;
int i, j;
nf = 0;
for (map = MAP(parm); map; map = map->m_next) {
for (i = 0; i < MDATA; ++i) {
if (!map->m_data[i])
;
else if (!~map->m_data[i])
nf += (1 << LSHIFT);
else
for (j = 0; j < (1L << LSHIFT); ++j)
if (map->m_data[i] & (1L << j))
++nf;
}
}
if (NEGMAP(parm))
nf = ~nf; /* note 1's complement */
#ifdef MAP_DEBUG
if (Mflag) {
printf("countmap:");
print_map(parm);
printf(" -> %d\n", nf);
}
#endif
return nf;
}
开发者ID:SimonWilkinson,项目名称:openafs,代码行数:31,代码来源:map.c
示例16: main
int main(void)
{
char *line;
t_box box;
int ret;
int i;
ret = 0;
ft_bzero(&box, (sizeof(box)));
while ((ret = get_next_line(0, &line) != 0))
{
if ((i = -1) && box.b_play == 0)
check_player(line, &box);
else if ((ft_strnequ(line, "Plateau", 7)))
create_grid(line, &box);
else if ((ft_strnequ(line, "Piece", 5)))
{
get_piece(line, &box);
print_map(&box);
while (i < 69999999)
i++;
if (!try_rush(&box))
return (0);
reinitialise_box(&box);
}
}
return (0);
}
开发者ID:Galathorn,项目名称:Project,代码行数:28,代码来源:main_both.c
示例17: main
int main( int argc, char *argv[] )
{
struct map_data *map;
if ( init(&map, argc, argv) ) {
exit( 0 );
}
int cur = '\0';
point_t start = get_start_point( map );
do {
clear();
print_map( map );
process_key( cur );
switch ( cur ) {
default: {
point_t target = get_cursor();
//mvprintw( 0, 0, "Cursor was at : (%d, %d)", target.x, target.y);
path_t *path_to_target = search_path( start, target, map );
print_path( path_to_target );
refresh();
}
}
refresh();
} while ( (cur = getch()) != 'q' );
cleanup_all();
return 0;
}
开发者ID:Xeroth95,项目名称:Astar,代码行数:35,代码来源:main.c
示例18: ikev2_msg_send
int
ikev2_msg_send(struct iked *env, struct iked_message *msg)
{
struct iked_sa *sa = msg->msg_sa;
struct ibuf *buf = msg->msg_data;
u_int32_t natt = 0x00000000;
int isnatt = 0;
struct ike_header *hdr;
struct iked_message *m;
if (buf == NULL || (hdr = ibuf_seek(msg->msg_data,
msg->msg_offset, sizeof(*hdr))) == NULL)
return (-1);
isnatt = (msg->msg_natt || (msg->msg_sa && msg->msg_sa->sa_natt));
log_info("%s: %s from %s to %s, %ld bytes%s", __func__,
print_map(hdr->ike_exchange, ikev2_exchange_map),
print_host(&msg->msg_local, NULL, 0),
print_host(&msg->msg_peer, NULL, 0),
ibuf_length(buf), isnatt ? ", NAT-T" : "");
if (isnatt) {
if (ibuf_prepend(buf, &natt, sizeof(natt)) == -1) {
log_debug("%s: failed to set NAT-T", __func__);
return (-1);
}
msg->msg_offset += sizeof(natt);
}
if ((sendto(msg->msg_fd, ibuf_data(buf), ibuf_size(buf), 0,
(struct sockaddr *)&msg->msg_peer, msg->msg_peerlen)) == -1) {
log_warn("%s: sendto", __func__);
return (-1);
}
if (!sa)
return (0);
if ((m = ikev2_msg_copy(env, msg)) == NULL) {
log_debug("%s: failed to copy a message", __func__);
return (-1);
}
m->msg_exchange = hdr->ike_exchange;
if (hdr->ike_flags & IKEV2_FLAG_RESPONSE) {
TAILQ_INSERT_TAIL(&sa->sa_responses, m, msg_entry);
timer_initialize(env, &m->msg_timer,
ikev2_msg_response_timeout, m);
timer_register(env, &m->msg_timer, IKED_RESPONSE_TIMEOUT);
} else {
TAILQ_INSERT_TAIL(&sa->sa_requests, m, msg_entry);
timer_initialize(env, &m->msg_timer,
ikev2_msg_retransmit_timeout, m);
timer_register(env, &m->msg_timer, IKED_RETRANSMIT_TIMEOUT);
}
return (0);
}
开发者ID:bsdoliv,项目名称:iked-fork,代码行数:59,代码来源:ikev2_msg.c
示例19: list_report
int list_report (List_of_maps * list) {
int map_ctr, best_ctr;
printf ("==========================================\n");
printf ("maps allocated: %4d maps used : %4d best used : %4d \n",
list->no_maps_allocated, list->no_maps_used, list->best_array_used);
if ( list->best_array_used ) {
for ( best_ctr= 0; best_ctr<list->no_maps_used; best_ctr++) {
map_ctr = list->map_best[best_ctr];
printf ("\n %3d: %3d %8.3lf %8.3lf %8.3lf %8.3lf \n",
best_ctr, map_ctr,
list->map[map_ctr].q[0],
list->map[map_ctr].q[1],
list->map[map_ctr].q[2],
list->map[map_ctr].q[3]);
print_map (stdout, list->map+map_ctr, NULL, NULL, NULL, NULL, 2);
}
} else {
for ( map_ctr= 0; map_ctr<list->no_maps_used; map_ctr++) {
printf (" %3d %8.3lf %8.3lf %8.3lf %8.3lf \n", map_ctr,
list->map[map_ctr].q[0],
list->map[map_ctr].q[1],
list->map[map_ctr].q[2],
list->map[map_ctr].q[3]);
print_map (stdout, list->map+map_ctr, NULL, NULL, NULL, NULL, 2);
}
}
return 0;
}
开发者ID:ivanamihalek,项目名称:struct,代码行数:45,代码来源:struct_map.c
示例20: print_response
void print_response(struct _u_response * response) {
if (response != NULL) {
char * headers = print_map(response->map_header), * json_body = json_dumps(response->json_body, JSON_INDENT(2));
printf("protocol is\n%s\n\n headers are \n%s\n\n json body is \n%s\n\n string body is \n%s\n\n",
response->protocol, headers, json_body, (char *)response->string_body);
free(headers);
free(json_body);
}
}
开发者ID:babelouest,项目名称:ulfius,代码行数:9,代码来源:client.c
注:本文中的print_map函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论