Yosokumo::CellBlock Class Reference

Represents a block of Cells. More...

#include <CellBlock.h>

Inheritance diagram for Yosokumo::CellBlock:
Inheritance graph
[legend]
Collaboration diagram for Yosokumo::CellBlock:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CellBlock ()
 Initializes a newly created CellBlock object with default attributes.
 CellBlock (std::string id)
 Initializes a newly created CellBlock object with a study identifier.
 CellBlock (std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end)
 Initializes a newly created CellBlock object with the cell vector specified by the input parameters.
 CellBlock (std::list< Cell >::iterator begin, std::list< Cell >::iterator end)
 Initializes a newly created CellBlock object with the cell list specified by the input parameters.
 CellBlock (std::string id, std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end)
 Initializes a newly created CellBlock object with the study identifier and the cell vector specified by the input parameters.
 CellBlock (std::string id, std::list< Cell >::iterator begin, std::list< Cell >::iterator end)
 Initializes a newly created CellBlock object with the study identifier and the cell list specified by the input parameters.
virtual ~CellBlock ()
 Destructor.
void addCell (const Cell &cell)
 Add a Cell to the block.
bool addCells (std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end)
 Add a collection of Cells to the block.
bool addCells (std::list< Cell >::iterator begin, std::list< Cell >::iterator end)
 Add a collection of Cells to the block.
bool removeCells (uint64_t numCellsToRemove)
 Remove cells from the end of the block.
Cell getCell (uint64_t index) const
 Return a cell from the block.
void clearCells ()
 Remove all cells from the block.
uint64_t size () const
 Return the number of cells in the block.
bool isEmpty () const
 Return true if the block contains no cells.
virtual std::string toString ()
 Return a string representation of this CellBlock.

Private Member Functions

 CellBlock (const CellBlock &rhs)
 Copy constructor - NOT IMPLEMENTED.
CellBlockoperator= (const CellBlock &rhs)
 Assignment operator - NOT IMPLEMENTED.

Detailed Description

Represents a block of Cells.

Definition at line 20 of file CellBlock.h.


Constructor & Destructor Documentation

CellBlock::CellBlock (  ) 

Initializes a newly created CellBlock object with default attributes.

Definition at line 9 of file CellBlock.cpp.

References Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::CellBlock ( std::string  id  ) 

Initializes a newly created CellBlock object with a study identifier.

Parameters:
id a study identifier for the block.

Definition at line 14 of file CellBlock.cpp.

References Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::CellBlock ( std::vector< Cell >::iterator  begin,
std::vector< Cell >::iterator  end 
)

Initializes a newly created CellBlock object with the cell vector specified by the input parameters.

Parameters:
begin an iterator specifying the beginning of the cell vector.
end an iterator specifying the end of the cell vector.

Definition at line 19 of file CellBlock.cpp.

References addCells(), Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::CellBlock ( std::list< Cell >::iterator  begin,
std::list< Cell >::iterator  end 
)

Initializes a newly created CellBlock object with the cell list specified by the input parameters.

Parameters:
begin an iterator specifying the beginning of the cell list.
end an iterator specifying the end of the cell list.

Definition at line 27 of file CellBlock.cpp.

References addCells(), Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::CellBlock ( std::string  id,
std::vector< Cell >::iterator  begin,
std::vector< Cell >::iterator  end 
)

Initializes a newly created CellBlock object with the study identifier and the cell vector specified by the input parameters.

Parameters:
id a study identifier for the block.
begin an iterator specifying the beginning of the cell vector.
end an iterator specifying the end of the cell vector.

Definition at line 35 of file CellBlock.cpp.

References addCells(), Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::CellBlock ( std::string  id,
std::list< Cell >::iterator  begin,
std::list< Cell >::iterator  end 
)

Initializes a newly created CellBlock object with the study identifier and the cell list specified by the input parameters.

Parameters:
id a study identifier for the block.
begin an iterator specifying the beginning of the cell list.
end an iterator specifying the end of the cell list.

