diff options
Diffstat (limited to 'cpp/src/Freeze/ObjectStore.h')
-rw-r--r-- | cpp/src/Freeze/ObjectStore.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/cpp/src/Freeze/ObjectStore.h b/cpp/src/Freeze/ObjectStore.h index 7c2cdea8e5b..8a73f68bbda 100644 --- a/cpp/src/Freeze/ObjectStore.h +++ b/cpp/src/Freeze/ObjectStore.h @@ -41,11 +41,40 @@ public: const Ice::ObjectPtr& sampleServant() const; bool dbHasObject(const Ice::Identity&, const TransactionIPtr&) const; - void save(Key& key, Value& value, Ice::Byte status, DbTxn* tx); + void save(Dbt&, Dbt&, Ice::Byte, DbTxn*); + + // + // This base class encapsulates a BasicStream, which allows us to avoid + // making any extra copies of marshaled data when updating the database. + // + class Marshaler + { + public: + + Marshaler(const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); + + void getDbt(Dbt&) const; + + protected: + + IceInternal::BasicStream _os; + }; + + class KeyMarshaler : public Marshaler + { + public: + + KeyMarshaler(const Ice::Identity&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); + }; + + class ValueMarshaler : public Marshaler + { + public: + + ValueMarshaler(const ObjectRecord&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, bool); + }; - static void marshal(const Ice::Identity&, Key&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); static void unmarshal(Ice::Identity&, const Key&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&); - static void marshal(const ObjectRecord&, Value&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, bool); static void unmarshal(ObjectRecord&, const Value&, const Ice::CommunicatorPtr&, const Ice::EncodingVersion&, bool); bool load(const Ice::Identity&, const TransactionIPtr&, ObjectRecord&); |