#include <coherence/util/extractor/PofExtractor.hpp>
Inherits AbstractExtractor, and PortableObject.
PofExtractor takes advantage of POF's indexed state to extract part of an object without needing to deserialize the entire object.
POF uses a compact form in the serialized value when possible. For example, some numeric values are represented as special POF intrinsic types in which the type implies the value. As a result, POF requires the receiver of a value to have implicit knowledge of the type. PofExtractor uses the type supplied in the constructor as the source of the type information. If the type is void, PofExtractor will infer the type from the serialized state. See PofConstants for the list of the POF types.
In C++ the type is expressed by type_info which is obtained from the typeid operator.
Example where extracted value is float64_t:
ValueExtractor::Handle hExtractor =
PofExtractor::create(typeid(float64_t), 0);
Example where extracted value should be inferred from the serialized state:
ValueExtractor::Handle hExtractor =
PofExtractor::create(typeid(void), 0);
Public Types | |
typedef spec::Handle | Handle |
PofExtractor Handle definition. | |
typedef spec::View | View |
PofExtractor View definition. | |
typedef spec::Holder | Holder |
PofExtractor Holder definition. | |
Public Member Functions | |
virtual Object::Holder | extractFromEntry (Map::Entry::Holder ohEntry) const |
Extract the value from the passed Entry object. | |
virtual void | readExternal (PofReader::Handle hIn) |
virtual void | writeExternal (PofWriter::Handle hOut) const |
virtual bool | equals (Object::View v) const |
Compare the PofExtractor with another object to determine equality. | |
virtual size32_t | hashCode () const |
Determine a hash value for the PofExtractor object according to the general Object#hashCode() contract. | |
virtual TypedHandle < const String > | toString () const |
Return a human-readable description for this PofExtractor. | |
Class::View | getClassExtracted () const |
Obtain the Class of the extracted value. | |
virtual PofNavigator::View | getNavigator () const |
Obtain the PofPath for this extractor. | |
Protected Member Functions | |
PofExtractor () | |
Default constructor (necessary for the PortableObject interface). | |
PofExtractor (const std::type_info &info, int32_t iProp) | |
Constructs a PofExtractor based on a property index. | |
PofExtractor (const std::type_info &info, PofNavigator::View vNavigator, int32_t nTarget=value) | |
Constructs a PofExtractor based on a property path and the entry extraction target. | |
virtual int32_t | getPofTypeId (PofContext::View vCtx) const |
Compute the expected POF type id based on the class. |
PofExtractor | ( | const std::type_info & | info, | |
int32_t | iProp | |||
) | [protected] |
Constructs a PofExtractor based on a property index.
This constructor is equivalent to:
PofExtractor::View vExtractor = PofExtractor::create(info, SimplePofPath::create(iProp), value);
info | the required type of the extracted value or void if the type is to be inferred from the serialized state | |
iProp | property index |
PofExtractor | ( | const std::type_info & | info, | |
PofNavigator::View | vNavigator, | |||
int32_t | nTarget = value | |||
) | [protected] |
Constructs a PofExtractor based on a property path and the entry extraction target.
virtual Object::Holder extractFromEntry | ( | Map::Entry::Holder | ohEntry | ) | const [virtual] |
Extract the value from the passed Entry object.
The returned value should follow the conventions outlined in the extract method.
This method will always throw a UnsupportedOperationException if called directly by the C++ client application, as its execution is only meaningful within the cluster.
It is expected that this extractor will only be used against POF-encoded binary entries within a remote partitioned cache.
entry | an Entry object to extract a desired value from |
UnsupportedOperationException | always, as it is expected that this extractor will only be executed within the cluster. |
Reimplemented from AbstractExtractor.
virtual bool equals | ( | Object::View | v | ) | const [virtual] |
Compare the PofExtractor with another object to determine equality.
Two PofExtractor objects are considered equal iff their paths are equal and they have the same target (key or value).
virtual size32_t hashCode | ( | ) | const [virtual] |
Determine a hash value for the PofExtractor object according to the general Object#hashCode() contract.
Reimplemented from Object.
virtual TypedHandle<const String> toString | ( | ) | const [virtual] |
Return a human-readable description for this PofExtractor.
Reimplemented from Object.
Class::View getClassExtracted | ( | ) | const |
Obtain the Class of the extracted value.
virtual PofNavigator::View getNavigator | ( | ) | const [virtual] |
virtual int32_t getPofTypeId | ( | PofContext::View | vCtx | ) | const [protected, virtual] |
Compute the expected POF type id based on the class.
vCtx | POF context |