A block of Specimen*
.
More...
#include <SpecimenBlock.h>
Public Member Functions | |
SpecimenBlock () | |
Initializes a newly created SpecimenBlock object with default attributes. | |
SpecimenBlock (std::string id) | |
Initializes a newly created SpecimenBlock object with a study identifier. | |
SpecimenBlock (std::vector< Specimen >::iterator begin, std::vector< Specimen >::iterator end) | |
Initializes a newly created SpecimenBlock object with the Specimen vector specified by the input parameters. | |
SpecimenBlock (std::list< Specimen >::iterator begin, std::list< Specimen >::iterator end) | |
Initializes a newly created SpecimenBlock object with the Specimen list specified by the input parameters. | |
SpecimenBlock (std::string id, std::vector< Specimen >::iterator begin, std::vector< Specimen >::iterator end) | |
Initializes a newly created SpecimenBlock object with the study identifier and the Specimen vector specified by the input parameters. | |
SpecimenBlock (std::string id, std::list< Specimen >::iterator begin, std::list< Specimen >::iterator end) | |
Initializes a newly created SpecimenBlock object with the study identifier and the Specimen list specified by the input parameters. | |
virtual | ~SpecimenBlock () |
Destructor. | |
void | addSpecimen (Specimen *specimen) |
Add a Specimen* to the block. | |
bool | addSpecimens (std::vector< Specimen >::iterator begin, std::vector< Specimen >::iterator end) |
Add a collection of Specimen to the block. | |
bool | addSpecimens (std::list< Specimen >::iterator begin, std::list< Specimen >::iterator end) |
Add a collection of Specimen to the block. | |
bool | removeSpecimens (uint64_t numSpecimensToRemove) |
Remove Specimen* from the end of the block. | |
Specimen * | getSpecimen (uint64_t index) const |
Return a Specimen* from the block. | |
void | clearSpecimens () |
Remove all Specimen* from the block. | |
uint64_t | size () const |
Return the number of specimens in the block. | |
bool | isEmpty () const |
Return true if the block contains no specimens. | |
virtual std::string | toString () |
Return a string representation of this SpecimenBlock . | |
Private Member Functions | |
SpecimenBlock (const SpecimenBlock &rhs) | |
Copy constructor - NOT IMPLEMENTED. | |
SpecimenBlock & | operator= (const SpecimenBlock &rhs) |
Assignment operator - NOT IMPLEMENTED. |
A block of Specimen*
.
Note that a SpecimenBlock
does not own the Specimens
pointed to by the elements of the SpecimenBlock
. This class never constructs or destroys a Specimen
.
Definition at line 23 of file SpecimenBlock.h.
SpecimenBlock::SpecimenBlock | ( | ) |
Initializes a newly created SpecimenBlock
object with default attributes.
Definition at line 9 of file SpecimenBlock.cpp.
References Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::SpecimenBlock | ( | std::string | id | ) |
Initializes a newly created SpecimenBlock
object with a study identifier.
id | a study identifier for the block. |
Definition at line 14 of file SpecimenBlock.cpp.
References Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::SpecimenBlock | ( | std::vector< Specimen >::iterator | begin, | |
std::vector< Specimen >::iterator | end | |||
) |
Initializes a newly created SpecimenBlock
object with the Specimen vector specified by the input parameters.
Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
begin | an iterator specifying the beginning of the Specimen vector. | |
end | an iterator specifying the end of the Specimen vector. |
Definition at line 19 of file SpecimenBlock.cpp.
References addSpecimens(), Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::SpecimenBlock | ( | std::list< Specimen >::iterator | begin, | |
std::list< Specimen >::iterator | end | |||
) |
Initializes a newly created SpecimenBlock
object with the Specimen list specified by the input parameters.
Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
begin | an iterator specifying the beginning of the Specimen list. | |
end | an iterator specifying the end of the Specimen list. |
Definition at line 27 of file SpecimenBlock.cpp.
References addSpecimens(), Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::SpecimenBlock | ( | std::string | id, | |
std::vector< Specimen >::iterator | begin, | |||
std::vector< Specimen >::iterator | end | |||
) |
Initializes a newly created SpecimenBlock
object with the study identifier and the Specimen vector specified by the input parameters.
Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
id | a study identifier for the block. | |
begin | an iterator specifying the beginning of the Specimen vector. | |
end | an iterator specifying the end of the Specimen vector. |
Definition at line 35 of file SpecimenBlock.cpp.
References addSpecimens(), Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::SpecimenBlock | ( | std::string | id, | |
std::list< Specimen >::iterator | begin, | |||
std::list< Specimen >::iterator | end | |||
) |
Initializes a newly created SpecimenBlock
object with the study identifier and the Specimen list specified by the input parameters.
Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
id | a study identifier for the block. | |
begin | an iterator specifying the beginning of the Specimen list. | |
end | an iterator specifying the end of the Specimen list. |
Definition at line 44 of file SpecimenBlock.cpp.
References addSpecimens(), Yosokumo::Block::setType(), and Yosokumo::Block::SPECIMEN.
SpecimenBlock::~SpecimenBlock | ( | ) | [virtual] |
Destructor.
Definition at line 53 of file SpecimenBlock.cpp.
Yosokumo::SpecimenBlock::SpecimenBlock | ( | const SpecimenBlock & | rhs | ) | [private] |
Copy constructor - NOT IMPLEMENTED.
void SpecimenBlock::addSpecimen | ( | Specimen * | specimen | ) |
Add a Specimen*
to the block.
The Specimen* parameter is appended to the end of the Specimen* sequence.
specimen | the Specimen* to add to the block. |
Definition at line 59 of file SpecimenBlock.cpp.
References Yosokumo::Block::specimenSequence.
Referenced by addSpecimens().
bool SpecimenBlock::addSpecimens | ( | std::list< Specimen >::iterator | begin, | |
std::list< Specimen >::iterator | end | |||
) |
Add a collection of Specimen
to the block.
The Specimen
in the list specified by the parameter are appended to the end of the Specimen* sequence. Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
begin | an iterator specifying the beginning of the Specimen list to add to the block. | |
end | an iterator specifying the end of the Specimen list to add to the block. |
Definition at line 79 of file SpecimenBlock.cpp.
References addSpecimen().
bool SpecimenBlock::addSpecimens | ( | std::vector< Specimen >::iterator | begin, | |
std::vector< Specimen >::iterator | end | |||
) |
Add a collection of Specimen
to the block.
The Specimen
in the vector specified by the parameters are appended to the end of the Specimen* sequence. Note that the Specimens *must* not be deleted while the SpecimenBlock exists.
begin | an iterator specifying the beginning of the Specimen vector to add to the block. | |
end | an iterator specifying the end of the Specimen vector to add to the block. |
Definition at line 64 of file SpecimenBlock.cpp.
References addSpecimen().
Referenced by SpecimenBlock().
void SpecimenBlock::clearSpecimens | ( | ) |
Remove all Specimen* from the block.
After a call of this method, the sequence is empty, i.e., it contains no specimens.
Definition at line 115 of file SpecimenBlock.cpp.
References Yosokumo::Block::specimenSequence.
Referenced by removeSpecimens().
Specimen * SpecimenBlock::getSpecimen | ( | uint64_t | index | ) | const |
Return a Specimen* from the block.
This makes it possible to iterate over all specimens in the sequence like this:
for (int i = 0; i < specimenBlock.size(); ++i) { Specimen *c = specimenBlock.getSpecimen(i) process specimen *c }
index | specifying the Specimen* of the 0-based block. |
Specimen*
at the location specified by the index. Definition at line 109 of file SpecimenBlock.cpp.
References Yosokumo::Block::specimenSequence.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufBlockFromBlock(), and toString().
bool SpecimenBlock::isEmpty | ( | ) | const |
Return true
if the block contains no specimens.
true
if the block contains no specimens. false
otherwise. Definition at line 125 of file SpecimenBlock.cpp.
References Yosokumo::Block::specimenSequence.
Referenced by removeSpecimens().
SpecimenBlock& Yosokumo::SpecimenBlock::operator= | ( | const SpecimenBlock & | rhs | ) | [private] |
Assignment operator - NOT IMPLEMENTED.
bool SpecimenBlock::removeSpecimens | ( | uint64_t | numSpecimensToRemove | ) |
Remove Specimen* from the end of the block.
The specified number of specimens are removed from the end of the Specimen* sequence.
numSpecimensToRemove | is the number of specimens to remove from the end of the block. If this value is zero, no specimens are removed. If this value exceeds the number of specimens in the block, then all specimens are removed. |
Definition at line 94 of file SpecimenBlock.cpp.
References clearSpecimens(), isEmpty(), size(), and Yosokumo::Block::specimenSequence.
uint64_t SpecimenBlock::size | ( | ) | const |
Return the number of specimens in the block.
Definition at line 120 of file SpecimenBlock.cpp.
References Yosokumo::Block::specimenSequence.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufBlockFromBlock(), removeSpecimens(), and toString().
std::string SpecimenBlock::toString | ( | ) | [virtual] |
Return a string representation of this SpecimenBlock
.
SpecimenBlock
. Reimplemented from Yosokumo::Block.
Definition at line 133 of file SpecimenBlock.cpp.
References getSpecimen(), Yosokumo::Block::getStudyIdentifier(), Yosokumo::Block::getType(), size(), and Yosokumo::Specimen::toString().
Referenced by operator<<().