Jpp
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
JTRIGGER::JRunByRun Struct Reference

Auxiliary class to handle run by run options. More...

#include <JRunByRun.hh>

Inheritance diagram for JTRIGGER::JRunByRun:
JSUPPORT::JMultipleFileSampler< T, JSampler_t > JLANG::JMultiEquals< JClass_t, JTypelist_t > JLANG::JTemplate< JType_t > JLANG::JObjectSampler< T, JSampler_t > JLANG::JObjectIterator< T >

Public Types

typedef JSampler_t< T > sampler_type
 
typedef JTemplate< JType_t > template_type
 
typedef JObjectIterator< T >::pointer_type pointer_type
 

Public Member Functions

 JRunByRun ()
 Default constructor. More...
 
bool is_valid ()
 Check validity of run by run options. More...
 
 operator const JType_t & () const
 Type conversion. More...
 
 operator JType_t & ()
 Type conversion. More...
 
const JType_t * operator-> () const
 Smart pointer operator. More...
 
JType_t * operator-> ()
 Smart pointer operator. More...
 
template<class T , bool use_polymorphism = false>
const T & get () const
 Get reference to object. More...
 
template<class T , bool use_polymorphism = false>
T & get ()
 Get reference to object. More...
 
template_typeset (const JType_t &value)
 Set value. More...
 
template<bool use_polymorphism, class T >
template_typeset (const T &value)
 Set value. More...
 
virtual bool hasNext ()
 Check availability of next element. More...
 
virtual const pointer_typenext ()
 Get next element. More...
 
const JSampler_t< T > & getSampler () const
 Get sampler. More...
 
JSampler_t< T > & getSampler ()
 Get sampler. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Public Attributes

JPMTRateRange range_Hz
 

Protected Member Functions

const JType_t & c_get (JBool< true > option) const
 Get reference to object. More...
 
JType_t & c_get (JBool< true > option)
 Get reference to object. More...
 
template<class T >
template_typec_set (const T &value, JBool< true > option)
 Set value. More...
 

Static Protected Member Functions

template<class T >
static JProperties getProperties (T &object)
 Get properties of this class. More...
 
template<class JHead_t , class JTail_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
 Equals method for composite data types. More...
 
template<class JHead_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JNullType > > &type)
 Equals method for composite data types. More...
 

Protected Attributes

JType_t object
 object More...
 
JRewindableObjectIterator< T > & in
 
JSampler_t< T > sampler
 
JPointer< T > ps
 
bool has_next
 

Friends

std::istream & operator>> (std::istream &in, JRunByRun &object)
 Read run by run options from input. More...
 
std::ostream & operator<< (std::ostream &out, const JRunByRun &object)
 Write run by run options to output. More...
 

Detailed Description

Auxiliary class to handle run by run options.

Definition at line 38 of file JRunByRun.hh.

Member Typedef Documentation

◆ sampler_type

template<class T, template< class > class JSampler_t = JSampler>
typedef JSampler_t<T> JSUPPORT::JMultipleFileSampler< T, JSampler_t >::sampler_type
inherited

Definition at line 33 of file JMultipleFileSampler.hh.

◆ template_type

template<class JType_t>
typedef JTemplate<JType_t> JLANG::JTemplate< JType_t >::template_type
inherited

Definition at line 42 of file JTemplate.hh.

◆ pointer_type

template<class T, template< class > class JSampler_t = JSampler>
typedef JObjectIterator<T>::pointer_type JLANG::JObjectSampler< T, JSampler_t >::pointer_type
inherited

Definition at line 35 of file JObjectSampler.hh.

Constructor & Destructor Documentation

◆ JRunByRun()

JTRIGGER::JRunByRun::JRunByRun ( )
inline

Default constructor.

Definition at line 45 of file JRunByRun.hh.

45  :
46  JMultipleFileSampler<JDAQSummaryslice, JRandomSampler>(),
47  range_Hz()
48  {}

Member Function Documentation

◆ is_valid()

bool JTRIGGER::JRunByRun::is_valid ( )
inline

Check validity of run by run options.

Returns
true if okay; else false

Definition at line 56 of file JRunByRun.hh.

57  {
58  return !this->template get<JMultipleFileScanner<>,true>().empty();
59  }

◆ getProperties()

template<class T >
static JProperties JTRIGGER::JRunByRun::getProperties ( T &  object)
inlinestaticprotected

Get properties of this class.

Returns
properties

Definition at line 108 of file JRunByRun.hh.

109  {
110  JProperties properties;
111 
112  properties["file"] = object.template get<JMultipleFileScanner<>,true>();
113  properties["sampler"] = object.getSampler();
114  properties["range_Hz"] = object.range_Hz;
115 
116  return properties;
117  }

◆ operator const JType_t &()

template<class JType_t>
JLANG::JTemplate< JType_t >::operator const JType_t & ( ) const
inlineinherited

Type conversion.

Returns
reference to object

Definition at line 68 of file JTemplate.hh.

69  {
70  return object;
71  }

◆ operator JType_t &()

template<class JType_t>
JLANG::JTemplate< JType_t >::operator JType_t & ( )
inlineinherited

Type conversion.

Returns
reference to object

Definition at line 79 of file JTemplate.hh.

80  {
81  return object;
82  }

◆ operator->() [1/2]

template<class JType_t>
const JType_t* JLANG::JTemplate< JType_t >::operator-> ( ) const
inlineinherited

Smart pointer operator.

Returns
pointer to object

Definition at line 90 of file JTemplate.hh.

91  {
92  return &object;
93  }

◆ operator->() [2/2]

template<class JType_t>
JType_t* JLANG::JTemplate< JType_t >::operator-> ( )
inlineinherited

Smart pointer operator.

Returns
pointer to object

Definition at line 101 of file JTemplate.hh.

102  {
103  return &object;
104  }

◆ get() [1/2]

template<class JType_t>
template<class T , bool use_polymorphism = false>
const T& JLANG::JTemplate< JType_t >::get ( ) const
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 113 of file JTemplate.hh.

114  {
116  }

◆ get() [2/2]

template<class JType_t>
template<class T , bool use_polymorphism = false>
T& JLANG::JTemplate< JType_t >::get ( )
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 125 of file JTemplate.hh.

126  {
128  }

◆ set() [1/2]

template<class JType_t>
template_type& JLANG::JTemplate< JType_t >::set ( const JType_t &  value)
inlineinherited

Set value.

Parameters
valuevalue
Returns
this object

Definition at line 137 of file JTemplate.hh.

138  {
139  return c_set(value, JBool<true>());
140  }

◆ set() [2/2]

template<class JType_t>
template<bool use_polymorphism, class T >
template_type& JLANG::JTemplate< JType_t >::set ( const T &  value)
inlineinherited

Set value.

Parameters
valuevalue
Returns
this object

Definition at line 150 of file JTemplate.hh.

◆ c_get() [1/2]

template<class JType_t>
const JType_t& JLANG::JTemplate< JType_t >::c_get ( JBool< true >  option) const
inlineprotectedinherited

Get reference to object.

Parameters
optiontrue
Returns
reference to object

Definition at line 188 of file JTemplate.hh.

189  {
190  return object;
191  }

◆ c_get() [2/2]

template<class JType_t>
JType_t& JLANG::JTemplate< JType_t >::c_get ( JBool< true >  option)
inlineprotectedinherited

Get reference to object.

Parameters
optiontrue
Returns
reference to object

Definition at line 200 of file JTemplate.hh.

201  {
202  return object;
203  }

◆ c_set()

template<class JType_t>
template<class T >
template_type& JLANG::JTemplate< JType_t >::c_set ( const T &  value,
JBool< true >  option 
)
inlineprotectedinherited

Set value.

Parameters
valuevalue
optiontrue
Returns
this object

Definition at line 214 of file JTemplate.hh.

215  {
216  object = value;
217 
218  return *this;
219  }

◆ hasNext()

template<class T, template< class > class JSampler_t = JSampler>
virtual bool JLANG::JObjectSampler< T, JSampler_t >::hasNext ( )
inlinevirtualinherited

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< T >.

Definition at line 68 of file JObjectSampler.hh.

69  {
70  while (!has_next) {
71 
72  if (!in.hasNext()) {
73  in.rewind();
74  }
75 
76  if (in.hasNext()) {
77 
78  ps.set(in.next());
79 
80  skip_type ns = sampler(*ps);
81 
82  if (ns == 0) {
83 
84  has_next = true;
85 
86  } else {
87 
88  while ((ns -= in.skip(ns)) != 0) {
89  in.rewind();
90  }
91  }
92 
93  } else {
94 
95  // nothing to sample
96 
97  break;
98  }
99  }
100 
101  return has_next;
102  }

◆ next()

template<class T, template< class > class JSampler_t = JSampler>
virtual const pointer_type& JLANG::JObjectSampler< T, JSampler_t >::next ( )
inlinevirtualinherited

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< T >.

Definition at line 110 of file JObjectSampler.hh.

111  {
112  if (!has_next) {
113  ps.reset(NULL);
114  }
115 
116  has_next = false;
117 
118  return ps;
119  }

◆ getSampler() [1/2]

template<class T, template< class > class JSampler_t = JSampler>
const JSampler_t<T>& JLANG::JObjectSampler< T, JSampler_t >::getSampler ( ) const
inlineinherited

Get sampler.

Returns
sampler

Definition at line 127 of file JObjectSampler.hh.

128  {
129  return sampler;
130  }

◆ getSampler() [2/2]

template<class T, template< class > class JSampler_t = JSampler>
JSampler_t<T>& JLANG::JObjectSampler< T, JSampler_t >::getSampler ( )
inlineinherited

Get sampler.

Returns
sampler

Definition at line 138 of file JObjectSampler.hh.

139  {
140  return sampler;
141  }

◆ skip()

template<class T>
virtual skip_type JLANG::JObjectIterator< T >::skip ( const skip_type  ns)
inlinevirtualinherited

◆ eq() [1/2]

template<class JClass_t, class JTypelist_t>
template<class JHead_t , class JTail_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JTail_t > > &  type 
)
inlinestaticprotectedinherited

