diff options
| author | Ted Ross <tross@apache.org> | 2009-09-18 20:15:15 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-09-18 20:15:15 +0000 |
| commit | 1f0b2bfcb1f3e540d26985d859e1935706317524 (patch) | |
| tree | 4b94f7e10b70dd8dbf235b0ad7a0fcd083200365 /cpp/src/qmf/QueryImpl.h | |
| parent | 7190e1994763e42d208b5e3f17edd53a0d48546a (diff) | |
| download | qpid-python-1f0b2bfcb1f3e540d26985d859e1935706317524.tar.gz | |
Refactored the QMF engine to adhere to the following rules regarding
the pimpl (Pointer to Implementation) pattern:
1) Impl classes have constructors matching the public constructors
2) Additional Impl constructors are accessed through a static factory function
3) All linkages to objects are to the public object
4) If a back-link (from Impl to public) is needed, the Impl class must be
derived from boost::noncopyable
5) All public classes have non-default copy constructors that make a copy of the
Impl class
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@816770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/QueryImpl.h')
| -rw-r--r-- | cpp/src/qmf/QueryImpl.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/cpp/src/qmf/QueryImpl.h b/cpp/src/qmf/QueryImpl.h index 4a56a457c0..afc2c754e6 100644 --- a/cpp/src/qmf/QueryImpl.h +++ b/cpp/src/qmf/QueryImpl.h @@ -34,39 +34,36 @@ namespace qpid { namespace qmf { struct QueryElementImpl { - QueryElementImpl(const std::string& a, const Value* v, ValueOper o) : - envelope(new QueryElement(this)), attrName(a), value(v), oper(o) {} + QueryElementImpl(const std::string& a, const Value* v, ValueOper o) : attrName(a), value(v), oper(o) {} ~QueryElementImpl() {} bool evaluate(const Object* object) const; - QueryElement* envelope; std::string attrName; const Value* value; ValueOper oper; }; struct QueryExpressionImpl { - QueryExpressionImpl(ExprOper o, const QueryOperand* operand1, const QueryOperand* operand2) : - envelope(new QueryExpression(this)), oper(o), left(operand1), right(operand2) {} + QueryExpressionImpl(ExprOper o, const QueryOperand* operand1, const QueryOperand* operand2) : oper(o), left(operand1), right(operand2) {} ~QueryExpressionImpl() {} bool evaluate(const Object* object) const; - QueryExpression* envelope; ExprOper oper; const QueryOperand* left; const QueryOperand* right; }; struct QueryImpl { - QueryImpl(Query* e) : envelope(e), select(0) {} - QueryImpl(const std::string& c, const std::string& p) : - envelope(new Query(this)), packageName(p), className(c) {} - QueryImpl(const SchemaClassKey* key) : - envelope(new Query(this)), packageName(key->getPackageName()), className(key->getClassName()) {} - QueryImpl(const ObjectId* oid) : - envelope(new Query(this)), oid(new ObjectId(*oid)) {} + // Constructors mapped to public + QueryImpl(const std::string& c, const std::string& p) : packageName(p), className(c), select(0), resultLimit(0) {} + QueryImpl(const SchemaClassKey* key) : packageName(key->getPackageName()), className(key->getClassName()), select(0), resultLimit(0) {} + QueryImpl(const ObjectId* oid) : oid(new ObjectId(*oid)), select(0), resultLimit(0) {} + + // Factory constructors QueryImpl(qpid::framing::Buffer& buffer); + ~QueryImpl() {}; + static Query* factory(qpid::framing::Buffer& buffer); void setSelect(const QueryOperand* criterion) { select = criterion; } void setLimit(uint32_t maxResults) { resultLimit = maxResults; } @@ -88,7 +85,6 @@ namespace qmf { void encode(qpid::framing::Buffer& buffer) const; - Query* envelope; std::string packageName; std::string className; boost::shared_ptr<ObjectId> oid; |
