blob: 9a988cb11779c67470c5a127989ee0cc78c06677 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* -*- C++ -*- */
// ========================================================================
// $Id$
//
// = LIBRARY
// orbsvcs
//
// = FILENAME
// Constraint_Interpreter.h
//
// = AUTHOR
// Seth Widoff <sbw1@cs.wustl.edu>
//
// ========================================================================
#ifndef TAO_CONSTRAINT_INTERPRETER_H
#define TAO_CONSTRAINT_INTERPRETER_H
#include "Interpreter.h"
#include "Constraint_Validator.h"
#include "Constraint_Evaluator.h"
class TAO_Constraint_Interpreter : public TAO_Interpreter
//
// = TITLE
// TAO_Constraint_Interpreter will, given a constraint string whose
// syntax and semantics comply with the trader specification for the
// constraint language, determine if a CosTrading::Offer meets the
// constraints.
//
// = DESCRIPTION
// TAO_Constraint_Interpreter will first build an expression tree
// representing the constraint expression using Lex and Yacc. Then,
// using a TAO_Constraint_Validator, it will validate the semantic
// correctness of the tree. When the evaluate method is invoked with
// an Offer, the TAO_Constraint_Interpreter will construct an
// EvaluationVisitor, which will evaluate the tree and decide
// whether the offer meets the constraints.
{
public:
TAO_Constraint_Interpreter(CosTradingRepos::ServiceTypeRepository::TypeStruct* ts,
const char* constraints,
CORBA::Environment& env)
TAO_THROW_SPEC (CosTrading::IllegalConstraint);
TAO_Constraint_Interpreter(TAO_Constraint_Validator& validator,
const char* constraints,
CORBA::Environment& env)
TAO_THROW_SPEC (CosTrading::IllegalConstraint);
// This constructor builds an expression tree representing the
// constraint specified in <constraints>, and throws an Illegal
// Constraint exception if the constraint given has syntax errors or
// semantic errors, such as mismatched types.
~TAO_Constraint_Interpreter(void);
// Destructor
CORBA::Boolean evaluate(CosTrading::Offer* offer);
CORBA::Boolean evaluate(TAO_Constraint_Evaluator& evaluator);
// Determine whether an offer fits the constraints with which the
// tree was constructed. This method is thread safe (hopefully).
};
#endif /* TAO_CONSTRAINT_INTERPRETER_H */
|