ProteoWizard
Public Member Functions | Private Attributes
pwiz::tradata::TextWriter Class Reference

#include <TextWriter.hpp>

List of all members.

Public Member Functions

 TextWriter (std::ostream &os, int depth=0)
TextWriter child ()
TextWriteroperator() (const std::string &text)
TextWriteroperator() (const CVParam &cvParam)
TextWriteroperator() (const UserParam &userParam)
template<typename object_type >
TextWriteroperator() (const std::string &label, const std::vector< object_type > &v)
template<typename object_type >
TextWriteroperator() (const std::string &label, const object_type &v)
TextWriteroperator() (const TraData &msd)
TextWriteroperator() (const CV &cv)
TextWriteroperator() (const ParamContainer &paramContainer)
TextWriteroperator() (const Publication &publication)
TextWriteroperator() (const Software &software)
TextWriteroperator() (const Contact &contact)
TextWriteroperator() (const RetentionTime &retentionTime)
TextWriteroperator() (const Prediction &prediction)
TextWriteroperator() (const Evidence &evidence)
TextWriteroperator() (const Validation &validation)
TextWriteroperator() (const Protein &protein)
TextWriteroperator() (const Modification &modification)
TextWriteroperator() (const Peptide &peptide)
TextWriteroperator() (const Compound &compound)
TextWriteroperator() (const Precursor &precursor)
TextWriteroperator() (const Product &product)
TextWriteroperator() (const Transition &transition)
TextWriteroperator() (const Target &target)
TextWriteroperator() (const TargetList &targetList)
template<typename object_type >
TextWriteroperator() (const boost::shared_ptr< object_type > &p)

Private Attributes

std::ostream & os_
int depth_
std::string indent_

Detailed Description

Definition at line 43 of file TextWriter.hpp.


Constructor & Destructor Documentation

pwiz::tradata::TextWriter::TextWriter ( std::ostream &  os,
int  depth = 0 
)
inline

Definition at line 47 of file TextWriter.hpp.

: os_(os), depth_(depth), indent_(depth*2, ' ')
{}

Member Function Documentation

TextWriter pwiz::tradata::TextWriter::child ( )
inline

Definition at line 51 of file TextWriter.hpp.

References os_.

{return TextWriter(os_, depth_+1);}
TextWriter& pwiz::tradata::TextWriter::operator() ( const std::string &  text)
inline

Definition at line 53 of file TextWriter.hpp.

References os_.

{
os_ << indent_ << text << std::endl;
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const CVParam cvParam)
inline

Definition at line 59 of file TextWriter.hpp.

References pwiz::data::CVParam::cvid, CVID_Unknown, pwiz::cv::cvTermInfo(), pwiz::cv::CVTermInfo::name, os_, pwiz::data::CVParam::units, pwiz::data::CVParam::unitsName(), and pwiz::data::CVParam::value.

{
os_ << indent_ << "cvParam: " << cvTermInfo(cvParam.cvid).name;
if (!cvParam.value.empty())
os_ << ", " << cvParam.value;
if (cvParam.units != CVID_Unknown)
os_ << ", " << cvParam.unitsName();
os_ << std::endl;
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const UserParam userParam)
inline

Definition at line 70 of file TextWriter.hpp.

References CVID_Unknown, pwiz::cv::cvTermInfo(), pwiz::data::UserParam::name, pwiz::cv::CVTermInfo::name, os_, pwiz::data::UserParam::type, pwiz::data::UserParam::units, and pwiz::data::UserParam::value.

{
os_ << indent_ << "userParam: " << userParam.name;
if (!userParam.value.empty()) os_ << ", " << userParam.value;
if (!userParam.type.empty()) os_ << ", " << userParam.type;
if (userParam.units != CVID_Unknown) os_ << ", " << cvTermInfo(userParam.units).name;
os_ << std::endl;
return *this;
}
template<typename object_type >
TextWriter& pwiz::tradata::TextWriter::operator() ( const std::string &  label,
const std::vector< object_type > &  v 
)
inline

Definition at line 81 of file TextWriter.hpp.

{
(*this)(label);
for_each(v.begin(), v.end(), child());
return *this;
}
template<typename object_type >
TextWriter& pwiz::tradata::TextWriter::operator() ( const std::string &  label,
const object_type &  v 
)
inline

Definition at line 89 of file TextWriter.hpp.

{
(*this)(label)(boost::lexical_cast<std::string>(v));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const TraData msd)
inline

Definition at line 96 of file TextWriter.hpp.

References pwiz::tradata::TraData::compoundPtrs, pwiz::tradata::TraData::contactPtrs, pwiz::tradata::TraData::cvs, pwiz::tradata::TargetList::empty(), pwiz::tradata::TraData::instrumentPtrs, pwiz::tradata::TraData::peptidePtrs, pwiz::tradata::TraData::proteinPtrs, pwiz::tradata::TraData::publications, pwiz::tradata::TraData::softwarePtrs, pwiz::tradata::TraData::targets, pwiz::tradata::TraData::transitions, and pwiz::tradata::TraData::version().

{
(*this)("tradata:");
child()("version: " + msd.version());
if (!msd.cvs.empty())
child()("cvList: ", msd.cvs);
if (!msd.contactPtrs.empty())
child()("contactList: ", msd.contactPtrs);
if (!msd.publications.empty())
child()("publicationList: ", msd.publications);
if (!msd.instrumentPtrs.empty())
child()("instrumentList: ", msd.instrumentPtrs);
if (!msd.softwarePtrs.empty())
child()("softwareList: ", msd.softwarePtrs);
if (!msd.proteinPtrs.empty())
child()("proteinList: ", msd.proteinPtrs);
if (!msd.peptidePtrs.empty())
child()("peptideList: ", msd.peptidePtrs);
if (!msd.compoundPtrs.empty())
child()("compoundList: ", msd.compoundPtrs);
if (!msd.transitions.empty())
child()("transitionList: ", msd.transitions);
if (!msd.targets.empty())
child()(msd.targets);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const CV cv)
inline

Definition at line 124 of file TextWriter.hpp.

References pwiz::cv::CV::fullName, pwiz::cv::CV::id, pwiz::cv::CV::URI, and pwiz::cv::CV::version.

{
(*this)("cv:");
("id: " + cv.id)
("fullName: " + cv.fullName)
("version: " + cv.version)
("URI: " + cv.URI);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const ParamContainer paramContainer)
inline

Definition at line 135 of file TextWriter.hpp.

References pwiz::data::ParamContainer::cvParams, and pwiz::data::ParamContainer::userParams.

{
for_each(paramContainer.cvParams.begin(), paramContainer.cvParams.end(), *this);
for_each(paramContainer.userParams.begin(), paramContainer.userParams.end(), *this);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Publication publication)
inline

Definition at line 142 of file TextWriter.hpp.

References pwiz::tradata::Publication::id.

{
(*this)("publication:");
("id: " + publication.id)
(static_cast<const ParamContainer&>(publication));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Software software)
inline

Definition at line 151 of file TextWriter.hpp.

References pwiz::tradata::Software::id, and pwiz::tradata::Software::version.

{
(*this)("software:");
("id: " + software.id)
("version: " + software.version)
(static_cast<const ParamContainer&>(software));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Contact contact)
inline

Definition at line 161 of file TextWriter.hpp.

{
(*this)("contact:");
child()(static_cast<const ParamContainer&>(contact));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const RetentionTime retentionTime)
inline

Definition at line 168 of file TextWriter.hpp.

References pwiz::tradata::RetentionTime::softwarePtr.

{
(*this)("retentionTime:");
child()(static_cast<const ParamContainer&>(retentionTime));
if (retentionTime.softwarePtr.get() &&
!retentionTime.softwarePtr->empty())
child()("softwareRef: " + retentionTime.softwarePtr->id);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Prediction prediction)
inline

Definition at line 178 of file TextWriter.hpp.

{
(*this)("prediction:");
child()(static_cast<const ParamContainer&>(prediction));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Evidence evidence)
inline

Definition at line 185 of file TextWriter.hpp.

{
(*this)("evidence:");
child()(static_cast<const ParamContainer&>(evidence));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Validation validation)
inline

Definition at line 192 of file TextWriter.hpp.

{
(*this)("validation:");
child()(static_cast<const ParamContainer&>(validation));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Protein protein)
inline

Definition at line 199 of file TextWriter.hpp.

References pwiz::proteome::Protein::id, and pwiz::proteome::Peptide::sequence().

{
(*this)("protein:");
child()("id: " + protein.id)
("sequence: " + protein.sequence);
child()(static_cast<const ParamContainer&>(protein));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Modification modification)
inline

Definition at line 208 of file TextWriter.hpp.

References boost::lexical_cast(), and pwiz::data::unimod::modification().

{
(*this)("modification:");
child()("location: ", lexical_cast<string>(modification.location))
("monoisotopicMassDelta: " + lexical_cast<string>(modification.monoisotopicMassDelta))
("averageMassDelta: " + lexical_cast<string>(modification.averageMassDelta));
child()(static_cast<const ParamContainer&>(modification));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Peptide peptide)
inline

Definition at line 218 of file TextWriter.hpp.

References pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::empty(), pwiz::proteome::Peptide::modifications(), pwiz::identdata::peptide(), and pwiz::proteome::Peptide::sequence().

{
(*this)("peptide:");
child()("id: " + peptide.id)
("sequence: " + peptide.sequence)
(peptide.evidence);
if (!peptide.proteinPtrs.empty())
child()("proteinRefs:", peptide.proteinPtrs);
child()("modifications:", peptide.modifications);
if (!peptide.retentionTimes.empty())
child()("retentionTimes:", peptide.retentionTimes);
child()(static_cast<const ParamContainer&>(peptide));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Compound compound)
inline

Definition at line 236 of file TextWriter.hpp.

References pwiz::tradata::Compound::id, and pwiz::tradata::Compound::retentionTimes.

{
(*this)("compound:");
child()("id: " + compound.id)
("retentionTimes:", compound.retentionTimes);
child()(static_cast<const ParamContainer&>(compound));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Precursor precursor)
inline

Definition at line 245 of file TextWriter.hpp.

{
(*this)("precursor:");
child()(static_cast<const ParamContainer&>(precursor));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Product product)
inline

Definition at line 252 of file TextWriter.hpp.

{
(*this)("product:");
child()(static_cast<const ParamContainer&>(product));
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Transition transition)
inline

Definition at line 259 of file TextWriter.hpp.

References pwiz::tradata::Transition::compoundPtr, pwiz::tradata::Transition::configurationList, pwiz::tradata::Prediction::empty(), pwiz::tradata::Precursor::empty(), pwiz::tradata::Product::empty(), pwiz::tradata::Transition::id, pwiz::tradata::Transition::interpretationList, pwiz::tradata::Transition::peptidePtr, pwiz::tradata::Transition::precursor, pwiz::tradata::Transition::prediction, and pwiz::tradata::Transition::product.

{
(*this)("transition:");
child()("id: ", transition.id);
if (!transition.precursor.empty())
child()(transition.precursor);
if (!transition.product.empty())
child()(transition.product);
if (!transition.prediction.empty())
child()(transition.prediction);
if (!transition.interpretationList.empty())
child()("interpretationList: ", transition.interpretationList);
if (!transition.configurationList.empty())
child()("configurationList: ", transition.configurationList);
if (transition.peptidePtr.get() && !transition.peptidePtr->empty())
child()("peptideRef: " + transition.peptidePtr->id);
if (transition.compoundPtr.get() && !transition.compoundPtr->empty())
child()("compoundRef: " + transition.compoundPtr->id);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const Target target)
inline

Definition at line 280 of file TextWriter.hpp.

References pwiz::tradata::Target::compoundPtr, pwiz::tradata::Target::configurationList, pwiz::tradata::Precursor::empty(), pwiz::tradata::Target::id, pwiz::tradata::Target::peptidePtr, and pwiz::tradata::Target::precursor.

{
(*this)("target:");
child()("id: ", target.id);
if (!target.precursor.empty())
child()(target.precursor);
if (!target.configurationList.empty())
child()("configurationList: ", target.configurationList);
if (target.peptidePtr.get() && !target.peptidePtr->empty())
child()("peptideRef: " + target.peptidePtr->id);
if (target.compoundPtr.get() && !target.compoundPtr->empty())
child()("compoundRef: " + target.compoundPtr->id);
return *this;
}
TextWriter& pwiz::tradata::TextWriter::operator() ( const TargetList targetList)
inline

Definition at line 295 of file TextWriter.hpp.

References pwiz::tradata::TargetList::targetExcludeList, and pwiz::tradata::TargetList::targetIncludeList.

{
(*this)("targetList:");
child()(static_cast<const ParamContainer&>(targetList));
if (!targetList.targetExcludeList.empty())
child()("targetExcludeList: ", targetList.targetExcludeList);
if (!targetList.targetIncludeList.empty())
child()("targetIncludeList: ", targetList.targetIncludeList);
return *this;
}
template<typename object_type >
TextWriter& pwiz::tradata::TextWriter::operator() ( const boost::shared_ptr< object_type > &  p)
inline

Definition at line 308 of file TextWriter.hpp.

{
return p.get() ? (*this)(*p) : *this;
}

Member Data Documentation

std::ostream& pwiz::tradata::TextWriter::os_
private

Definition at line 314 of file TextWriter.hpp.

int pwiz::tradata::TextWriter::depth_
private

Definition at line 315 of file TextWriter.hpp.

std::string pwiz::tradata::TextWriter::indent_
private

Definition at line 316 of file TextWriter.hpp.


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