Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
JLANG::JAbstractAccessibleObjectWriter< T > Struct Template Referenceabstract

Abstract interface for object writing with named access. More...

#include <JAbstractObjectWriter.hh>

Inheritance diagram for JLANG::JAbstractAccessibleObjectWriter< T >:
JLANG::JAccessibleObjectOutput< T > JLANG::JAbstractObjectWriter< T > JLANG::JObjectOutput< T > JLANG::JAccessible JLANG::JObjectOutput< T > JLANG::JThrow< JAccessible > JLANG::JAccessibleObjectWriter< T > JSUPPORT::JFileRecorder< T >

Public Member Functions

virtual
JAccessibleObjectOutput< T > * 
getHelper () const =0
 Get helper. More...
 
virtual bool is_open () const override
 Check is device is open. More...
 
virtual void open (const char *file_name) override
 Open device. More...
 
virtual void close () override
 Close device. More...
 
virtual bool put (const T &object)=0
 Object output. More...
 
virtual bool put (const T &object) override
 Object output. 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...
 

Static Protected Attributes

static bool do_throw
 throw option More...
 

Detailed Description

template<class T>
struct JLANG::JAbstractAccessibleObjectWriter< T >

Abstract interface for object writing with named access.

This class implements the JAccessibleObjectOutput interface by transferring the interface methods to a helper object via a single interface method getHelper().

Definition at line 85 of file JAbstractObjectWriter.hh.

Member Function Documentation

template<class T >
virtual JAccessibleObjectOutput<T>* JLANG::JAbstractAccessibleObjectWriter< T >::getHelper ( ) const
pure virtual

Get helper.

Returns
pointer to helper

Implements JLANG::JAbstractObjectWriter< T >.

Implemented in JLANG::JAccessibleObjectWriter< T >.

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

Check is device is open.

Returns
true if open; else false

Implements JLANG::JAccessible.

Definition at line 102 of file JAbstractObjectWriter.hh.

103  {
104  if (this->getHelper() != NULL)
105  return this->getHelper()->is_open();
106  else
107  return false;
108  }
virtual JAccessibleObjectOutput< T > * getHelper() const =0
Get helper.
template<class T >
virtual void JLANG::JAbstractAccessibleObjectWriter< T >::open ( const char *  file_name)
inlineoverridevirtual

Open device.

Parameters
file_namefile name

Implements JLANG::JAccessible.

Reimplemented in JSUPPORT::JFileRecorder< T >.

Definition at line 116 of file JAbstractObjectWriter.hh.

117  {
118  if (this->getHelper() != NULL) {
119  this->getHelper()->open(file_name);
120  }
121  }
virtual JAccessibleObjectOutput< T > * getHelper() const =0
Get helper.
template<class T >
virtual void JLANG::JAbstractAccessibleObjectWriter< T >::close ( )
inlineoverridevirtual

Close device.

Implements JLANG::JAccessible.

Definition at line 127 of file JAbstractObjectWriter.hh.

128  {
129  if (this->getHelper() != NULL) {
130  this->getHelper()->close();
131  }
132  }
virtual JAccessibleObjectOutput< T > * getHelper() const =0
Get helper.
template<class T>
virtual bool JLANG::JObjectOutput< T >::put ( const T object)
pure virtualinherited
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
template<class T>
virtual bool JLANG::JAbstractObjectWriter< T >::put ( const T object)
inlineoverridevirtualinherited

Object output.

Parameters
objectobject
Returns
true if OK; else false

Implements JLANG::JObjectOutput< T >.

Definition at line 43 of file JAbstractObjectWriter.hh.

44  {
45  return (this->getHelper() != NULL && this->getHelper()->put(object));
46  }
virtual JObjectOutput< T > * getHelper() const =0
Get helper.
virtual bool put(const T &object) override
Object output.

Member Data Documentation

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 struct was generated from the following file: