libStatGen Software
1
GlfHeader.h
1
/*
2
* Copyright (C) 2010 Regents of the University of Michigan
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __GLF_HEADER_H__
19
#define __GLF_HEADER_H__
20
21
#include <stdint.h>
22
23
#include "
InputFile.h
"
24
#include "CharBuffer.h"
25
26
/// This class allows a user to easily get/set the fields in a GLF header.
27
/// The GlfHeader contains:
28
/// - Variable length text string
29
class
GlfHeader
30
{
31
public
:
32
GlfHeader
();
33
~
GlfHeader
();
34
35
/// Copy Constructor
36
/// \param header glfheader to copy into this one.
37
GlfHeader
(
const
GlfHeader
& header);
38
39
/// Overload operator= to copy the passed in header into this header.
40
/// \param header glfheader to copy into this one.
41
GlfHeader
&
operator =
(
const
GlfHeader
& header);
42
43
/// Copy the passed in header into this header.
44
/// \param header glfheader to copy into this one.
45
bool
copy
(
const
GlfHeader
& header);
46
47
/// Clear this header back to the default setting.
48
void
resetHeader
();
49
50
/// Read the header from the specified file (file MUST be in
51
/// the correct position for reading the header).
52
/// \param filePtr file to read from that is in the correct position.
53
/// \return true if the header was successfully read from the
54
/// file, false if not.
55
bool
read
(
IFILE
filePtr);
56
57
/// Write the header to the specified file.
58
/// \param filePtr file to write to that is in the correct position.
59
/// \return true if the header was successfully written to the
60
/// file, false if not.
61
bool
write
(
IFILE
filePtr)
const
;
62
63
/// Set the passed in string to the text string stored in this header.
64
/// \param text string to populate with the header text string.
65
/// \return true if text was successfully returned, false if not.
66
bool
getHeaderTextString
(std::string& text);
67
68
/// Set the header to the passed in string.
69
/// \param text header text to assign to this header.
70
/// \return true if the text was successfully set, false if not.
71
bool
setHeaderTextString
(
const
std::string& text);
72
73
private
:
74
int32_t myTextLen;
75
CharBuffer
myText;
76
77
static
const
std::string GLF_MAGIC;
78
static
const
int
GLF_MAGIC_LEN = 4;
79
};
80
81
#endif
82
GlfHeader::read
bool read(IFILE filePtr)
Read the header from the specified file (file MUST be in the correct position for reading the header)...
Definition:
GlfHeader.cpp:80
GlfHeader::write
bool write(IFILE filePtr) const
Write the header to the specified file.
Definition:
GlfHeader.cpp:141
GlfHeader::operator=
GlfHeader & operator=(const GlfHeader &header)
Overload operator= to copy the passed in header into this header.
Definition:
GlfHeader.cpp:47
GlfHeader
This class allows a user to easily get/set the fields in a GLF header.
Definition:
GlfHeader.h:29
GlfHeader::copy
bool copy(const GlfHeader &header)
Copy the passed in header into this header.
Definition:
GlfHeader.cpp:54
InputFile.h
GlfHeader::getHeaderTextString
bool getHeaderTextString(std::string &text)
Set the passed in string to the text string stored in this header.
Definition:
GlfHeader.cpp:202
CharBuffer
Definition:
CharBuffer.h:24
InputFile
Class for easily reading/writing files without having to worry about file type (uncompressed,...
Definition:
InputFile.h:36
GlfHeader::setHeaderTextString
bool setHeaderTextString(const std::string &text)
Set the header to the passed in string.
Definition:
GlfHeader.cpp:210
GlfHeader::resetHeader
void resetHeader()
Clear this header back to the default setting.
Definition:
GlfHeader.cpp:72
glf
GlfHeader.h
Generated by
1.8.17