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
GeopsySLink::SeedLinkStation Class Reference

Brief description of class still missing. More...

#include <SeedLinkStation.h>

Inheritance diagram for GeopsySLink::SeedLinkStation:
QGpCoreTools::XMLClass

List of all members.

Public Member Functions

void addStream (SeedLinkStream *stream)
SeedLinkStreamat (int index) const
int count () const
QString description () const
QList< int > indexOf (QRegExp streamSelector) const
QString name () const
QString network () const
bool operator< (const SeedLinkStation &o)
void setName (QString n)
void setNetwork (QString n)
bool streamCheck () const
virtual void xml_attributes (XML_ATTRIBUTES_ARGS) const
virtual bool xml_setAttributes (XML_SETATTRIBUTES_ARGS)
virtual const QString & xml_tagName () const
 ~SeedLinkStation ()

Static Public Member Functions

static bool lessThan (SeedLinkStation *s1, SeedLinkStation *s2)
static QRegExp selectorExpression (const QString &streamSelector)

Static Public Attributes

static const QString xmlSeedLinkStationTag = "station"

Protected Member Functions

virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

References TRACE.

{
  TRACE;
  qDeleteAll(*static_cast<QList<SeedLinkStream *> *>(this));
}

Member Function Documentation

Referenced by ConformProcess::start().

{append(stream);}
SeedLinkStream* GeopsySLink::SeedLinkStation::at ( int  index) const [inline]
int GeopsySLink::SeedLinkStation::count ( ) const [inline]
QString GeopsySLink::SeedLinkStation::description ( ) const [inline]

Referenced by GeopsySLinkGui::SeedLinkStreamItem::data().

{return _description;}
QList< int > GeopsySLink::SeedLinkStation::indexOf ( QRegExp  streamSelector) const

streamSelector is a regular expression to match "seedName.type". To convert a stream specification commonly used with seedlink into a regular expression use selectorExpresion().

References at(), count(), GeopsySLink::SeedLinkStream::location(), and GeopsySLink::SeedLinkStream::seedName().

Referenced by GeopsySLinkGui::SeedLinkLoader::selectStreams().

{
  QList<int> indexes;
  for(int i=count()-1; i>=0;i-- ) {
    const SeedLinkStream * s=at(i);
    if(streamSelector.indexIn(s->seedName())!=-1 ||
       streamSelector.indexIn(s->location()+s->seedName())!=-1) {
      indexes.append(i);
    }
  }
  return indexes;
}
static bool GeopsySLink::SeedLinkStation::lessThan ( SeedLinkStation s1,
SeedLinkStation s2 
) [inline, static]

Referenced by GeopsySLink::SeedLinkServer::xml_polish().

{return *s1 < *s2;}
QString GeopsySLink::SeedLinkStation::name ( ) const [inline]
QString GeopsySLink::SeedLinkStation::network ( ) const [inline]
bool GeopsySLink::SeedLinkStation::operator< ( const SeedLinkStation o) [inline]

References TRACE.

{
  TRACE;
  if(_network<o._network) return true;
  else if(_network>o._network) return false;
  else {
    if(_name<o._name) return true;
    else return false;
  }
}
QRegExp GeopsySLink::SeedLinkStation::selectorExpression ( const QString &  streamSelector) [static]

Convert a stream specification commonly used with seedlink into a regular expression.

{
  QString regSelector=streamSelector;
  regSelector.replace(" ", "|");
  regSelector.replace(".", "\\.");
  regSelector.replace(QRegExp("( \\?$|^\\?$|^\\? | \\? )"), "[A-Z]{3}");
  regSelector.replace("?", ".");
  regSelector="("+regSelector+")";
  //App::stream() << QString("Convert stream selector \"%1\" to \"%2\"").arg(streamSelector).arg(regSelector) << endl;
  return QRegExp(regSelector);
}
void GeopsySLink::SeedLinkStation::setName ( QString  n) [inline]

Referenced by ConformProcess::start().

{_name=n;}
void GeopsySLink::SeedLinkStation::setNetwork ( QString  n) [inline]

Referenced by ConformProcess::start().

{_network=n;}

Referenced by GeopsySLinkGui::SeedLinkStreamItem::data().

{return _streamCheck;}

Reimplemented from QGpCoreTools::XMLClass.

References TRACE.

{
  TRACE;
  Q_UNUSED(context);
  static const QString keys[]={ "name", "network", "description", "stream_check" };
  attributes.add(keys[0], _name);
  attributes.add(keys[1], _network);
  attributes.add(keys[2], _description);
  attributes.add(keys[3], _streamCheck ? "enabled" : "disabled" );
}

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.

{
  TRACE;
  Q_UNUSED(attributes);
  Q_UNUSED(context);
  if(tag=="stream" ) {
    SeedLinkStream * stream=new SeedLinkStream(this);
    append(stream);
    return XMLMember(stream);
  }
  else return XMLMember(XMLMember::Unknown);
}

Reimplemented from QGpCoreTools::XMLClass.

References QGpCoreTools::StringSection::size(), and TRACE.

{
  TRACE;
  Q_UNUSED(context);
  for(XMLRestoreAttributeIterator it=attributes.begin(); it!= attributes.end(); it++ ) {
    const StringSection& att=it.key();
    if(att.size()<3) return false;
    switch (att[2].unicode()) {
    case 'm':
      if(att=="name" ) _name=it.value().toString(); else return false;
      break;
    case 't':
      if(att=="network" ) _network=it.value().toString(); else return false;
      break;
    case 's':
      if(att=="description" ) _description=it.value().toString(); else return false;
      break;
    case 'r':
      if(att=="stream_check" ) _streamCheck=it.value()=="enabled"; else return false;
      break;
    case 'g':
      if(att=="begin_seq" ); else return false;
      break;
    case 'd':
      if(att=="end_seq" ); else return false;
      break;
    default:
      return false;
    }
  }
  return true;
}
virtual const QString& GeopsySLink::SeedLinkStation::xml_tagName ( ) const [inline, virtual]

Reimplemented from QGpCoreTools::XMLClass.

References TRACE.

{
  TRACE;
  for(const_iterator it=begin(); it!=end(); it++ ) {
    XMLSaveAttributes attributes;
    (*it)->xml_attributes(attributes, context);
    (*it)->xml_save(s, context, attributes);
  }
}

Member Data Documentation

const QString GeopsySLink::SeedLinkStation::xmlSeedLinkStationTag = "station" [static]

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