Jpp
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
JGIZMO::JLineAttributes Class Reference

Auxiliary class to set line attributes. More...

#include <JLineAttributes.hh>

Inheritance diagram for JGIZMO::JLineAttributes:
JLANG::JRewindableObjectIterator< T > std::vector< TAttLine > JLANG::JObjectIterator< T > JLANG::JRewindable< T >

Public Types

typedef JRewindableObjectIterator< TAttLine >::pointer_type pointer_type
 

Public Member Functions

 JLineAttributes (const Width_t width=2)
 Constructor. More...
 
void setLineWidth (const Width_t width)
 Set line width. More...
 
virtual void rewind ()
 Rewind index. More...
 
virtual bool hasNext ()
 Check availability of next element. More...
 
virtual const pointer_typenext ()
 Get next element. More...
 
const TAttLine & get (unsigned int index)
 Get line attributes. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Static Public Member Functions

static JLineAttributesgetInstance ()
 Get reference to unique instance of this class object. More...
 

Private Attributes

unsigned int index
 

Detailed Description

Auxiliary class to set line attributes.

Definition at line 27 of file JLineAttributes.hh.

Member Typedef Documentation

◆ pointer_type

Definition at line 33 of file JLineAttributes.hh.

Constructor & Destructor Documentation

◆ JLineAttributes()

JGIZMO::JLineAttributes::JLineAttributes ( const Width_t  width = 2)
inline

Constructor.

Parameters
widthline width

Definition at line 41 of file JLineAttributes.hh.

41  :
43  index(0)
44  {
45  for (int i = 1; i <= 10; ++i) {
46  push_back(TAttLine(kBlack, i, width));
47  }
48  }

Member Function Documentation

◆ getInstance()

static JLineAttributes& JGIZMO::JLineAttributes::getInstance ( )
inlinestatic

Get reference to unique instance of this class object.

Returns
reference to this class object

Definition at line 56 of file JLineAttributes.hh.

57  {
58  static JLineAttributes line(2);
59 
60  return line;
61  }

◆ setLineWidth()

void JGIZMO::JLineAttributes::setLineWidth ( const Width_t  width)
inline

Set line width.

Parameters
widthline width

Definition at line 69 of file JLineAttributes.hh.

70  {
71  for (iterator i = this->begin(); i != this->end(); ++i) {
72  i->SetLineWidth(width);
73  }
74  }

◆ rewind()

virtual void JGIZMO::JLineAttributes::rewind ( )
inlinevirtual

Rewind index.

Implements JLANG::JRewindable< T >.

Definition at line 80 of file JLineAttributes.hh.

81  {
82  index = 0;
83  }

◆ hasNext()

virtual bool JGIZMO::JLineAttributes::hasNext ( )
inlinevirtual

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< T >.

Definition at line 91 of file JLineAttributes.hh.

92  {
93  return !this->empty();
94  }

◆ next()

virtual const pointer_type& JGIZMO::JLineAttributes::next ( )
inlinevirtual

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< T >.

Definition at line 102 of file JLineAttributes.hh.

103  {
104  static pointer_type ps;
105 
106  if (index < this->size()) {
107  ps.reset(&this->at(index));
108  }
109 
110  ++index;
111 
112  index = index%this->size();
113 
114  return ps;
115  }

◆ get()

const TAttLine& JGIZMO::JLineAttributes::get ( unsigned int  index)
inline

Get line attributes.

Parameters
indexindex
Returns
line attributes

Definition at line 124 of file JLineAttributes.hh.

125  {
126  return this->at(index%this->size());
127  }

◆ skip()

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

Member Data Documentation

◆ index

unsigned int JGIZMO::JLineAttributes::index
private

Definition at line 131 of file JLineAttributes.hh.


The documentation for this class was generated from the following file:
JLANG::skip_type
unsigned int skip_type
Type definition for number of objects to skip.
Definition: JObjectIterator.hh:25
std::vector< TAttLine >
JLANG::JObjectIterator::hasNext
virtual bool hasNext()=0
Check availability of next element.
JGIZMO::JLineAttributes
Auxiliary class to set line attributes.
Definition: JLineAttributes.hh:27
JGIZMO::JLineAttributes::index
unsigned int index
Definition: JLineAttributes.hh:131
JGIZMO::JLineAttributes::pointer_type
JRewindableObjectIterator< TAttLine >::pointer_type pointer_type
Definition: JLineAttributes.hh:33
JLANG::JObjectIterator::next
virtual const pointer_type & next()=0
Get next element.