Brief description of class still missing. More...
#include <MiniSeedRecords.h>
Public Member Functions | |
void | add (off_t pos, quint32 byteLength) |
virtual MetaData * | clone () const |
virtual const MetaData * | defaultValue () const |
virtual bool | fromString (const QString &, QString string) |
virtual int | id () const |
MiniSeedRecords () | |
MiniSeedRecords (const MiniSeedRecords &o) | |
bool | record (int sequenceIndex, int recordIndex, off_t &pos, quint32 &byteLength) const |
int | recordCount (int sequenceIndex) const |
int | sequenceCount () const |
virtual void | setId (int id) const |
virtual bool | storeAsXML () const |
virtual const QString & | xml_tagName () const |
Static Public Member Functions | |
static int | staticId () |
Static Public Attributes | |
static const QString | xmlMiniSeedRecordsTag = "MiniSeedRecords" |
Protected Member Functions | |
virtual XMLMember | xml_member (XML_MEMBER_ARGS) |
virtual bool | xml_setProperty (XML_SETPROPERTY_ARGS) |
virtual void | xml_writeChildren (XML_WRITECHILDREN_ARGS) const |
Brief description of class still missing.
A compact storage for Mini Seed records.
The storage is built with add() in MiniSeedTrace::records().
The order of calls to add() must follow the chronology of the signal samples.
GeopsyCore::MiniSeedRecords::MiniSeedRecords | ( | ) | [inline] |
Referenced by clone().
{}
GeopsyCore::MiniSeedRecords::MiniSeedRecords | ( | const MiniSeedRecords & | o | ) | [inline] |
: MetaData(o), _records(o._records) {}
void GeopsyCore::MiniSeedRecords::add | ( | off_t | pos, |
quint32 | byteLength | ||
) |
References GeopsyCore::MiniSeedSequence::setByteLength(), and GeopsyCore::MiniSeedSequence::setFirstPos().
Referenced by fromString(), and GeopsyCore::MiniSeedTrace::records().
{
if(_records.isEmpty() ||
!_records.last().add(pos, byteLength)) {
_records.resize(_records.size()+1);
MiniSeedSequence& r=_records.last();
r.setFirstPos(pos);
r.setByteLength(byteLength);
}
}
virtual MetaData* GeopsyCore::MiniSeedRecords::clone | ( | ) | const [inline, virtual] |
virtual const MetaData* GeopsyCore::MiniSeedRecords::defaultValue | ( | ) | const [inline, virtual] |
Implements GeopsyCore::MetaData.
{return &_defaultValue;}
bool GeopsyCore::MiniSeedRecords::fromString | ( | const QString & | , |
QString | string | ||
) | [virtual] |
Kept for compatibility with past releases
Reimplemented from GeopsyCore::MetaData.
References add(), QGpCoreTools::StringSection::isValid(), QGpCoreTools::StringSection::nextField(), QGpCoreTools::StringSection::toInt(), and TRACE.
Referenced by xml_setProperty().
{ TRACE; _records.clear(); StringSection valSection(string); StringSection field; const QChar * ptr=0; off_t pos; quint32 byteLength; while(true) { field=valSection.nextField(ptr, "," ); if(!field.isValid()) return false; pos=field.toInt(); field=valSection.nextField(ptr, "," ); if(!field.isValid()) return false; byteLength=field.toInt(); add(pos, byteLength); } return true; }
virtual int GeopsyCore::MiniSeedRecords::id | ( | ) | const [inline, virtual] |
bool GeopsyCore::MiniSeedRecords::record | ( | int | sequenceIndex, |
int | recordIndex, | ||
off_t & | pos, | ||
quint32 & | byteLength | ||
) | const |
References GeopsyCore::MiniSeedSequence::byteLength(), GeopsyCore::MiniSeedSequence::count(), and GeopsyCore::MiniSeedSequence::pos().
Referenced by GeopsyCore::MiniSeedReader::lastPos(), and GeopsyCore::MiniSeedReader::nextRecord().
{ const MiniSeedSequence& r=_records.at(sequenceIndex); if(recordIndex<r.count()) { pos=r.pos(recordIndex); byteLength=r.byteLength(); return true; } else { return false; } }
int GeopsyCore::MiniSeedRecords::recordCount | ( | int | sequenceIndex | ) | const [inline] |
Referenced by GeopsyCore::MiniSeedReader::atEnd().
{return _records.at(sequenceIndex).count();}
int GeopsyCore::MiniSeedRecords::sequenceCount | ( | ) | const [inline] |
Referenced by GeopsyCore::MiniSeedReader::atEnd(), and GeopsyCore::MiniSeedReader::nextRecord().
{return _records.count();}
virtual void GeopsyCore::MiniSeedRecords::setId | ( | int | id | ) | const [inline, virtual] |
static int GeopsyCore::MiniSeedRecords::staticId | ( | ) | [inline, static] |
Referenced by GeopsyCore::Signal::miniSeedRecords(), and GeopsyCore::Signal::setMiniSeedRecords().
{return _id;}
virtual bool GeopsyCore::MiniSeedRecords::storeAsXML | ( | ) | const [inline, virtual] |
Reimplemented from GeopsyCore::MetaData.
{return true;}
XMLMember GeopsyCore::MiniSeedRecords::xml_member | ( | XML_MEMBER_ARGS | ) | [protected, virtual] |
Re-implement this function to offer XML restore (children and properties) support to your class.
From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:
Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):
static const QString tmp("childrenName"); XMLRestoreAttributeIterator it=map.find(tmp); if(it!=map.end()) { // found attribute "childrenName" }
If the map of attributes is not used:
Q_UNUSED(attributes); if(tag=="x1") return XMLMember(0); else if(tag=="y1") return XMLMember(1); else if(tag=="x2") return XMLMember(2); else if(tag=="y2") return XMLMember(3); else return XMLMember(XMLMember::Unknown);
Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.
if(tag=="anInteger") return XMLMember(0); else if(tag=="aString") return XMLMember(1); else if(tag=="aDouble") return XMLMember(2); return AbstractLine::xml_member(tag, attributes, context)+3;
For the arguments of this function use Macro XML_MEMBER_ARGS.
Reimplemented from QGpCoreTools::XMLClass.
References TRACE, and GeopsyCore::MiniSeedSequence::xmlMiniSeedSequenceTag.
{ TRACE; Q_UNUSED(attributes); Q_UNUSED(context); if(tag==MiniSeedSequence::xmlMiniSeedSequenceTag) { _records.append(MiniSeedSequence()); return XMLMember(&_records.last()); } else return XMLMember(this, false); // Kept for compatibility, setProperty() will be called }
bool GeopsyCore::MiniSeedRecords::xml_setProperty | ( | XML_SETPROPERTY_ARGS | ) | [protected, virtual] |
Kept for compatibility with past releases
Reimplemented from QGpCoreTools::XMLClass.
References fromString(), and TRACE.
{ TRACE; Q_UNUSED(memberID); Q_UNUSED(tag); Q_UNUSED(attributes); Q_UNUSED(context); return fromString(0, content.toString()); }
virtual const QString& GeopsyCore::MiniSeedRecords::xml_tagName | ( | ) | const [inline, virtual] |
Implements QGpCoreTools::XMLClass.
References xmlMiniSeedRecordsTag.
{return xmlMiniSeedRecordsTag;}
void GeopsyCore::MiniSeedRecords::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
Reimplemented from QGpCoreTools::XMLClass.
References TRACE, QGpCoreTools::XMLClass::writeProperty(), and GeopsyCore::MiniSeedSequence::xmlMiniSeedSequenceTag.
{ TRACE; for(QVector<MiniSeedSequence>::const_iterator it=_records.begin(); it!=_records.end(); it++ ) { XMLSaveAttributes attributes; it->xml_attributes(attributes, context); writeProperty(s, MiniSeedSequence::xmlMiniSeedSequenceTag, attributes); } }
const QString GeopsyCore::MiniSeedRecords::xmlMiniSeedRecordsTag = "MiniSeedRecords" [static] |
Referenced by xml_tagName().