rock_widget_collection  0.1
Public Member Functions | Public Attributes | List of all members
TaskRepresentation Class Reference

Public Member Functions

 TaskRepresentation (const std::string &name)
 
 ~TaskRepresentation ()
 
void updateData (const aggregator::StreamAlignerStatus &status)
 
QVariant data (int col, int role)
 
int getStreamCount () const
 
QVariant data (int row, int col, int role)
 

Public Attributes

QVariant taskName
 

Detailed Description

Definition at line 137 of file StreamAlignerWidget.cpp.

Constructor & Destructor Documentation

◆ TaskRepresentation()

TaskRepresentation::TaskRepresentation ( const std::string &  name)
inline

Definition at line 139 of file StreamAlignerWidget.cpp.

140  {
141  taskName = QString::fromStdString(name);
142  childCount = 0;
143  }

◆ ~TaskRepresentation()

TaskRepresentation::~TaskRepresentation ( )
inline

Definition at line 145 of file StreamAlignerWidget.cpp.

146  {
147  for(std::vector<StreamRepresentation *>::const_iterator it = streams.begin(); it != streams.end(); it++)
148  {
149  delete *it;
150  }
151  }

Member Function Documentation

◆ data() [1/2]

QVariant TaskRepresentation::data ( int  col,
int  role 
)
inline

Definition at line 174 of file StreamAlignerWidget.cpp.

175  {
176  if(role == Qt::DisplayRole && col == 0)
177  return taskName;
178 
179  return QVariant();
180  };

◆ data() [2/2]

QVariant TaskRepresentation::data ( int  row,
int  col,
int  role 
)
inline

Definition at line 189 of file StreamAlignerWidget.cpp.

190  {
191  if(row >= childCount)
192  {
193  throw std::runtime_error("Tried to access invalid stream");
194  }
195  return streams[row]->data(col, role);
196  }

◆ getStreamCount()

int TaskRepresentation::getStreamCount ( ) const
inline

Definition at line 184 of file StreamAlignerWidget.cpp.

185  {
186  return childCount;
187  };

◆ updateData()

void TaskRepresentation::updateData ( const aggregator::StreamAlignerStatus &  status)
inline

Definition at line 153 of file StreamAlignerWidget.cpp.

154  {
155  if(status.streams.size() != streams.size())
156  streams.resize(status.streams.size(), NULL);
157 
158  int i = 0;
159  childCount = 0;
160  for(std::vector<aggregator::StreamStatus>::const_iterator it = status.streams.begin(); it != status.streams.end(); it++)
161  {
162 
163  if(!streams[i])
164  {
165  streams[i] = new StreamRepresentation(*it);
166  }
167 
168  streams[i]->updateData(*it, status.time);
169  i++;
170  childCount++;
171  }
172  }

Member Data Documentation

◆ taskName

QVariant TaskRepresentation::taskName

Definition at line 180 of file StreamAlignerWidget.cpp.


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