Jpp  18.2.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
JLANG::JObjectDemultiplexer< JBase_t, JDerived_t > Struct Template Reference

Auxiliary class for demultiplexing object outputs. More...

#include <JObjectDemultiplexer.hh>

Inheritance diagram for JLANG::JObjectDemultiplexer< JBase_t, JDerived_t >:
JLANG::JObjectOutput< JBase_t >

Public Member Functions

 JObjectDemultiplexer (JObjectOutput< JDerived_t > &output)
 Constructor. More...
 
virtual bool put (const JBase_t &object) override
 Object output. More...
 

Private Attributes

JObjectOutput< JDerived_t > & out
 

Friends

void operator| (JObjectIterator< JBase_t > &in, JObjectDemultiplexer &out)
 Pipe operator. More...
 

Detailed Description

template<class JBase_t, class JDerived_t>
struct JLANG::JObjectDemultiplexer< JBase_t, JDerived_t >

Auxiliary class for demultiplexing object outputs.

The template argument JDerived_t refers to a list of multiple object outputs which are processed in parallel.
The template argument JBase_t refers to a single object output which provides for a common interface to the multiple object outputs.

This class implements the JLANG::JObjectOutput interface.

Definition at line 30 of file JObjectDemultiplexer.hh.

Constructor & Destructor Documentation

template<class JBase_t, class JDerived_t>
JLANG::JObjectDemultiplexer< JBase_t, JDerived_t >::JObjectDemultiplexer ( JObjectOutput< JDerived_t > &  output)
inline

Constructor.

Parameters
outputobject output

Definition at line 38 of file JObjectDemultiplexer.hh.

38  :
39  out(output)
40  {}
JObjectOutput< JDerived_t > & out

Member Function Documentation

template<class JBase_t, class JDerived_t>
virtual bool JLANG::JObjectDemultiplexer< JBase_t, JDerived_t >::put ( const JBase_t &  object)
inlineoverridevirtual

Object output.

Parameters
objectobject
Returns
true if OK; else false

Implements JLANG::JObjectOutput< JBase_t >.

Reimplemented in JLANG::JObjectDemultiplexer< JBase_t, JTypeList< JHead_t, JTail_t > >.

Definition at line 49 of file JObjectDemultiplexer.hh.

50  {
51  const JDerived_t* p = dynamic_cast<const JDerived_t*>(&object);
52 
53  if (p != NULL)
54  return out.put(*p);
55  else
56  return false;
57  }
JObjectOutput< JDerived_t > & out
virtual bool put(const T &object)=0
Object output.

Friends And Related Function Documentation

template<class JBase_t, class JDerived_t>
void operator| ( JObjectIterator< JBase_t > &  in,
JObjectDemultiplexer< JBase_t, JDerived_t > &  out 
)
friend

Pipe operator.

Parameters
inobject demultiplexer
outobject output

Definition at line 66 of file JObjectDemultiplexer.hh.

67  {
68  while (in.hasNext() && out.put(*in.next())) {}
69  }
virtual bool put(const JBase_t &object) override
Object output.
virtual const pointer_type & next()=0
Get next element.
virtual bool hasNext()=0
Check availability of next element.

Member Data Documentation

template<class JBase_t, class JDerived_t>
JObjectOutput<JDerived_t>& JLANG::JObjectDemultiplexer< JBase_t, JDerived_t >::out
private

Definition at line 72 of file JObjectDemultiplexer.hh.


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