Jpp  16.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JLANG::JFileOutputStreamBuffer Class Reference

Output file stream buffer. More...

#include <JFileStreamBuffer.hh>

Inheritance diagram for JLANG::JFileOutputStreamBuffer:
std::vector< char > JLANG::JFileOutputStream JLANG::JFileStreamBuffer JLANG::JFileStream JSYSTEM::JShell

Public Types

typedef traits_type::int_type int_type
 
typedef std::streamsize streamsize
 

Public Member Functions

 JFileOutputStreamBuffer (const JAbstractFile &file, const std::size_t size=65536)
 Constructor. More...
 
virtual ~JFileOutputStreamBuffer ()
 Destructor. More...
 
virtual int_type overflow (int_type c) override
 Check overflow. More...
 
virtual int sync () override
 Synchronise buffer. More...
 
bool out_avail (JTimeval timeout=JTimeval::min()) const
 Check availability of output. More...
 

Protected Member Functions

int flush ()
 Flush internal buffer. More...
 

Protected Attributes

JFile out
 

Detailed Description

Output file stream buffer.

Definition at line 108 of file JFileStreamBuffer.hh.

Member Typedef Documentation

typedef traits_type::int_type JLANG::JFileOutputStreamBuffer::int_type

Definition at line 115 of file JFileStreamBuffer.hh.

Definition at line 116 of file JFileStreamBuffer.hh.

Constructor & Destructor Documentation

JLANG::JFileOutputStreamBuffer::JFileOutputStreamBuffer ( const JAbstractFile file,
const std::size_t  size = 65536 
)
inline

Constructor.

Parameters
filefile
sizesize of internal buffer

Definition at line 125 of file JFileStreamBuffer.hh.

126  :
127  out (file)
128  {
129  // reserve one byte for overflow character
130 
131  resize(size);
132 
133  setp(this->data(), this->data() + this->size() - 1);
134  }
virtual JLANG::JFileOutputStreamBuffer::~JFileOutputStreamBuffer ( )
inlinevirtual

Destructor.

Definition at line 140 of file JFileStreamBuffer.hh.

141  {
142  sync();
143  }
virtual int sync() override
Synchronise buffer.

Member Function Documentation

virtual int_type JLANG::JFileOutputStreamBuffer::overflow ( int_type  c)
inlineoverridevirtual

Check overflow.

This method writes one byte if possible.

Parameters
ccharacter
Returns
c if OK; else EOF

Definition at line 153 of file JFileStreamBuffer.hh.

154  {
155  if (c != traits_type::eof()) {
156 
157  *pptr() = (char) c;
158 
159  pbump(1);
160 
161  if (flush() == traits_type::eof()) {
162  return traits_type::eof();
163  }
164  }
165 
166  return c;
167  }
int flush()
Flush internal buffer.
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
virtual int JLANG::JFileOutputStreamBuffer::sync ( )
inlineoverridevirtual

Synchronise buffer.

Definition at line 173 of file JFileStreamBuffer.hh.

174  {
175  if (flush() == traits_type::eof())
176  return -1;
177  else
178  return 0;
179  }
int flush()
Flush internal buffer.
bool JLANG::JFileOutputStreamBuffer::out_avail ( JTimeval  timeout = JTimeval::min()) const
inline

Check availability of output.

This method returns true if at least one byte can be written without blocking.

Parameters
timeouttimeout
Returns
true if ready to write; else false

Definition at line 189 of file JFileStreamBuffer.hh.

190  {
191  return JFileDescriptorMask(out).out_avail(timeout);
192  }
bool out_avail(JTimeval timeout=JTimeval::min())
Check availability of output.
Auxiliary class for method select.
int JLANG::JFileOutputStreamBuffer::flush ( )
inlineprotected

Flush internal buffer.

Definition at line 198 of file JFileStreamBuffer.hh.

199  {
200  const int len = pptr() - pbase();
201 
202  if (len != 0) {
203 
204  if (out.write(this->data(), len) != len) {
205  return traits_type::eof();
206  }
207 
208  pbump(-len);
209  }
210 
211  return len;
212  }
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
virtual int write(const char *buffer, const int length)
Write data to file.
Definition: JFile.hh:87

Member Data Documentation

JFile JLANG::JFileOutputStreamBuffer::out
protected

Definition at line 215 of file JFileStreamBuffer.hh.


The documentation for this class was generated from the following file: