📄 gz_guicam.c
字号:
/* * Gazebo - Outdoor Multi-Robot Simulator * Copyright (C) 2003 * Nate Koenig & Andrew Howard * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *//* * Desc: Gazebo Guicam interface * Author: Pranav Srivastava * Date: 16 Sep 2003 * CVS: $Id: gz_guicam.c,v 1.4 2004/10/31 07:43:31 inspectorg Exp $ */#include <string.h>#include <stdlib.h>#include <stdio.h>#include <stdarg.h> // for variable length arguments to gz_iface_create#include "gazebo.h"// Create an interfacegz_guicam_t *gz_guicam_alloc(){ gz_guicam_t *self; self = calloc(1, sizeof(gz_guicam_t)); self->iface = gz_iface_alloc(); return self;}// Destroy an interfacevoid gz_guicam_free(gz_guicam_t *self){ gz_iface_free(self->iface); free(self); return;}// Create the interfaceint gz_guicam_create(gz_guicam_t *self, gz_server_t *server, const char *id, const char *model_type, int model_id, int parent_model_id){ if (gz_iface_create(self->iface, server, "guicam", id, sizeof(gz_guicam_data_t)) != 0) return -1; self->data = self->iface->mmap; strncpy(self->data->head.model_type, model_type, sizeof(self->data->head.model_type)); self->data->head.model_id = (int) model_id; self->data->head.parent_model_id = (int) parent_model_id; return 0;}// Destroy the interface (server)int gz_guicam_destroy(gz_guicam_t *self){ self->data = NULL; return gz_iface_destroy(self->iface);}// Open an existing interfaceint gz_guicam_open(gz_guicam_t *self, gz_client_t *client, const char *id){ if (gz_iface_open(self->iface, client, "guicam", id, sizeof(gz_guicam_data_t)) != 0) return -1; self->data = self->iface->mmap; return 0;} // Close the interfaceint gz_guicam_close(gz_guicam_t *self){ self->data = NULL; return gz_iface_close(self->iface);}// Lock the interface.int gz_guicam_lock(gz_guicam_t *self, int blocking){ return gz_iface_lock(self->iface, blocking);}// Unlock the interfacevoid gz_guicam_unlock(gz_guicam_t *self){ return gz_iface_unlock(self->iface);}// Tell clients that new data is availableint gz_guicam_post(gz_guicam_t *self){ return gz_iface_post(self->iface);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -