All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions
GeopsyCore::MiniSeedRecords Class Reference

Brief description of class still missing. More...

#include <MiniSeedRecords.h>

Inheritance diagram for GeopsyCore::MiniSeedRecords:
GeopsyCore::MetaData QGpCoreTools::XMLClass QGpCoreTools::SharedObject

List of all members.

Public Member Functions

void add (off_t pos, quint32 byteLength)
virtual MetaDataclone () const
virtual const MetaDatadefaultValue () 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

Detailed Description

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.


Constructor & Destructor Documentation

Referenced by clone().

{}
: MetaData(o), _records(o._records) {}

Member Function Documentation

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]

Implements GeopsyCore::MetaData.

References MiniSeedRecords().

{return new MiniSeedRecords(*this);}
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]

Implements GeopsyCore::MetaData.

Referenced by setId().

{return _id;}
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();}

Referenced by GeopsyCore::MiniSeedReader::atEnd(), and GeopsyCore::MiniSeedReader::nextRecord().

{return _records.count();}
virtual void GeopsyCore::MiniSeedRecords::setId ( int  id) const [inline, virtual]

Implements GeopsyCore::MetaData.

References id().

{_id=id;}
static int GeopsyCore::MiniSeedRecords::staticId ( ) [inline, static]
virtual bool GeopsyCore::MiniSeedRecords::storeAsXML ( ) const [inline, virtual]

Reimplemented from GeopsyCore::MetaData.

{return true;}

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:

  • An integer: id number of a property
  • A XMLClass * : a child of this object identified by tag
  • Default constructor: error, unknow child or property

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
  }

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]

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);
    }
  }

Member Data Documentation

const QString GeopsyCore::MiniSeedRecords::xmlMiniSeedRecordsTag = "MiniSeedRecords" [static]

Referenced by xml_tagName().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines