BRL-CAD
obj_describe.c
Go to the documentation of this file.
1 /* O B J _ D E S C R I B E . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2010-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #include "common.h"
22 
23 #include "raytrace.h"
24 
25 
26 int
27 rt_obj_describe(struct bu_vls *logstr, const struct rt_db_internal *ip, int verbose, double mm2local, struct resource *resp, struct db_i *dbip)
28 {
29  int id;
30  const struct rt_functab *ft;
31 
32  if (!logstr || !ip)
33  return -1;
34 
35  BU_CK_VLS(logstr);
37  if (resp) RT_CK_RESOURCE(resp);
38  if (dbip) RT_CK_DBI(dbip);
39 
40  id = ip->idb_minor_type;
41  if (id < 0)
42  return -2;
43 
44  ft = &OBJ[id];
45  if (!ft)
46  return -3;
47  if (!ft->ft_describe)
48  return -4;
49 
50  return ft->ft_describe(logstr, ip, verbose, mm2local, resp, dbip);
51 }
52 
53 
54 /*
55  * Local Variables:
56  * mode: C
57  * tab-width: 8
58  * indent-tabs-mode: t
59  * c-file-style: "stroustrup"
60  * End:
61  * ex: shiftwidth=4 tabstop=8
62  */
Definition: raytrace.h:800
Header file for the BRL-CAD common definitions.
int rt_obj_describe(struct bu_vls *logstr, const struct rt_db_internal *ip, int verbose, double mm2local, struct resource *resp, struct db_i *dbip)
Definition: obj_describe.c:27
#define BU_CK_VLS(_vp)
Definition: vls.h:69
#define RT_CK_DB_INTERNAL(_p)
Definition: raytrace.h:207
#define RT_CK_DBI(_p)
Definition: raytrace.h:829
const struct rt_functab OBJ[]
Definition: table.c:159
#define RT_CK_RESOURCE(_p)
Definition: raytrace.h:1490
int(* ft_describe)(struct bu_vls *, const struct rt_db_internal *, int, double, struct resource *, struct db_i *)
Definition: raytrace.h:2162
int idb_minor_type
ID_xxx.
Definition: raytrace.h:193
HIDDEN void verbose(struct human_data_t *dude)
Definition: human.c:2008
Definition: vls.h:56