Back to index

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

#include <InRangeFunction.h>

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

List of all members.

Public Member Functions

 InRangeFunction (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)

Private Attributes

std::string fnName
std::string argType

Detailed Description

Definition at line 12 of file InRangeFunction.h.


Constructor & Destructor Documentation

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

Definition at line 19 of file InRangeFunction.cpp.

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

Member Function Documentation

AttributeValue * ArcSec::InRangeFunction::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 24 of file InRangeFunction.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); }
  if(fnName == NAME_TIME_IN_RANGE){
    PeriodAttribute* v0;
    DateTimeAttribute* v1;
    try{
      v0 = dynamic_cast<PeriodAttribute*>(arg0);
      v1 = dynamic_cast<DateTimeAttribute*>(arg1);
    } catch(std::exception&){ };
    if(v1->inrange(v0))
      return new BooleanAttribute(true);
  }
  else if(fnName == NAME_STRING_IN_RANGE) {
    StringAttribute* v0;
    StringAttribute* v1;
    try{
      v0 = dynamic_cast<StringAttribute*>(arg0);
      v1 = dynamic_cast<StringAttribute*>(arg1);
    } catch(std::exception&){ };
    if(v1->inrange(v0))
      return new BooleanAttribute(true);
  }
  return new BooleanAttribute(false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

std::list< AttributeValue * > ArcSec::InRangeFunction::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 52 of file InRangeFunction.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::InRangeFunction::getFunctionName ( std::string  datatype) [static]

Definition at line 12 of file InRangeFunction.cpp.

                                                            {
  std::string ret;
  if (datatype ==  DateTimeAttribute::getIdentifier()) ret = NAME_TIME_IN_RANGE;
  else if (datatype ==  StringAttribute::getIdentifier()) ret = NAME_STRING_IN_RANGE;
  return ret;
}

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 24 of file InRangeFunction.h.

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

Definition at line 23 of file InRangeFunction.h.


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