src_other/tuplebase/ZTSWatcher_Client.h

00001 /*  @(#) $Id: ZTSWatcher_Client.h,v 1.3 2007/07/15 20:35:35 agreen Exp $ */
00002 
00003 /* ------------------------------------------------------------
00004 Copyright (c) 2005 Andrew Green and Learning in Motion, Inc.
00005 http://www.zoolib.org
00006 
00007 Permission is hereby granted, free of charge, to any person obtaining a copy
00008 of this software and associated documentation files (the "Software"), to deal
00009 in the Software without restriction, including without limitation the rights
00010 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011 copies of the Software, and to permit persons to whom the Software is
00012 furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included in
00015 all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020 COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023 ------------------------------------------------------------ */
00024 
00025 #ifndef __ZTSWatcher_Client__
00026 #define __ZTSWatcher_Client__
00027 #include "zconfig.h"
00028 
00029 #include "ZCompat_NonCopyable.h"
00030 #include "ZStreamer.h"
00031 #include "ZTSWatcher.h"
00032 
00033 // =================================================================================================
00034 #pragma mark -
00035 #pragma mark * ZTSWatcher_Client
00036 
00037 class ZTSWatcher_Client : public ZTSWatcher
00038         {
00039 public:
00040         ZTSWatcher_Client(
00041                 bool iSupports2, bool iSupports3, bool iSupports4, ZRef<ZStreamerRW> iStreamerRW);
00042 
00043         virtual ~ZTSWatcher_Client();
00044 
00045 // From ZTSWatcher
00046         virtual bool AllocateIDs(size_t iCount, uint64& oBaseID, size_t& oCountIssued);
00047 
00048         virtual bool Sync(
00049                 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00050                 const uint64* iAddedIDs, size_t iAddedIDsCount,
00051                 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00052                 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00053                 std::vector<uint64>& oAddedIDs,
00054                 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00055                 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00056                 std::map<int64, std::vector<uint64> >& oChangedQueries);
00057 
00058         virtual void SetCallback(Callback_t iCallback, void* iRefcon);
00059 
00060 private:
00061         void pSync1(
00062                 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00063                 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00064                 const uint64* iAddedIDs, size_t iAddedIDsCount,
00065                 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00066                 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00067                 std::vector<uint64>& oAddedIDs,
00068                 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00069                 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00070                 std::map<int64, std::vector<uint64> >& oChangedQueries);
00071 
00072         void pSync2(
00073                 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00074                 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00075                 const uint64* iAddedIDs, size_t iAddedIDsCount,
00076                 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00077                 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00078                 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00079                 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00080                 std::map<int64, std::vector<uint64> >& oChangedQueries);
00081 
00082         void pSync3(
00083                 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00084                 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00085                 const uint64* iAddedIDs, size_t iAddedIDsCount,
00086                 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00087                 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00088                 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00089                 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00090                 std::map<int64, std::vector<uint64> >& oChangedQueries);
00091 
00092         void pSync4(
00093                 const ZStreamR& iStreamR, const ZStreamW& iStreamW,
00094                 const uint64* iRemovedIDs, size_t iRemovedIDsCount,
00095                 const uint64* iAddedIDs, size_t iAddedIDsCount,
00096                 const int64* iRemovedQueries, size_t iRemovedQueriesCount,
00097                 const AddedQueryCombo* iAddedQueries, size_t iAddedQueriesCount,
00098                 std::vector<uint64>& oAddedIDs,
00099                 std::vector<uint64>& oChangedTupleIDs, std::vector<ZTuple>& oChangedTuples,
00100                 const uint64* iWrittenTupleIDs, const ZTuple* iWrittenTuples, size_t iWrittenTuplesCount,
00101                 std::map<int64, std::vector<uint64> >& oChangedQueries);
00102 
00103         ZMutex fMutex;
00104         bool const fSupports2;
00105         bool const fSupports3;
00106         bool const fSupports4;
00107         ZRef<ZStreamerRW> fStreamerRW;
00108         };
00109 
00110 #endif // __ZTSWatcher_Client__

Generated on Thu Jul 26 11:21:59 2007 for ZooLib by  doxygen 1.4.7