PLY reader/writer  1.2.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
base.h
1 // A C++ reader/writer of .ply files.
2 // Base types.
3 //
4 // Adapted to C++ streams by Thijs van Lankveld.
5 
6 /*
7 Header for PLY polygon files.
8 
9 - Greg Turk
10 
11 A PLY file contains a single polygonal _object_.
12 
13 An object is composed of lists of _elements_. Typical elements are
14 vertices, faces, edges and materials.
15 
16 Each type of element for a given object has one or more _properties_
17 associated with the element type. For instance, a vertex element may
18 have as properties three floating-point values x,y,z and three unsigned
19 chars for red, green and blue.
20 
21 -----------------------------------------------------------------------
22 
23 Copyright (c) 1998 Georgia Institute of Technology. All rights reserved.
24 
25 Permission to use, copy, modify and distribute this software and its
26 documentation for any purpose is hereby granted without fee, provided
27 that the above copyright notice and this permission notice appear in
28 all copies of this software and that you do not sell the software.
29 
30 THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
31 EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
32 WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
33 */
34 
35 
36 #ifndef __PLY_BASE_H__
37 #define __PLY_BASE_H__
38 
39 
97 #include <iostream>
98 
100 namespace PLY {
102  const char _VERSION[] = "1.2.0";
103 
105  enum Stream_type {ASCII = 1,
106  BINARY_BE = 2,
108  };
109 
111  enum Scalar_type {StartType = 0,
112  Int8 = 1,
113  Int16 = 2,
114  Int32 = 3,
115  Uint8 = 4,
116  Uint16 = 5,
117  Uint32 = 6,
118  Float32 = 7,
119  Float64 = 8,
120  EndType = 9
121  };
122 
124  const char* type_names[];
126  const char* old_type_names[];
127 
129  const size_t ply_type_bytes[] = {0, 1, 2, 4, 1, 2, 4, 4, 8, 0};
130 
132  const int BIG_STRING = 4096;
133 
135  enum Variable_type {SCALAR = 0,
136  LIST = 1,
137  STRING = 2
138  };
139 
141  enum Verbatim {IGNORE,
145  };
146 
149 
150 #define HANDLE_FAULT(msg) {\
151  switch (ON_FAULT) {\
152  case IGNORE:\
153  break;\
154  case WARNING:\
155  case EXCEPTION:\
156  case ERROR:\
157  std::cerr << msg << std::endl;\
158  switch (ON_FAULT) {\
159  case WARNING:\
160  break;\
161  case ERROR:\
162  exit(1);\
163  case EXCEPTION:\
164  return false;\
165  }\
166  }\
167  }
168 } // namespace PLY
169 
170 
171 #endif // __PLY_BASE_H__