ScaleOut C++ Native Client API  5.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
sosscli::ReferenceComparand Class Reference

A ReferenceComparand node holds a string used to identify a field or property within objects persisted to StateServer via a TypedNamedCache::put(), TypedNamedCache::insert(), or TypedNamedCache::update() method. More...

#include <reference_comparand.h>

Inheritance diagram for sosscli::ReferenceComparand:
sosscli::ExpressionComparand

Public Member Functions

 ReferenceComparand (std::string const &field_name)
 Constructor. More...
 
 ReferenceComparand (const char *field_name)
 Constructor. More...
 
Filter operator== (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for equality. More...
 
Filter operator== (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for equality the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter operator!= (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for inequality. More...
 
Filter operator!= (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for inequality the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter operator> (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a greater than condition. More...
 
Filter operator> (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for a greater than condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter operator>= (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a greater than or equal to condition. More...
 
Filter operator>= (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for a greater than or equal to condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter operator< (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a less than condition. More...
 
Filter operator< (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for a less than condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter operator<= (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a less than or equal to condition. More...
 
Filter operator<= (ReferenceComparand const &field)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare for a less than or equal to condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer. More...
 
Filter contains (ValueComparand const &value)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() (which must be a string-type value) of objects persisted in StateServer with the "immediate" value held by value (which must also be a string-type value) for string containment. More...
 
Filter contains (ReferenceComparand const &ref)
 Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() (which must be a string-type value) of objects persisted in StateServer with the the value corresponding to ref's field_name() (which must also be a string-type value) for string containment. More...
 
std::string const & field_name () const
 Returns the name of this ReferenceComparand's field. More...
 
virtual void accept (QueryExpression::Visitor &v) const
 Initiates the visitor pattern on this node. More...
 

Detailed Description

A ReferenceComparand node holds a string used to identify a field or property within objects persisted to StateServer via a TypedNamedCache::put(), TypedNamedCache::insert(), or TypedNamedCache::update() method.

Type serializers implemented in TypedNamedCache subclasses may (depending on the subclass implementation) serialize metadata containing name, type, and value information when an object is persisted. If so, StateServer can be directed to examine this metadata when a QueryExpression is evaluated and compare this information on the StateServer hosts with immediate values and/or other object fields/properties when executing a NamedCache::query() operation. The ReferenceComparand holds only a field/property name. Translating that name into a query expression operand is dependent on the metadata serializer which is in turn dependent on the TypedNamedCache subclass. A serializer-dependent QueryExpression::Visitor is used to translate the field name into a much more compact expression that the server can use.

ReferenceComparand implements a number of comparison operator overloads that serve as Filter factory methods: By writing an expression that compares a ReferenceOperand with either a ValueOperand or another ReferenceOperand, you create a Filter object. Filters can be subsequently combined with other filters using boolean operator overloads implemented in the Filter class. For example:

Filter filt = ReferenceComparand("id") == 2000;

Creates a Filter which can be used as the argument to a NamedCache::query(const Filter &, bool) method call which will translate filt into a StateServer expression that compares the "id" field of objects persisted on the server to the literal value 2000.

See Also
ValueComparand

Constructor & Destructor Documentation

sosscli::ReferenceComparand::ReferenceComparand ( std::string const &  field_name)
explicit

Constructor.

Creates a new ReferenceComparand instance initialized with the given field_name.

Parameters
field_namethe name of a field known to be serialized as object metadata for the object type that the NamedCache::query() will be run against.
sosscli::ReferenceComparand::ReferenceComparand ( const char *  field_name)
explicit

Constructor.

Creates a new ReferenceComparand instance initialized with the given field_name.

Parameters
field_namethe name of a field known to be serialized as object metadata for the object type that the NamedCache::query() will be run against.

Member Function Documentation

virtual void sosscli::ReferenceComparand::accept ( QueryExpression::Visitor v) const
virtual

Initiates the visitor pattern on this node.

Calls QueryExpression::Visitor::visit(ReferenceComparand const &) on the supplied visitor, v.

Parameters
vAn implementation of QueryExpression::Visitor.

Implements sosscli::ExpressionComparand.

Filter sosscli::ReferenceComparand::contains ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() (which must be a string-type value) of objects persisted in StateServer with the "immediate" value held by value (which must also be a string-type value) for string containment.

Parameters
valueThe "immediate" value to compare. The value must be a string type value.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::contains ( ReferenceComparand const &  ref)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() (which must be a string-type value) of objects persisted in StateServer with the the value corresponding to ref's field_name() (which must also be a string-type value) for string containment.

Parameters
refA ReferenceComparand holding the name of another field. The field must hold string values.
Returns
A Filter object holding the generated QueryExpression.
std::string const& sosscli::ReferenceComparand::field_name ( ) const

Returns the name of this ReferenceComparand's field.

Returns
The name of this ReferenceComparand's field.
Filter sosscli::ReferenceComparand::operator!= ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for inequality.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator!= ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for inequality the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator< ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a less than condition.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator< ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for a less than condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator<= ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a less than or equal to condition.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator<= ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for a less than or equal to condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator== ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for equality.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator== ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for equality the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator> ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a greater than condition.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator> ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for a greater than condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator>= ( ValueComparand const &  value)

Creates a Filter object based on a QueryExpression that causes StateServer to compare the field value corresponding to field_name() of objects persisted in StateServer with the "immediate" value held by value for a greater than or equal to condition.

Parameters
valueThe "immediate" value to compare.
Returns
A Filter object holding the generated QueryExpression.
Filter sosscli::ReferenceComparand::operator>= ( ReferenceComparand const &  field)

Creates a Filter object based on a QueryExpression that causes StateServer to compare for a greater than or equal to condition the field values corresponding to this ReferenceComparand's field_name() with the value corresponding to field's field_name() for objects persisted in StateServer.

Parameters
fieldA ReferenceComparand holding the name of another field
Returns
A Filter object holding the generated QueryExpression.

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