Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
JLANG::JGZFileWriter< T > Class Template Reference

Object reading from gzipped file. More...

#include <JGZFileWriter.hh>

Inheritance diagram for JLANG::JGZFileWriter< T >:
ogzstream JLANG::JStreamObjectOutput< T > JLANG::JAccessibleObjectOutput< T > gzstreambase JLANG::JObjectOutput< T > JLANG::JObjectOutput< T > JLANG::JAccessible JLANG::JThrow< JAccessible >

Public Member Functions

 JGZFileWriter ()
 Default constructor. More...
 
 JGZFileWriter (const char *file_name)
 Constructor. More...
 
 JGZFileWriter (const char *file_name, const std::string &sep)
 Constructor. More...
 
virtual bool is_open () const override
 Check is file is open. More...
 
virtual void open (const char *file_name) override
 Open file. More...
 
virtual void close () override
 Close file. More...
 
void open (const char *name, int open_mode=std::ios::out)
 
gzstreambufrdbuf ()
 
virtual bool put (const T &object) override
 Object output. More...
 
const std::stringgetSeparator () const
 Get token separator. More...
 
void setSeparator (const std::string &sep)
 Set token separator. More...
 

Static Public Member Functions

static void Throw (const bool option)
 Enable/disable throw option. More...
 
static int Throw (const JException &error, const int value=-1)
 Throw exception or return error. More...
 

Protected Attributes

gzstreambuf buf
 

Static Protected Attributes

static bool do_throw
 throw option More...
 

Detailed Description

template<class T>
class JLANG::JGZFileWriter< T >

Object reading from gzipped file.

This class implements the JAccessibleObjectIterator interface.

Definition at line 28 of file JGZFileWriter.hh.

Constructor & Destructor Documentation

template<class T >
JLANG::JGZFileWriter< T >::JGZFileWriter ( )
inline

Default constructor.

Definition at line 37 of file JGZFileWriter.hh.

37  :
38  ogzstream(),
39  JStreamObjectOutput<T>(static_cast<std::ostream&>(*this), "")
40  {}
ogzstream()
Definition: gzstream.h:215
Template implementation of stream output for single data type.
template<class T >
JLANG::JGZFileWriter< T >::JGZFileWriter ( const char *  file_name)
inline

Constructor.

Parameters
file_namefile name

Definition at line 48 of file JGZFileWriter.hh.

48  :
49  JAccessible(),
50  ogzstream(file_name),
51  JStreamObjectOutput<T>(static_cast<std::ostream&>(*this), "")
52  {}
ogzstream()
Definition: gzstream.h:215
Template implementation of stream output for single data type.
JAccessible()
Default constructor.
Definition: JAccessible.hh:27
template<class T >
JLANG::JGZFileWriter< T >::JGZFileWriter ( const char *  file_name,
const std::string sep 
)
inline

Constructor.

Parameters
file_namefile name
septoken separator

Definition at line 61 of file JGZFileWriter.hh.

62  :
63  JAccessible(),
64  ogzstream(file_name),
65  JStreamObjectOutput<T>(static_cast<std::ostream&>(*this), sep)
66  {}
ogzstream()
Definition: gzstream.h:215
Template implementation of stream output for single data type.
JAccessible()
Default constructor.
Definition: JAccessible.hh:27

Member Function Documentation

template<class T >
virtual bool JLANG::JGZFileWriter< T >::is_open ( ) const
inlineoverridevirtual

Check is file is open.

Returns
true if open; else false

Implements JLANG::JAccessible.

Definition at line 74 of file JGZFileWriter.hh.

75  {
76  return ogzstream::is_open();
77  }
bool is_open() const
Definition: gzstream.h:194
template<class T >
virtual void JLANG::JGZFileWriter< T >::open ( const char *  file_name)
inlineoverridevirtual

Open file.

Parameters
file_namefile name

Implements JLANG::JAccessible.

Definition at line 85 of file JGZFileWriter.hh.

86  {
87  ogzstream::open(file_name);
88 
89  if (!this->is_open()) {
90  this->Throw(JFileOpenException(std::string("Error opening file ") + file_name));
91  }
92  }
Exception for opening of file.
Definition: JException.hh:342
void open(const char *name, int open_mode=std::ios::out)
Definition: gzstream.h:218
then awk string
virtual bool is_open() const override
Check is file is open.
static void Throw(const bool option)
Enable/disable throw option.
Definition: JThrow.hh:37
template<class T >
virtual void JLANG::JGZFileWriter< T >::close ( )
inlineoverridevirtual

Close file.

Implements JLANG::JAccessible.

Definition at line 98 of file JGZFileWriter.hh.

99  {
101  }
void close()
Definition: gzstream.h:185
void ogzstream::open ( const char *  name,
int  open_mode = std::ios::out 
)
inlineinherited

Definition at line 218 of file gzstream.h.

218  {
219  gzstreambase::open( name, open_mode);
220  }
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42
void open(const char *name, int open_mode)
Definition: gzstream.h:180
gzstreambuf* gzstreambase::rdbuf ( )
inlineinherited

Definition at line 193 of file gzstream.h.

193 { return &buf; }
gzstreambuf buf
Definition: gzstream.h:169
template<class T>
virtual bool JLANG::JStreamObjectOutput< T >::put ( const T object)
inlineoverridevirtualinherited

Object output.

Parameters
objectobject
Returns
true if OK; else false

Implements JLANG::JObjectOutput< T >.

Definition at line 51 of file JStreamObjectOutput.hh.

52  {
53  __out << object << __sep;
54 
55  return (bool) __out;
56  }
template<class T>
const std::string& JLANG::JStreamObjectOutput< T >::getSeparator ( ) const
inlineinherited

Get token separator.

Returns
separator

Definition at line 64 of file JStreamObjectOutput.hh.

65  {
66  return this->__sep;
67  }
template<class T>
void JLANG::JStreamObjectOutput< T >::setSeparator ( const std::string sep)
inlineinherited

Set token separator.

Parameters
sepseparator

Definition at line 75 of file JStreamObjectOutput.hh.

76  {
77  this->__sep = sep;
78  }
static void JLANG::JThrow< JAccessible >::Throw ( const bool  option)
inlinestaticinherited

Enable/disable throw option.

Parameters
optiontrue enable; false disable

Definition at line 37 of file JThrow.hh.

38  {
39  do_throw = option;
40  }
static bool do_throw
throw option
Definition: JThrow.hh:28
static int JLANG::JThrow< JAccessible >::Throw ( const JException error,
const int  value = -1 
)
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 50 of file JThrow.hh.

51  {
52  using namespace std;
53 
54  if (do_throw) {
55  throw error;
56  }
57 
58  cerr << error.what() << endl;
59 
60  return value;
61  }
virtual const char * what() const override
Get error message.
Definition: JException.hh:48
static bool do_throw
throw option
Definition: JThrow.hh:28

Member Data Documentation

gzstreambuf gzstreambase::buf
protectedinherited

Definition at line 169 of file gzstream.h.

bool JLANG::JThrow< JAccessible >::do_throw
staticprotectedinherited

throw option

Set default throw option to true.

Definition at line 28 of file JThrow.hh.


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