Definition at line 44 of file CellBlock.cpp.

References addCells(), Yosokumo::Block::CELL, and Yosokumo::Block::setType().

CellBlock::~CellBlock (  )  [virtual]

Destructor.

Definition at line 53 of file CellBlock.cpp.

Yosokumo::CellBlock::CellBlock ( const CellBlock rhs  )  [private]

Copy constructor - NOT IMPLEMENTED.


Member Function Documentation

void CellBlock::addCell ( const Cell cell  ) 

Add a Cell to the block.

The cell parameter is appended to the end of the cell sequence.

Parameters:
cell the Cell to add to the block.

Definition at line 59 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by Yosokumo::YosokumoProtobuf::makeBlockFromProtobufBlock().

bool CellBlock::addCells ( std::list< Cell >::iterator  begin,
std::list< Cell >::iterator  end 
)

Add a collection of Cells to the block.

The Cells in the list specified by the parameters are appended to the end of the cell sequence.

Parameters:
begin an iterator specifying the beginning of the cell list to add to the block.
end an iterator specifying the end of the cell list to add to the block.
Returns:
true if and only if the cell sequence changes.

Definition at line 73 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

bool CellBlock::addCells ( std::vector< Cell >::iterator  begin,
std::vector< Cell >::iterator  end 
)

Add a collection of Cells to the block.

The Cells in the vector specified by the parameters are appended to the end of the cell sequence.

Parameters:
begin an iterator specifying the beginning of the cell vector to add to the block.
end an iterator specifying the end of the cell vector to add to the block.
Returns:
true if and only if the cell sequence changes.

Definition at line 64 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by CellBlock().

void CellBlock::clearCells (  ) 

Remove all cells from the block.

After a call of this method, the sequence is empty, i.e., it contains no cells.

Definition at line 104 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by removeCells().

Cell CellBlock::getCell ( uint64_t  index  )  const

Return a cell from the block.

This makes it possible to iterate over all cells in the sequence like this:

   for (uint64_t i = 0;  i < cellSequence.size();  ++i)
   {
       Cell c = cellSequence.getCell(i)
       process cell c
   }
 
Parameters:
index specifying the cell of the 0-based block.
Returns:
the Cell at the location specified by the index.

Definition at line 98 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by toString().

bool CellBlock::isEmpty (  )  const

Return true if the block contains no cells.

Returns:
true if the block contains no cells. false otherwise.

Definition at line 114 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by removeCells().

CellBlock& Yosokumo::CellBlock::operator= ( const CellBlock rhs  )  [private]

Assignment operator - NOT IMPLEMENTED.

bool CellBlock::removeCells ( uint64_t  numCellsToRemove  ) 

Remove cells from the end of the block.

The specified number of cells are removed from the end of the cell sequence.

Parameters:
numCellsToRemove is the number of cells to remove from the end of the block. If this value is zero no cells are removed. If this value exceeds the number of cells in the block, then all cells are removed.
Returns:
true if and only if the sequence is changed.

Definition at line 82 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence, clearCells(), isEmpty(), and size().

uint64_t CellBlock::size (  )  const

Return the number of cells in the block.

Returns:
the number of cells in the block.

Definition at line 109 of file CellBlock.cpp.

References Yosokumo::Block::cellSequence.

Referenced by removeCells(), and toString().

std::string CellBlock::toString (  )  [virtual]

Return a string representation of this CellBlock.

Returns:
the string representation of this CellBlock.

Reimplemented from Yosokumo::Block.

Definition at line 120 of file CellBlock.cpp.

References getCell(), Yosokumo::Block::getStudyIdentifier(), Yosokumo::Block::getType(), size(), and Yosokumo::Cell::toString().

Referenced by operator<<().


The documentation for this class was generated from the following files:
Generated on Mon May 13 09:19:11 2013 for C++ Yosokumo API by  doxygen 1.6.3