gmio/src/gmio_stl/stl_infos.h

119 lines
3.2 KiB
C
Raw Normal View History

2015-12-10 01:51:03 +08:00
/****************************************************************************
** gmio
** Copyright Fougue (2 Mar. 2015)
** contact@fougue.pro
**
** This software is a reusable library whose purpose is to provide complete
** I/O support for various CAD file formats (eg. STL)
**
** This software is governed by the CeCILL-B license under French law and
** abiding by the rules of distribution of free software. You can use,
** modify and/ or redistribute the software under the terms of the CeCILL-B
** license as circulated by CEA, CNRS and INRIA at the following URL
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
****************************************************************************/
/*! \file stl_infos.h
* TODO: description
*
* \addtogroup gmio_stl
* @{
*/
#ifndef GMIO_STL_INFOS_H
#define GMIO_STL_INFOS_H
#include "stl_global.h"
#include "../gmio_core/rwargs.h"
#include "../gmio_core/internal/helper_stream.h"
#include <stddef.h>
#include "stl_format.h"
#include "stlb_header.h"
/*! Informations retrieved by gmio_stl_infos_get() */
2015-12-10 01:51:03 +08:00
struct gmio_stl_infos
{
/*! Count of facets(triangles) */
uint32_t facet_count;
/*! Size of the STL data in bytes
*
* For STL ascii it includes the "endsolid" tag */
gmio_streamsize_t size;
2015-12-10 01:51:03 +08:00
2015-12-18 17:45:51 +08:00
/*! STL ascii only: name of the solid
*
* The pointer has to be set by the caller of gmio_stl_infos_get() */
2015-12-10 01:51:03 +08:00
char* stla_solidname;
2015-12-18 17:45:51 +08:00
/*! STL ascii only: maximum length(capacity) of stla_solidname
*
* The value has to be set by the caller of gmio_stl_infos_get()
2015-12-10 01:51:03 +08:00
*/
size_t stla_solidname_maxlen;
2015-12-18 17:45:51 +08:00
/*! STL binary only: header(80-bytes) of STL data */
2015-12-10 01:51:03 +08:00
struct gmio_stlb_header stlb_header;
};
/*! Flags(OR-combinations) for each STL info */
enum gmio_stl_info_flag
{
/*! -> gmio_stl_infos::facet_count */
GMIO_STL_INFO_FLAG_FACET_COUNT = 0x0001,
/*! -> gmio_stl_infos::size */
GMIO_STL_INFO_FLAG_SIZE = 0x0002,
/*! -> gmio_stl_infos::stla_solidname */
GMIO_STLA_INFO_FLAG_SOLIDNAME = 0x0004,
/*! -> gmio_stl_infos::stlb_header */
GMIO_STLB_INFO_FLAG_HEADER = 0x0008,
/*! -> gmio_stl_infos::stla_solidname or gmio_stl_infos::stlb_header */
GMIO_STL_INFO_FLAG_SOLIDNAME_OR_HEADER =
GMIO_STLA_INFO_FLAG_SOLIDNAME | GMIO_STLB_INFO_FLAG_HEADER,
/*! All infos */
GMIO_STL_INFO_FLAG_ALL = 0xFFFF
};
/*! Objects to be passed to gmio_stl_infos_get() */
2015-12-10 01:51:03 +08:00
struct gmio_stl_infos_get_args
{
/*! Input stream */
2015-12-10 01:51:03 +08:00
struct gmio_stream stream;
/*! Optional memory block used by the stream to bufferize read operations
*
* If null, then a temporary memblock is created with the global default
* constructor function (see gmio_memblock_default())
*/
struct gmio_memblock stream_memblock;
/*! Output informations */
struct gmio_stl_infos infos;
2015-12-10 01:51:03 +08:00
};
GMIO_C_LINKAGE_BEGIN
/*! Finds informations about STL contents
*
* \return Error code (see gmio_core/error.h and stl_error.h)
*/
2015-12-10 01:51:03 +08:00
GMIO_LIBSTL_EXPORT
int gmio_stl_infos_get(
struct gmio_stl_infos_get_args* args,
enum gmio_stl_format format,
2015-12-10 01:51:03 +08:00
unsigned flags);
GMIO_C_LINKAGE_END
#endif /* GMIO_STL_INFOS_H */
/*! @} */