Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Public Member Functions | Private Attributes
ArcSec::MatchFunction Class Reference

Evaluate whether arg1 (value in regular expression) matched arg0 (lable in regular expression) More...

#include <MatchFunction.h>

Inheritance diagram for ArcSec::MatchFunction:
Inheritance graph
[legend]
Collaboration diagram for ArcSec::MatchFunction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MatchFunction (std::string functionName, std::string argumentType)
virtual AttributeValueevaluate (AttributeValue *arg0, AttributeValue *arg1, bool check_id=true)
 Evaluate two AttributeValue objects, and return one AttributeValue object.
virtual std::list
< AttributeValue * > 
evaluate (std::list< AttributeValue * > args, bool check_id=true)
 Evaluate a list of AttributeValue objects, and return a list of Attribute objects.

Static Public Member Functions

static std::string getFunctionName (std::string datatype)
 help function to get the FunctionName

Private Attributes

std::string fnName
std::string argType

Detailed Description

Evaluate whether arg1 (value in regular expression) matched arg0 (lable in regular expression)

Definition at line 14 of file MatchFunction.h.


Constructor & Destructor Documentation

ArcSec::MatchFunction::MatchFunction ( std::string  functionName,
std::string  argumentType 
)

Definition at line 22 of file MatchFunction.cpp.

                                                                           : Function(functionName, argumentType) {
  fnName = functionName;
  argType = argumentType;
}

Member Function Documentation

AttributeValue * ArcSec::MatchFunction::evaluate ( AttributeValue arg0,
AttributeValue arg1,
bool  check_id = true 
) [virtual]

Evaluate two AttributeValue objects, and return one AttributeValue object.

Implements ArcSec::Function.

Definition at line 27 of file MatchFunction.cpp.

                                                                                                {
  //TODO
  //arg0 is the attributevalue in policy
  //arg1 is the attributevalue in request
  if(check_id) { if(arg0->getId() != arg1->getId()) return new BooleanAttribute(false); }
  std::string label = arg0->encode();
  std::string value = arg1->encode();
  Arc::RegularExpression regex(label);
  if(regex.isOk()){
    std::list<std::string> unmatched, matched;
    if(regex.match(value, unmatched, matched))
      return new BooleanAttribute(true);
  }
  // std::cerr<<"Bad Regex"<<std::endl;
  return new BooleanAttribute(false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::list< AttributeValue * > ArcSec::MatchFunction::evaluate ( std::list< AttributeValue * >  args,
bool  check_id = true 
) [virtual]

Evaluate a list of AttributeValue objects, and return a list of Attribute objects.

Implements ArcSec::Function.

Definition at line 44 of file MatchFunction.cpp.

                                                                                             {
  AttributeValue* arg0 = NULL;
  AttributeValue* arg1 = NULL;
  std::list<AttributeValue*>::iterator it = args.begin();
  arg0 = *it; it++;
  if(it!= args.end()) arg1 = *it;
  if(check_id) { 
    if(arg0->getId() != arg1->getId()) {
      std::list<AttributeValue*> ret;
      ret.push_back(new BooleanAttribute(false));
      return ret;
    }
  }
  AttributeValue* res = evaluate(arg0, arg1);
  std::list<AttributeValue*> ret;
  ret.push_back(res);
  return ret;
}

Here is the call graph for this function:

std::string ArcSec::MatchFunction::getFunctionName ( std::string  datatype) [static]

help function to get the FunctionName

Definition at line 14 of file MatchFunction.cpp.

Here is the call graph for this function:


Member Data Documentation

std::string ArcSec::MatchFunction::argType [private]

Definition at line 26 of file MatchFunction.h.

std::string ArcSec::MatchFunction::fnName [private]

Definition at line 25 of file MatchFunction.h.


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