]> git.donarmstrong.com Git - mothur.git/blob - uchime_src/path.h
changes while testing
[mothur.git] / uchime_src / path.h
1 #ifndef path_h\r
2 #define path_h\r
3 \r
4 struct PathData\r
5         {\r
6 private:\r
7         PathData(PathData &);\r
8         PathData &operator=(PathData &);\r
9 \r
10 public:\r
11         char *Start;\r
12         char *Front;\r
13         char *Back;\r
14         unsigned Bytes;\r
15 \r
16 public:\r
17         PathData()\r
18                 {\r
19                 Clear(true);\r
20                 }\r
21         ~PathData()\r
22                 {\r
23                 Free();\r
24                 }\r
25         void Free();\r
26         void Alloc(unsigned MaxLen);\r
27         void Clear(bool ctor = false)\r
28                 {\r
29                 Start = 0;\r
30                 if (ctor)\r
31                         {\r
32                         Front = 0;\r
33                         Back = 0;\r
34                         Bytes = 0;\r
35                         }\r
36                 else\r
37                         Free();\r
38                 }\r
39         void Copy(const PathData &rhs);\r
40         void FromStr(const char *PathStr);\r
41         void Reverse()\r
42                 {\r
43                 asserta(Start != 0);\r
44                 unsigned L = (unsigned) strlen(Start);\r
45                 for (unsigned k = 0; k < L/2; ++k)\r
46                         {\r
47                         char c = Start[k];\r
48                         Start[k] = Start[L-k-1];\r
49                         Start[L-k-1] = c;\r
50                         }\r
51                 }\r
52         void SetEmpty()\r
53                 {\r
54                 Start = 0;\r
55                 }\r
56 \r
57         bool IsEmpty() const\r
58                 {\r
59                 return Start == 0;\r
60                 }\r
61         };\r
62 \r
63 #endif // path_h\r