COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_core/include/coopy/Merger.h
Go to the documentation of this file.
00001 #ifndef COOPY_MERGER
00002 #define COOPY_MERGER
00003 
00004 #include <coopy/OrderMerge.h>
00005 #include <coopy/OrderResult.h>
00006 #include <coopy/DataSheet.h>
00007 #include <coopy/MergeOutput.h>
00008 #include <coopy/CompareFlags.h>
00009 #include <coopy/NameSniffer.h>
00010 #include <coopy/EfficientMap.h>
00011 
00012 #include <vector>
00013 #include <set>
00014 
00015 namespace coopy {
00016   namespace cmp {
00017     class Merger;
00018     class MergerState;
00019   }
00020 }
00021 
00022 class coopy::cmp::MergerState {
00023 public:
00024   coopy::store::DataSheet& pivot;
00025   coopy::store::DataSheet& local;
00026   coopy::store::DataSheet& remote;
00027   const OrderResult& nrow_local;
00028   const OrderResult& nrow_remote;
00029   const OrderResult& ncol_local;
00030   const OrderResult& ncol_remote;
00031   Patcher& output;
00032   const CompareFlags& flags;
00033   coopy::store::NameSniffer& local_names;
00034   coopy::store::NameSniffer& remote_names;
00035   bool allIdentical;
00036 
00037   MergerState(coopy::store::DataSheet& pivot,
00038               coopy::store::DataSheet& local,
00039               coopy::store::DataSheet& remote,
00040               const OrderResult& nrow_local,
00041               const OrderResult& nrow_remote,
00042               const OrderResult& ncol_local,
00043               const OrderResult& ncol_remote,
00044               Patcher& output,
00045               const CompareFlags& flags,
00046               coopy::store::NameSniffer& local_names,
00047               coopy::store::NameSniffer& remote_names) :
00048     pivot(pivot), local(local), remote(remote),
00049     nrow_local(nrow_local), nrow_remote(nrow_remote),
00050     ncol_local(ncol_local), ncol_remote(ncol_remote),
00051     output(output),
00052     flags(flags),
00053     local_names(local_names), remote_names(remote_names) {
00054       allIdentical = false;
00055   }
00056 };
00057 
00058 class coopy::cmp::Merger {
00059 
00060 public:
00061   Merger() {
00062   }
00063 
00064   bool merge(MergerState& state);
00065 
00066   bool mergeRow(coopy::store::DataSheet& pivot, 
00067                 coopy::store::DataSheet& local, 
00068                 coopy::store::DataSheet& remote,
00069                 MatchUnit& row_unit, Patcher& output,
00070                 const CompareFlags& flags,
00071                 std::vector<coopy::cmp::RowChange>& rc);
00072 
00073 private:
00074   OrderMerge row_merge;
00075   OrderMerge col_merge;
00076   int conflicts;
00077   std::vector<std::string> lastAddress;
00078   std::vector<std::string> lastAction;
00079   std::vector<std::string> names;
00080   std::set<std::string> filtered_names;
00081   int last_local_row;
00082   int last_local_row_marked;
00083   int bottom_local_row;
00084   RowChange lastRowChange;
00085   bool had_row;
00086   bool had_foreign_row;
00087   efficient_map<std::string,int> include_column;
00088   efficient_map<std::string,int> exclude_column;
00089 
00090   int current_row;
00091   int last_row;
00092   int addition;
00093   bool allGone;
00094   //SheetSchema defaultSheetSchema;
00095   //SheetSchema *pivotSheetSchema;
00096   //SheetSchema *localSheetSchema;
00097   //SheetSchema *remoteSheetSchema;
00098 
00099 };
00100 
00101 #endif
00102 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines