Fawkes API  Fawkes Development Version
cmfile.h
1 
2 /**************************************************************************
3  * cmfile.h - FVFF Colormap File Format
4  *
5  * Created: Sat Mar 29 12:49:48 2008
6  * Copyright 2005-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ***************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_FVUTILS_COLORMAP_CMFILE_H_
25 #define __FIREVISION_FVUTILS_COLORMAP_CMFILE_H_
26 
27 #include <fvutils/fileformat/fvfile.h>
28 #include <fvutils/colormap/cmfile_block.h>
29 #include <vector>
30 #include <string>
31 #include <stdint.h>
32 
33 namespace firevision {
34 #if 0 /* just to make Emacs auto-indent happy */
35 }
36 #endif
37 
38 class Colormap;
39 
40 #define CMFILE_MAGIC_TOKEN 0xFF01
41 #define CMFILE_CUR_VERSION 2
42 
43 #define CMFILE_TYPE_YUV 1
44 
45 #pragma pack(push,4)
46 /** Block header for a Colormap header block in a ColormapFile. */
47 typedef struct {
48  uint16_t depth; /**< Y resolution */
49  uint16_t width; /**< U resolution */
50  uint16_t height; /**< V resolution */
51  uint16_t reserved; /**< reserved for future use, padding */
53 #pragma pack(pop)
54 
56 {
57  public:
58  ColormapFile();
59  ColormapFile(uint16_t depth, uint16_t width, uint16_t height);
60 
61  class ColormapBlockVector : public std::vector<ColormapFileBlock *>
62  {
63  public:
65  };
66 
67  void add_colormap(Colormap *colormap);
68  ColormapBlockVector * colormap_blocks();
69  Colormap * get_colormap();
70 
71  uint16_t get_depth();
72  uint16_t get_width();
73  uint16_t get_height();
74 
75  static bool is_colormap_file(const char *filename);
76  static std::string compose_filename(const std::string format);
77 
78  virtual void clear();
79 
80  private:
81  inline void assert_header();
82  private:
83  cmfile_header_t *__header;
84 };
85 
86 } // end namespace firevision
87 
88 #endif
uint16_t reserved
reserved for future use, padding
Definition: cmfile.h:51
Block header for a Colormap header block in a ColormapFile.
Definition: cmfile.h:47
virtual unsigned int depth() const =0
Get depth of colormap.
uint16_t width
U resolution.
Definition: cmfile.h:49
Colormap interface.
Definition: colormap.h:38
virtual unsigned int height() const =0
Get height of colormap.
Colormap file.
Definition: cmfile.h:55
uint16_t depth
Y resolution.
Definition: cmfile.h:48
Vector of colormap blocks.
Definition: cmfile.h:61
FireVision File Format for data files.
Definition: fvfile.h:37
virtual unsigned int width() const =0
Get width of colormap.
uint16_t height
V resolution.
Definition: cmfile.h:50