src/include/common/spds/SyncReport.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef INCL_SYNCREPORT
00020 #define INCL_SYNCREPORT
00021 
00025 #include "base/fscapi.h"
00026 #include "base/Log.h"
00027 #include "base/util/StringBuffer.h"
00028 #include "spds/SyncSource.h"
00029 #include "spds/constants.h"
00030 #include "spds/SyncSourceReport.h"
00031 #include "spds/SyncManagerConfig.h"
00032 
00033 
00034 // To notify if status comes from Client or server
00035 #define CLIENT      "Client"
00036 #define SERVER      "Server"
00037 
00038 
00049 class SyncReport {
00050 
00051 private:
00052 
00053     // The error code of the last error occurred.
00054     int   lastErrorCode;
00055 
00056     // The error message of the last error occurred.
00057     char* lastErrorMsg;
00058 
00059     // Array of report for each SyncSource.
00060     SyncSourceReport* ssReport;
00061     unsigned int ssReportCount;
00062 
00063 
00064     /*
00065      * Function to initialize members.
00066      */
00067     void initialize();
00068 
00069     /*
00070      * Assign this object with the given SyncReport
00071      * @param sr the syncReport object
00072      */
00073     void assign(const SyncReport& sr);
00074 
00075 
00076 public:
00077 
00078     SyncReport();
00079     SyncReport(SyncReport& sr);
00080     // Constructor passing a given configuration: setSyncSourceReports() is called.
00081     SyncReport(SyncManagerConfig& config);
00082     virtual ~SyncReport();
00083 
00089     const int          getLastErrorCode()         const;
00090 
00095     const char*        getLastErrorMsg()          const;
00096 
00098     const unsigned int getSyncSourceReportCount() const;
00099 
00100     void setLastErrorCode(const int code);
00101     void setLastErrorMsg (const char* msg);
00102 
00104     SyncSourceReport* getSyncSourceReport(const char* name)   const;
00105 
00107     SyncSourceReport* getSyncSourceReport(unsigned int index) const;
00108     
00109 
00120     void setSyncSourceReports(SyncManagerConfig& config);
00121 
00130     void toString(StringBuffer &str, BOOL verbose = FALSE);
00131 
00135     SyncReport& operator = (const SyncReport& sr) {
00136         assign(sr);
00137         return *this;
00138     }
00139 };
00140 
00143 #endif
00144 

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2