Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
mydxffile.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2010-2011 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 #ifndef MY_DXF_FILE_HPP
44 #define MY_DXF_FILE_HPP 1
45 
46 
47 
48 //#define MYDXF_DEBUG 1
49 //#define MYDXF_DEBUG_PLOT 1
50 
51 
52 
53 #include <fstream>
54 #include "mydxfheader.hpp"
55 #include "mydxftables.hpp"
56 #include "mydxfblocks.hpp"
57 #include "mydxfentities.hpp"
58 
59 
60 
61 
69 class MyDXFFile
70 {
71  std::ifstream _istr;
72  std::ofstream _ostr;
73  bool _ascii;
74  int _linec;
75 
76  int _wlevel;
77 
78  int _group_code;
79  int _group_type;
80 
81  std::string _group_string;
82  double _group_double;
83  bool _group_bool;
84  int8_t _group_int8;
85  int16_t _group_int16;
86  int32_t _group_int32;
87  int64_t _group_int64;
88 
89  class MyDXFHeader *_header;
90  class MyDXFTables *_tables;
91  class MyDXFBlocks *_blocks;
92  class MyDXFEntities *_entities;
93 
94 
95 public:
96 
99  MyDXFFile();
100 
103  MyDXFFile( const std::string &filename );
104 
107  ~MyDXFFile();
108 
111  void read( const std::string &filename );
112 
115  void write( const std::string &filename );
116 
125  void set_warning_level( int wlevel ) { _wlevel = wlevel; }
126 
129  int wlevel( void ) const { return( _wlevel ); }
130 
131 
132 
135  void write_group( int code, const char *data );
136 
139  void write_group( int code, double data );
140 
143  void write_group( int code, bool data );
144 
147  void write_group( int code, int8_t data );
148 
151  void write_group( int code, int16_t data );
152 
155  void write_group( int code, int32_t data );
156 
159  void write_group( int code, int64_t data );
160 
161 
162 
168  int read_group( void );
169 
172  int group_get_code( void ) const;
173 
178  std::string group_get_string( void ) const;
179 
184  double group_get_double( void ) const;
185 
190  bool group_get_bool( void ) const;
191 
196  int8_t group_get_int8( void ) const;
197 
202  int16_t group_get_int16( void ) const;
203 
208  int32_t group_get_int32( void ) const;
209 
214  int64_t group_get_int64( void ) const;
215 
218  int linec( void ) const { return( _linec ); }
219 
220 
221 
222 
223 
226  class MyDXFEntities *get_entities( void ) { return( _entities ); };
227 
230  const class MyDXFEntities *get_entities( void ) const { return( _entities ); };
231 
232 
233 
236  class MyDXFBlocks *get_blocks( void ) { return( _blocks ); };
237 
240  const class MyDXFBlocks *get_blocks( void ) const { return( _blocks ); };
241 
242 
245  class MyDXFTables *get_tables( void ) { return( _tables ); };
246 
249  const class MyDXFTables *get_tables( void ) const { return( _tables ); };
250 
251 
252 
253 
256  void debug_print( std::ostream &os ) const;
257 
260  static void debug_print_format( std::ostream &os,
261  const std::string &fieldname,
262  const std::string &val );
263 
264  static void debug_print_format( std::ostream &os,
265  const std::string &fieldname,
266  double val );
267 
268  static void debug_print_format( std::ostream &os,
269  const std::string &fieldname,
270  int val );
271 
272  static void debug_print_format( std::ostream &os,
273  const std::string &fieldname,
274  const Vec3D &val );
275 };
276 
277 
278 #endif
279 
280 
281 
282 
DXF blocks class.
Definition: mydxfblocks.hpp:143
DXF entity database.
Definition: mydxfentities.hpp:286
DXF file class.
Definition: mydxffile.hpp:70
int wlevel(void) const
Get the level of warning messages.
Definition: mydxffile.hpp:129
const class MyDXFEntities * get_entities(void) const
Get a const pointer to the entities of DXF file.
Definition: mydxffile.hpp:230
~MyDXFFile()
Destructor.
Definition: mydxffile.cpp:192
void write_group(int code, const char *data)
Write string group to output file.
Definition: mydxffile.cpp:479
void read(const std::string &filename)
Read DXF file.
Definition: mydxffile.cpp:117
void write(const std::string &filename)
Write DXF file.
Definition: mydxffile.cpp:205
int group_get_code(void) const
Get code of the last group read.
Definition: mydxffile.cpp:225
int32_t group_get_int32(void) const
Get the value of the last group read assuming it is a int32.
Definition: mydxffile.cpp:286
class MyDXFBlocks * get_blocks(void)
Get a pointer to the blocks of DXF file.
Definition: mydxffile.hpp:236
int8_t group_get_int8(void) const
Get the value of the last group read assuming it is a int8.
Definition: mydxffile.cpp:268
std::string group_get_string(void) const
Get the value of the last group read assuming it is a string.
Definition: mydxffile.cpp:241
class MyDXFEntities * get_entities(void)
Get a pointer to the entities of DXF file.
Definition: mydxffile.hpp:226
int read_group(void)
Read next group from open file and return group code.
Definition: mydxffile.cpp:304
int16_t group_get_int16(void) const
Get the value of the last group read assuming it is a int16.
Definition: mydxffile.cpp:277
int64_t group_get_int64(void) const
Get the value of the last group read assuming it is a int64.
Definition: mydxffile.cpp:295
MyDXFFile()
Construct empty DXF file.
Definition: mydxffile.cpp:110
bool group_get_bool(void) const
Get the value of the last group read assuming it is a bool.
Definition: mydxffile.cpp:259
const class MyDXFTables * get_tables(void) const
Get a const pointer to the tables of DXF file.
Definition: mydxffile.hpp:249
const class MyDXFBlocks * get_blocks(void) const
Get a const pointer to the blocks of DXF file.
Definition: mydxffile.hpp:240
int linec(void) const
Get the current line number in DXF file during read.
Definition: mydxffile.hpp:218
double group_get_double(void) const
Get the value of the last group read assuming it is a double.
Definition: mydxffile.cpp:250
void set_warning_level(int wlevel)
Set the level of warning messages.
Definition: mydxffile.hpp:125
static void debug_print_format(std::ostream &os, const std::string &fieldname, const std::string &val)
Print debugging information to os with correct formatting.
Definition: mydxffile.cpp:643
class MyDXFTables * get_tables(void)
Get a pointer to the tables of DXF file.
Definition: mydxffile.hpp:245
void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: mydxffile.cpp:628
DXF header class.
Definition: mydxfheader.hpp:59
DXF tables class.
Definition: mydxftables.hpp:270
Three dimensional vector.
Definition: vec3d.hpp:58
DXF blocks.
DXF Entities.
DXF Header.
DXF Tables.


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.