Equals method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if two objects are equal; else false

Definition at line 42 of file JMultiEquals.hh.

45  {
46  return (static_cast<const JHead_t&>(first) ==
47  static_cast<const JHead_t&>(second) &&
48  eq(first, second, JType<JTail_t>()));
49  }

◆ eq() [2/2]

template<class JClass_t, class JTypelist_t>
template<class JHead_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JNullType > > &  type 
)
inlinestaticprotectedinherited

Equals method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if two objects are equal; else false

Definition at line 61 of file JMultiEquals.hh.

64  {
65  return (static_cast<const JHead_t&>(first) ==
66  static_cast<const JHead_t&>(second));
67  }

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JRunByRun object 
)
friend

Read run by run options from input.

Parameters
ininput stream
objectrun by run options
Returns
input stream

Definition at line 69 of file JRunByRun.hh.

70  {
71  using namespace std;
72  using namespace JPP;
73 
74  JStringStream is(in);
75 
76  if (getFileStatus(is.str().c_str())) {
77  is.load();
78  }
79 
80  getProperties(object).read(is);
81 
82  return in;
83  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JRunByRun object 
)
friend

Write run by run options to output.

Parameters
outoutput stream
objectrun by run options
Returns
output stream

Definition at line 93 of file JRunByRun.hh.

94  {
95  return getProperties(object).write(out);
96  }

Member Data Documentation

◆ range_Hz

JPMTRateRange JTRIGGER::JRunByRun::range_Hz

Definition at line 99 of file JRunByRun.hh.

◆ object

template<class JType_t>
JType_t JLANG::JTemplate< JType_t >::object
protectedinherited

object

Definition at line 222 of file JTemplate.hh.

◆ in

template<class T, template< class > class JSampler_t = JSampler>
JRewindableObjectIterator<T>& JLANG::JObjectSampler< T, JSampler_t >::in
protectedinherited

Definition at line 144 of file JObjectSampler.hh.

◆ sampler

template<class T, template< class > class JSampler_t = JSampler>
JSampler_t<T> JLANG::JObjectSampler< T, JSampler_t >::sampler
protectedinherited

Definition at line 145 of file JObjectSampler.hh.

◆ ps

template<class T, template< class > class JSampler_t = JSampler>
JPointer<T> JLANG::JObjectSampler< T, JSampler_t >::ps
protectedinherited

Definition at line 146 of file JObjectSampler.hh.

◆ has_next

template<class T, template< class > class JSampler_t = JSampler>
bool JLANG::JObjectSampler< T, JSampler_t >::has_next
protectedinherited

Definition at line 147 of file JObjectSampler.hh.


The documentation for this struct was generated from the following file:
JLANG::JPointer::set
virtual void set(JClass_t *p)
Set pointer.
Definition: JPointer.hh:75
JTRIGGER::JRunByRun::range_Hz
JPMTRateRange range_Hz
Definition: JRunByRun.hh:99
JLANG::skip_type
unsigned int skip_type
Type definition for number of objects to skip.
Definition: JObjectIterator.hh:25
JLANG::JType
Auxiliary class for a type holder.
Definition: JType.hh:19
JTRIGGER::JRunByRun::getProperties
static JProperties getProperties(T &object)
Get properties of this class.
Definition: JRunByRun.hh:108
JLANG::JTemplate::c_get
const JType_t & c_get(JBool< true > option) const
Get reference to object.
Definition: JTemplate.hh:188
JLANG::JTemplate::c_set
template_type & c_set(const T &value, JBool< true > option)
Set value.
Definition: JTemplate.hh:214
JLANG::JTemplate::object
JType_t object
object
Definition: JTemplate.hh:222
JLANG::JObjectIterator::hasNext
virtual bool hasNext()=0
Check availability of next element.
JLANG::JConversion
Template class test for polymorphism.
Definition: JConversion.hh:21
JEEP::JProperties::read
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:677
JLANG::JObjectSampler::in
JRewindableObjectIterator< T > & in
Definition: JObjectSampler.hh:144
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JLANG::JMultiEquals::eq
static bool eq(const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
Equals method for composite data types.
Definition: JMultiEquals.hh:42
JLANG::JPointer::reset
virtual void reset()
Reset pointer.
Definition: JPointer.hh:84
JSYSTEM::getFileStatus
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
JLANG::JObjectSampler::has_next
bool has_next
Definition: JObjectSampler.hh:147
JLANG::JBool
Auxiliary template class for type bool.
Definition: JBool.hh:20
JLANG::JObjectSampler::ps
JPointer< T > ps
Definition: JObjectSampler.hh:146
JEEP::JProperties
Utility class to parse parameter values.
Definition: JProperties.hh:496
JEEP::JProperties::write
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Definition: JProperties.hh:845
std
Definition: jaanetDictionary.h:36
JLANG::JConstructor
Template class test for availability of a suitable constructor JType_t(const JArgument_t).
Definition: JConstructor.hh:19
JLANG::JObjectIterator::next
virtual const pointer_type & next()=0
Get next element.
JLANG::JObjectSampler::sampler
JSampler_t< T > sampler
Definition: JObjectSampler.hh:145