Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
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 override=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_t &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

◆ getHelper()

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

Get helper.

Returns
pointer to helper

Implements JLANG::JAbstractObjectWriter< T >.

Implemented in JLANG::JAccessibleObjectWriter< T >.

◆ is_open()

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 override=0
Get helper.

◆ open()

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  }

◆ close()

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  }

◆ put() [1/2]

template<class T >
virtual bool JLANG::JObjectOutput< T >::put ( const T &  object)
pure virtualinherited

◆ Throw() [1/2]

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

◆ Throw() [2/2]

static int JLANG::JThrow< JAccessible >::Throw ( const JException_t &  error,
const int  value = -1 
)
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 51 of file JThrow.hh.

52  {
53  using namespace std;
54 
55  if (do_throw) {
56  throw error;
57  }
58 
59  cerr << error.what() << endl;
60 
61  return value;
62  }
Definition: JSTDTypes.hh:14

◆ put() [2/2]

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 bool put(const T &object) override
Object output.
virtual JObjectOutput< T > * getHelper() const =0
Get helper.

Member Data Documentation

◆ do_throw

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: