Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * fvfile.h - FireVision file 00004 * 00005 * Created: Fri Mar 28 11:29:55 2008 00006 * Copyright 2008 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_FVUTILS_FILEFORMAT_FVFILE_H_ 00025 #define __FIREVISION_FVUTILS_FILEFORMAT_FVFILE_H_ 00026 00027 #include <fvutils/fileformat/fvff.h> 00028 #include <fvutils/fileformat/fvfile_block.h> 00029 #include <cstdlib> 00030 #include <list> 00031 00032 namespace firevision { 00033 #if 0 /* just to make Emacs auto-indent happy */ 00034 } 00035 #endif 00036 00037 class FireVisionDataFile 00038 { 00039 public: 00040 FireVisionDataFile(unsigned short int magic_token, unsigned short int version); 00041 virtual ~FireVisionDataFile(); 00042 00043 unsigned int magic_token(); 00044 unsigned int version(); 00045 bool is_big_endian(); 00046 bool is_little_endian(); 00047 size_t num_blocks(); 00048 00049 const char * get_comment() const; 00050 void set_comment(const char *comment); 00051 00052 void set_owns_blocks(bool owns_blocks); 00053 00054 virtual void add_block(FireVisionDataFileBlock *block); 00055 virtual void clear(); 00056 00057 virtual void write(const char *file_name); 00058 virtual void read(const char *file_name); 00059 00060 static unsigned short int read_magic_token(const char *filename); 00061 static bool has_magic_token(const char *filename, unsigned short int magic_token); 00062 00063 /** List of FireVision data file blocks. */ 00064 typedef std::list<FireVisionDataFileBlock *> BlockList; 00065 BlockList & blocks(); 00066 00067 protected: 00068 void *_spec_header; 00069 size_t _spec_header_size; 00070 00071 private: 00072 fvff_header_t *__header; 00073 BlockList __blocks; 00074 BlockList::iterator __bi; 00075 00076 unsigned int __magic_token; 00077 unsigned int __version; 00078 00079 char * __comment; 00080 00081 bool __owns_blocks; 00082 }; 00083 00084 } // end namespace firevision 00085 00086 #endif