Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Attributes
Arc::RSLSequence Class Reference

#include <RSLParser.h>

Inheritance diagram for Arc::RSLSequence:
Inheritance graph
[legend]
Collaboration diagram for Arc::RSLSequence:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RSLSequence (RSLList *seq)
 ~RSLSequence ()
void Print (std::ostream &os=std::cout) const
std::list< RSLValue * >::iterator begin ()
std::list< RSLValue * >::iterator end ()
std::list< RSLValue * >
::const_iterator 
begin () const
std::list< RSLValue * >
::const_iterator 
end () const
std::list< RSLValue * >::size_type size () const
RSLValueEvaluate (std::map< std::string, std::string > &vars) const

Private Attributes

RSLListseq

Detailed Description

Definition at line 111 of file RSLParser.h.


Constructor & Destructor Documentation

Definition at line 175 of file RSLParser.cpp.

    : RSLValue(),
      seq(seq) {}

Definition at line 179 of file RSLParser.cpp.

                            {
    delete seq;
  }

Member Function Documentation

std::list<RSLValue*>::iterator Arc::RSLSequence::begin ( ) [inline]

Definition at line 117 of file RSLParser.h.

                                       {
      return seq->begin();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::list<RSLValue*>::const_iterator Arc::RSLSequence::begin ( ) const [inline]

Definition at line 123 of file RSLParser.h.

                                                   {
      return seq->begin();
    }

Here is the call graph for this function:

std::list<RSLValue*>::iterator Arc::RSLSequence::end ( ) [inline]

Definition at line 120 of file RSLParser.h.

                                     {
      return seq->end();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::list<RSLValue*>::const_iterator Arc::RSLSequence::end ( ) const [inline]

Definition at line 126 of file RSLParser.h.

                                                 {
      return seq->end();
    }

Here is the call graph for this function:

RSLValue * Arc::RSLValue::Evaluate ( std::map< std::string, std::string > &  vars) const [inherited]

Definition at line 21 of file RSLParser.cpp.

                                                                       {
    const RSLLiteral *n;
    const RSLVariable *v;
    const RSLConcat *c;
    const RSLList *l;
    const RSLSequence *s;
    if ((n = dynamic_cast<const RSLLiteral*>(this)))
      return new RSLLiteral(n->Value());
    else if ((v = dynamic_cast<const RSLVariable*>(this))) {
      std::map<std::string, std::string>::iterator it = vars.find(v->Var());
      return new RSLLiteral((it != vars.end()) ? it->second : "");
    }
    else if ((c = dynamic_cast<const RSLConcat*>(this))) {
      RSLValue *left = c->Left()->Evaluate(vars);
      if (!left) {
        std::stringstream ss;
        ss << *c->Left();
        logger.msg(ERROR, "Can't evaluate left operand for RSL "
                   "concatenation: %s", ss.str());
        return NULL;
      }
      RSLValue *right = c->Right()->Evaluate(vars);
      if (!right) {
        std::stringstream ss;
        ss << *c->Right();
        logger.msg(ERROR, "Can't evaluate right operand for RSL "
                   "concatenation: %s", ss.str());
        delete left;
        return NULL;
      }
      RSLLiteral *nleft = dynamic_cast<RSLLiteral*>(left);
      if (!nleft) {
        std::stringstream ss;
        ss << *left;
        logger.msg(ERROR, "Left operand for RSL concatenation does not "
                   "evaluate to a literal: %s", ss.str());
        delete left;
        delete right;
        return NULL;
      }
      RSLLiteral *nright = dynamic_cast<RSLLiteral*>(right);
      if (!nright) {
        std::stringstream ss;
        ss << *right;
        logger.msg(ERROR, "Right operand for RSL concatenation does not "
                   "evaluate to a literal: %s", ss.str());
        delete left;
        delete right;
        return NULL;
      }
      RSLLiteral *result = new RSLLiteral(nleft->Value() + nright->Value());
      delete left;
      delete right;
      return result;
    }
    else if ((l = dynamic_cast<const RSLList*>(this))) {
      RSLList *result = new RSLList;
      for (std::list<RSLValue*>::const_iterator it = l->begin();
           it != l->end(); it++) {
        RSLValue *value = (*it)->Evaluate(vars);
        if (!value) {
          std::stringstream ss;
          ss << **it;
          logger.msg(ERROR, "Can't evaluate RSL list member: %s", ss.str());
          delete result;
          return NULL;
        }
        result->Add(value);
      }
      return result;
    }
    else if ((s = dynamic_cast<const RSLSequence*>(this))) {
      RSLList *result = new RSLList;
      for (std::list<RSLValue*>::const_iterator it = s->begin();
           it != s->end(); it++) {
        RSLValue *value = (*it)->Evaluate(vars);
        if (!value) {
          std::stringstream ss;
          ss << **it;
          logger.msg(ERROR, "Can't evaluate RSL sequence member: %s", ss.str());
          delete result;
          return NULL;
        }
        result->Add(value);
      }
      return new RSLSequence(result);
    }
    else {
      logger.msg(ERROR, "Unknown RSL value type - should not happen");
      return NULL;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::RSLSequence::Print ( std::ostream &  os = std::cout) const [virtual]

Implements Arc::RSLValue.

Definition at line 183 of file RSLParser.cpp.

                                              {
    os << "( " << *seq << " )";
  }
std::list<RSLValue*>::size_type Arc::RSLSequence::size ( ) const [inline]

Definition at line 129 of file RSLParser.h.

                                             {
      return seq->size();
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 133 of file RSLParser.h.


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