Buffered binary output.
More...
#include <JBufferedIO.hh>
Buffered binary output.
This class implements the JWriter interface.
Definition at line 151 of file JBufferedIO.hh.
◆ JBufferedWriter() [1/3]
JIO::JBufferedWriter::JBufferedWriter |
( |
JWriter * | __out, |
|
|
const int | __size = 1048576 ) |
|
inline |
Constructor.
Note that this object owns the writer pointed to.
- Parameters
-
__out | pointer to writer |
__size | size of internal buffer |
Definition at line 162 of file JBufferedIO.hh.
162 :
164 {
165 size = std::max(__size, 1024);
167
169 }
char * buffer
internal buffer
int size
size of internal buffer
JLANG::JSinglePointer< JWriter > out
int pos
pointer to end of buffered data
◆ ~JBufferedWriter()
JIO::JBufferedWriter::~JBufferedWriter |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 175 of file JBufferedIO.hh.
176 {
178
180 }
void flush()
Write internal data to output.
◆ JBufferedWriter() [2/3]
◆ JBufferedWriter() [3/3]
◆ getStatus()
virtual bool JIO::JBufferedWriter::getStatus |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ write()
virtual int JIO::JBufferedWriter::write |
( |
const char * | zbuf, |
|
|
int | n ) |
|
inlineoverridevirtual |
Write byte array.
- Parameters
-
zbuf | pointer to byte array |
n | number of bytes |
- Returns
- number of bytes
Implements JLANG::JBinaryOutput.
Definition at line 201 of file JBufferedIO.hh.
202 {
203 for (
int i = 0; i !=
n; ) {
204
206
208
210
213 }
214 }
215
217
218 i += m;
220 }
221
223 }
◆ flush()
void JIO::JBufferedWriter::flush |
( |
| ) |
|
|
inline |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ operator<<() [1/16]
Write serialisable data object.
- Parameters
-
object | serialisable data object |
- Returns
- JWriter
Definition at line 144 of file JSerialisable.hh.
145 {
146 return object.write(*this);
147 }
◆ operator<<() [2/16]
JWriter & JIO::JWriter::operator<< |
( |
const bool | value | ) |
|
|
inlineinherited |
Definition at line 150 of file JSerialisable.hh.
150{
write((
const char*) &value,
sizeof(
bool));
return *
this; }
virtual int write(const char *buffer, const int length)=0
Write byte array.
◆ operator<<() [3/16]
JWriter & JIO::JWriter::operator<< |
( |
const char | value | ) |
|
|
inlineinherited |
◆ operator<<() [4/16]
JWriter & JIO::JWriter::operator<< |
( |
const unsigned char | value | ) |
|
|
inlineinherited |
Definition at line 152 of file JSerialisable.hh.
152{
write((
const char*) &value,
sizeof(
unsigned char));
return *
this; }
◆ operator<<() [5/16]
JWriter & JIO::JWriter::operator<< |
( |
const short | value | ) |
|
|
inlineinherited |
◆ operator<<() [6/16]
JWriter & JIO::JWriter::operator<< |
( |
const unsigned short | value | ) |
|
|
inlineinherited |
Definition at line 154 of file JSerialisable.hh.
154{
write((
const char*) &value,
sizeof(
unsigned short));
return *
this; }
◆ operator<<() [7/16]
JWriter & JIO::JWriter::operator<< |
( |
const int | value | ) |
|
|
inlineinherited |
◆ operator<<() [8/16]
JWriter & JIO::JWriter::operator<< |
( |
const unsigned int | value | ) |
|
|
inlineinherited |
Definition at line 156 of file JSerialisable.hh.
156{
write((
const char*) &value,
sizeof(
unsigned int));
return *
this; }
◆ operator<<() [9/16]
JWriter & JIO::JWriter::operator<< |
( |
const long int | value | ) |
|
|
inlineinherited |
◆ operator<<() [10/16]
JWriter & JIO::JWriter::operator<< |
( |
const unsigned long int | value | ) |
|
|
inlineinherited |
Definition at line 158 of file JSerialisable.hh.
158{
write((
const char*) &value,
sizeof(
unsigned long int));
return *
this; }
◆ operator<<() [11/16]
JWriter & JIO::JWriter::operator<< |
( |
const long long int | value | ) |
|
|
inlineinherited |
Definition at line 159 of file JSerialisable.hh.
159{
write((
const char*) &value,
sizeof(
long long int));
return *
this; }
◆ operator<<() [12/16]
JWriter & JIO::JWriter::operator<< |
( |
const unsigned long long int | value | ) |
|
|
inlineinherited |
Definition at line 160 of file JSerialisable.hh.
160{
write((
const char*) &value,
sizeof(
unsigned long long int));
return *
this; }
◆ operator<<() [13/16]
JWriter & JIO::JWriter::operator<< |
( |
const float | value | ) |
|
|
inlineinherited |
◆ operator<<() [14/16]
JWriter & JIO::JWriter::operator<< |
( |
const double | value | ) |
|
|
inlineinherited |
◆ operator<<() [15/16]
JWriter & JIO::JWriter::operator<< |
( |
const long double | value | ) |
|
|
inlineinherited |
◆ operator<<() [16/16]
Definition at line 164 of file JSerialisable.hh.
164{
return (*
this) << value.
getID(); }
int getID() const
Get identifier.
◆ store() [1/2]
Write object.
- Parameters
-
- Returns
- this writer
Definition at line 173 of file JSerialisable.hh.
174 {
175 return object.write(*this);
176 }
◆ store() [2/2]
template<class T >
JWriter & JIO::JWriter::store |
( |
const T & | object | ) |
|
|
inlineinherited |
Write object.
- Parameters
-
- Returns
- this writer
Definition at line 186 of file JSerialisable.hh.
187 {
188 return *this << object;
189 }
◆ operator bool()
JLANG::JAbstractObjectStatus::operator bool |
( |
| ) |
const |
|
inlineinherited |
Type conversion operator.
- Returns
- status of this object
Definition at line 33 of file JAbstractObjectStatus.hh.
34 {
36 }
virtual bool getStatus() const =0
Get status of object.
◆ operator!()
bool JLANG::JAbstractObjectStatus::operator! |
( |
| ) |
const |
|
inlineinherited |
◆ out
◆ buffer
char* JIO::JBufferedWriter::buffer |
|
protected |
◆ size
int JIO::JBufferedWriter::size |
|
protected |
◆ pos
int JIO::JBufferedWriter::pos |
|
protected |
The documentation for this class was generated from the following file: