Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -r8b7479db2ee71a3d00779c67fe6a1b1d9ec414b8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 8b7479db2ee71a3d00779c67fe6a1b1d9ec414b8) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -613,7 +613,7 @@ { case WM_MINIVIEWDBLCLK: { - chcore::TTaskPtr spTask = m_spTasks->GetTaskByTaskID(lParam); + chcore::TTaskPtr spTask = m_spTasks->GetTaskByTaskID(boost::numeric_cast(lParam)); ShowStatusWindow(spTask); break; } Index: src/ch/MiniViewDlg.cpp =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/ch/MiniViewDlg.cpp (.../MiniViewDlg.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -803,7 +803,7 @@ return; chcore::taskid_t tTaskID = m_ctlStatus.m_vItems.at(iSel)->m_tTaskID; - GetParent()->PostMessage(WM_MINIVIEWDBLCLK, 0, tTaskID); + GetParent()->PostMessage(WM_MINIVIEWDBLCLK, 0, boost::numeric_cast(tTaskID)); } void CMiniViewDlg::OnLanguageChanged() Index: src/ch/StatusDlg.cpp =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -231,7 +231,7 @@ return; int iCurrentBufferIndex = 0; - chcore::TTaskStatsSnapshotPtr spTaskStats = m_spTaskMgrStats->GetTaskStatsForTaskID(GetSelectedItemSessionUniqueID()); + chcore::TTaskStatsSnapshotPtr spTaskStats = m_spTaskMgrStats->GetTaskStatsForTaskID(boost::numeric_cast(GetSelectedItemSessionUniqueID())); if(spTaskStats) { chcore::TSubTaskStatsSnapshotPtr spSubTaskStats = spTaskStats->GetSubTasksStats().GetCurrentSubTaskSnapshot(); @@ -253,7 +253,7 @@ { POSITION pos = m_ctlStatusList.GetFirstSelectedItemPosition(); int nPos = m_ctlStatusList.GetNextSelectedItem(pos); - return m_pTasks->GetTaskByTaskID(m_ctlStatusList.GetItemData(nPos)); + return m_pTasks->GetTaskByTaskID(boost::numeric_cast(m_ctlStatusList.GetItemData(nPos))); } return chcore::TTaskPtr(); @@ -1005,7 +1005,7 @@ lvi.iSubItem = 0; lvi.pszText = (PTSTR)(PCTSTR)strStatusText; lvi.cchTextMax = lstrlen(lvi.pszText); - lvi.lParam = spTaskStats->GetTaskID(); + lvi.lParam = boost::numeric_cast(spTaskStats->GetTaskID()); lvi.iImage = GetImageFromStatus(spTaskStats->GetTaskState()); if(boost::numeric_cast(stPos) < m_ctlStatusList.GetItemCount()) m_ctlStatusList.SetItem(&lvi); Index: src/ch/ch.cpp =================================================================== diff -u -N -r75318f0d3808d8d3c02dbc333c80b6d6e07fae13 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/ch/ch.cpp (.../ch.cpp) (revision 75318f0d3808d8d3c02dbc333c80b6d6e07fae13) +++ src/ch/ch.cpp (.../ch.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -233,9 +233,9 @@ TString strPath(_T("C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\sometask.xxx")); TSmartPath path(PathFromString(_T("C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\sometask.xxx"))); - for(size_t stIndex = 0; stIndex < 200000; ++stIndex) + for(object_id_t oidIndex = 0; oidIndex < 200000; ++oidIndex) { - ISerializerRowData& rRow = spContainer->GetRow(stIndex, true); + ISerializerRowData& rRow = spContainer->GetRow(oidIndex, true); rRow.SetValue(rel_path, path); //C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\sometask.xxx rRow.SetValue(base_path_id, 24735275ull); rRow.SetValue(attr, 0x56533234ul); Index: src/libchcore/CommonDataTypes.h =================================================================== diff -u -N --- src/libchcore/CommonDataTypes.h (revision 0) +++ src/libchcore/CommonDataTypes.h (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -0,0 +1,29 @@ +// ============================================================================ +// Copyright (C) 2001-2014 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#ifndef __COMMONDATATYPES_H__ +#define __COMMONDATATYPES_H__ + +BEGIN_CHCORE_NAMESPACE + +typedef unsigned long file_count_t; +typedef unsigned long long file_size_t; + +END_CHCORE_NAMESPACE + +#endif Index: src/libchcore/ConfigNode.cpp =================================================================== diff -u -N -rb1e03eb232a784d6e2d40f67cbbbb33be0972228 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/ConfigNode.cpp (.../ConfigNode.cpp) (revision b1e03eb232a784d6e2d40f67cbbbb33be0972228) +++ src/libchcore/ConfigNode.cpp (.../ConfigNode.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -24,8 +24,8 @@ namespace details { - ConfigNode::ConfigNode(size_t stObjectID, const TString& strNodeName, int iOrder, const TString& strValue) : - m_stObjectID(stObjectID), + ConfigNode::ConfigNode(object_id_t oidObjectID, const TString& strNodeName, int iOrder, const TString& strValue) : + m_oidObjectID(oidObjectID), m_iOrder(m_setModifications, iOrder), m_strNodeName(m_setModifications, strNodeName), m_strValue(m_setModifications, strValue) Index: src/libchcore/ConfigNode.h =================================================================== diff -u -N -rb1e03eb232a784d6e2d40f67cbbbb33be0972228 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/ConfigNode.h (.../ConfigNode.h) (revision b1e03eb232a784d6e2d40f67cbbbb33be0972228) +++ src/libchcore/ConfigNode.h (.../ConfigNode.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -23,6 +23,7 @@ #include #include #include "TSharedModificationTracker.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -31,7 +32,7 @@ class ConfigNode { public: - ConfigNode(size_t stObjectID, const TString& strNodeName, int iOrder, const TString& strValue); + ConfigNode(object_id_t oidObjectID, const TString& strNodeName, int iOrder, const TString& strValue); TString GetNodeName() const; int GetOrder() const; @@ -51,7 +52,7 @@ typedef std::bitset Bitset; mutable Bitset m_setModifications; - size_t m_stObjectID; + object_id_t m_oidObjectID; TSharedModificationTracker m_iOrder; TSharedModificationTracker m_strNodeName; TSharedModificationTracker m_strValue; Index: src/libchcore/ConfigNodeContainer.cpp =================================================================== diff -u -N -rf354b6f39d2a0425c1827906c84cbc1377b8c8d3 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision f354b6f39d2a0425c1827906c84cbc1377b8c8d3) +++ src/libchcore/ConfigNodeContainer.cpp (.../ConfigNodeContainer.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -75,7 +75,7 @@ /////////////////////////////////////////////////////////////////////// ConfigNodeContainer::ConfigNodeContainer() : m_bDelayedEnabled(false), - m_stLastObjectID(0) + m_oidLastObjectID(0) { } @@ -86,7 +86,7 @@ m_strFilePath = rSrc.m_strFilePath; m_setDelayedNotifications.Clear(); m_bDelayedEnabled = false; - m_stLastObjectID = rSrc.m_stLastObjectID; + m_oidLastObjectID = rSrc.m_oidLastObjectID; } ConfigNodeContainer& ConfigNodeContainer::operator=(const ConfigNodeContainer& rSrc) @@ -99,7 +99,7 @@ m_mic = rSrc.m_mic; m_strFilePath = rSrc.m_strFilePath; m_bDelayedEnabled = false; - m_stLastObjectID = rSrc.m_stLastObjectID; + m_oidLastObjectID = rSrc.m_oidLastObjectID; m_setDelayedNotifications.Clear(); } @@ -163,7 +163,7 @@ // insert new items for(size_t stIndex = 0; stIndex < rValue.GetCount(); ++stIndex) { - m_mic.insert(ConfigNode(++m_stLastObjectID, pszPropName, boost::numeric_cast(stIndex), rValue.GetAt(stIndex))); + m_mic.insert(ConfigNode(++m_oidLastObjectID, pszPropName, boost::numeric_cast(stIndex), rValue.GetAt(stIndex))); } return false; @@ -186,7 +186,7 @@ else { // delete this item - m_setRemovedObjects.Add(pairFnd.first->m_stObjectID); + m_setRemovedObjects.Add(pairFnd.first->m_oidObjectID); pairFnd.first = m_mic.erase(pairFnd.first); } @@ -196,7 +196,7 @@ while(stIndex < rValue.GetCount()) { // add items not added before (with new oids) - m_mic.insert(ConfigNode(++m_stLastObjectID, pszPropName, boost::numeric_cast(stIndex), rValue.GetAt(stIndex))); + m_mic.insert(ConfigNode(++m_oidLastObjectID, pszPropName, boost::numeric_cast(stIndex), rValue.GetAt(stIndex))); ++stIndex; } @@ -220,7 +220,7 @@ { if(rNode.m_strNodeName.Get().StartsWith(m_strPrefix.c_str())) { - m_rRemovedObjects.Add(rNode.m_stObjectID); + m_rRemovedObjects.Add(rNode.m_oidObjectID); return true; } return false; @@ -271,7 +271,7 @@ TString strName = iter->m_strNodeName.Get(); strName.MidSelf(strReplace.GetLength()); - tNewContainer.m_mic.insert(ConfigNode(++tNewContainer.m_stLastObjectID, strName, iter->GetOrder(), iter->m_strValue)); + tNewContainer.m_mic.insert(ConfigNode(++tNewContainer.m_oidLastObjectID, strName, iter->GetOrder(), iter->m_strValue)); } } @@ -313,7 +313,7 @@ } strName.Delete(0, stPos + 2); // skip "]." at the beginning - pCurrentContainer->m_mic.insert(ConfigNode(++pCurrentContainer->m_stLastObjectID, strName, iter->GetOrder(), iter->m_strValue)); + pCurrentContainer->m_mic.insert(ConfigNode(++pCurrentContainer->m_oidLastObjectID, strName, iter->GetOrder(), iter->m_strValue)); } } @@ -357,15 +357,15 @@ else { // node does not exist - need to add new one - m_mic.insert(ConfigNode(++m_stLastObjectID, strNodeName, iter->GetOrder(), iter->m_strValue)); + m_mic.insert(ConfigNode(++m_oidLastObjectID, strNodeName, iter->GetOrder(), iter->m_strValue)); } // remove all nodes with names from setExisting BOOST_FOREACH(const PairInfo& pairNode, setExistingNames) { NodeContainer::iterator iterToRemove = m_mic.find(boost::make_tuple(pairNode.first, pairNode.second)); if(iterToRemove != m_mic.end()) - m_setRemovedObjects.Add(iterToRemove->m_stObjectID); + m_setRemovedObjects.Add(iterToRemove->m_oidObjectID); m_mic.erase(iterToRemove); } @@ -406,7 +406,7 @@ { TString strNodeName = strNodePrefix + iter->m_strNodeName; - m_mic.insert(ConfigNode(++m_stLastObjectID, strNodeName, iter->GetOrder(), iter->m_strValue)); + m_mic.insert(ConfigNode(++m_oidLastObjectID, strNodeName, iter->GetOrder(), iter->m_strValue)); } } @@ -461,7 +461,7 @@ case eMode_LeafStringArrayEntries: { strNewPath = strCurrentPath + rNode.first.c_str(); - m_mic.insert(ConfigNode(++m_stLastObjectID, strNewPath, iIndex++, rNode.second.get_value().c_str())); + m_mic.insert(ConfigNode(++m_oidLastObjectID, strNewPath, iIndex++, rNode.second.get_value().c_str())); break; } case eMode_LeafOrContainer: @@ -470,7 +470,7 @@ if(rNode.second.empty()) { // get leaf info - m_mic.insert(ConfigNode(++m_stLastObjectID, strNewPath, 0, rNode.second.get_value().c_str())); + m_mic.insert(ConfigNode(++m_oidLastObjectID, strNewPath, 0, rNode.second.get_value().c_str())); } else { @@ -501,7 +501,9 @@ // iterate through property tree ImportNode(_T(""), rTree); +#ifdef _DEBUG Dump(); +#endif } void ConfigNodeContainer::ExportToPropertyTree(boost::property_tree::wiptree& rTree) const @@ -569,21 +571,24 @@ rTree.add_child(strGroupNode.c_str(), treeSubnodes); } +#ifdef _DEBUG void ConfigNodeContainer::Dump() { const size_t stBufferSize = 1024; TCHAR szBuffer[stBufferSize]; for(NodeContainer::const_iterator iter = m_mic.begin(); iter != m_mic.end(); ++iter) { - _sntprintf_s(szBuffer, stBufferSize, _TRUNCATE, _T("Node (oid %Iu): %s.%ld = %s\n"), iter->m_stObjectID, iter->m_strNodeName.Get().c_str(), iter->m_iOrder.Get(), iter->m_strValue.Get().c_str()); + unsigned long long ullID = iter->m_oidObjectID; + _sntprintf_s(szBuffer, stBufferSize, _TRUNCATE, _T("Node (oid %I64u): %s.%ld = %s\n"), ullID, iter->m_strNodeName.Get().c_str(), iter->m_iOrder.Get(), iter->m_strValue.Get().c_str()); OutputDebugString(szBuffer); } } +#endif void ConfigNodeContainer::AddEntry(PCTSTR pszPropName, int iIndex, const TString& strValue) { - std::pair pairInsert = m_mic.insert(ConfigNode(++m_stLastObjectID, pszPropName, iIndex, strValue)); + std::pair pairInsert = m_mic.insert(ConfigNode(++m_oidLastObjectID, pszPropName, iIndex, strValue)); pairInsert.first->m_setModifications.reset(); } } Index: src/libchcore/ConfigNodeContainer.h =================================================================== diff -u -N -r5324d0ca7af614cb066df1f121a7a338c4f7d7ed -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/ConfigNodeContainer.h (.../ConfigNodeContainer.h) (revision 5324d0ca7af614cb066df1f121a7a338c4f7d7ed) +++ src/libchcore/ConfigNodeContainer.h (.../ConfigNodeContainer.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -188,7 +188,7 @@ } else { - m_mic.insert(ConfigNode(++m_stLastObjectID, pszPropName, 0, boost::lexical_cast(rValue).c_str())); + m_mic.insert(ConfigNode(++m_oidLastObjectID, pszPropName, 0, boost::lexical_cast(rValue).c_str())); return true; } } @@ -207,7 +207,7 @@ } else { - m_mic.insert(ConfigNode(++m_stLastObjectID, pszPropName, 0, bValue ? _T("true") : _T("false"))); + m_mic.insert(ConfigNode(++m_oidLastObjectID, pszPropName, 0, bValue ? _T("true") : _T("false"))); return true; } } @@ -230,8 +230,10 @@ void ImportFromPropertyTree(const boost::property_tree::wiptree& rTree, boost::unique_lock&); void ExportToPropertyTree(boost::property_tree::wiptree& rTree) const; +#ifdef _DEBUG // debugging void Dump(); +#endif private: void ImportNode(TString strCurrentPath, const boost::property_tree::wiptree& rTree); @@ -255,7 +257,7 @@ boost::signals2::signal m_notifier; TStringSet m_setDelayedNotifications; bool m_bDelayedEnabled; - size_t m_stLastObjectID; + object_id_t m_oidLastObjectID; TRemovedObjects m_setRemovedObjects; Index: src/libchcore/DataBuffer.cpp =================================================================== diff -u -N -r71943917b6b34fa6e4f9045558c374322bddfd46 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/DataBuffer.cpp (.../DataBuffer.cpp) (revision 71943917b6b34fa6e4f9045558c374322bddfd46) +++ src/libchcore/DataBuffer.cpp (.../DataBuffer.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -18,8 +18,6 @@ ***************************************************************************/ #include "stdafx.h" #include "DataBuffer.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" @@ -31,29 +29,6 @@ memset(m_auiSizes, 0, sizeof(m_auiSizes)); } -void TBufferSizes::SerializeLoad(TReadBinarySerializer& rSerializer) -{ - using Serializers::Serialize; - - for(int iIndex = 0; iIndex < eBuffer_Last; ++iIndex) - { - Serialize(rSerializer, m_auiSizes[iIndex]); - } - Serialize(rSerializer, m_bOnlyDefault); -} - -void TBufferSizes::SerializeStore(TWriteBinarySerializer& rSerializer) -{ - using Serializers::Serialize; - - for(int iIndex = 0; iIndex < eBuffer_Last; ++iIndex) - { - Serialize(rSerializer, m_auiSizes[iIndex]); - } - - Serialize(rSerializer, m_bOnlyDefault); -} - bool TBufferSizes::operator==(const TBufferSizes& bsSizes) const { for(int iIndex = 0; iIndex < eBuffer_Last; ++iIndex) Index: src/libchcore/DataBuffer.h =================================================================== diff -u -N -rfdf4929dc7df1376ed439b7271765f1a4ca31de6 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/DataBuffer.h (.../DataBuffer.h) (revision fdf4929dc7df1376ed439b7271765f1a4ca31de6) +++ src/libchcore/DataBuffer.h (.../DataBuffer.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -34,10 +34,6 @@ #define ROUNDDOWN(number, to)\ (number & ~(to-1)) -class TReadBinarySerializer; -class TWriteBinarySerializer; - -//#pragma warning (disable: 4201) class LIBCHCORE_API TBufferSizes { public: @@ -56,9 +52,6 @@ public: TBufferSizes(); - void SerializeLoad(TReadBinarySerializer& rSerializer); - void SerializeStore(TWriteBinarySerializer& rSerializer); - bool operator==(const TBufferSizes& bsSizes) const; void Clear(); Index: src/libchcore/IColumnsDefinition.h =================================================================== diff -u -N -r7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision 7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66) +++ src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,6 +22,7 @@ #include "libchcore.h" #include "TString.h" #include +#include "TPath.h" BEGIN_CHCORE_NAMESPACE @@ -58,6 +59,26 @@ virtual bool IsEmpty() const = 0; }; +template struct ColumnType {}; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_bool; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_short; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_ushort; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_int; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_uint; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_long; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_ulong; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_longlong; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_ulonglong; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_double; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_string; }; +template<> struct ColumnType { static const IColumnsDefinition::ETypes value = IColumnsDefinition::eType_path; }; + +template +IColumnsDefinition::ETypes GetColumnType(const T&) +{ + return ColumnType::value; +} + END_CHCORE_NAMESPACE #endif Index: src/libchcore/ISerializerContainer.h =================================================================== diff -u -N -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/ISerializerContainer.h (.../ISerializerContainer.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/ISerializerContainer.h (.../ISerializerContainer.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,6 +22,7 @@ #include "libchcore.h" #include "IColumnsDefinition.h" #include "ISerializerRowReader.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -37,8 +38,8 @@ virtual IColumnsDefinition& GetColumnsDefinition() = 0; // prepare data to be stored - virtual ISerializerRowData& GetRow(size_t stRowID, bool bMarkAsAdded) = 0; - virtual void DeleteRow(size_t stRowID) = 0; + virtual ISerializerRowData& GetRow(object_id_t oidRowID, bool bMarkAsAdded) = 0; + virtual void DeleteRow(object_id_t oidRowID) = 0; virtual void DeleteRows(const TRemovedObjects& setObjects) = 0; // getting data from the serialized archive Index: src/libchcore/SerializationHelpers.h =================================================================== diff -u -N --- src/libchcore/SerializationHelpers.h (revision f46d334ffd78c7daa7626f214ae698adbac5f36d) +++ src/libchcore/SerializationHelpers.h (revision 0) @@ -1,124 +0,0 @@ -/*************************************************************************** -* Copyright (C) 2001-2011 by J�zef Starosczyk * -* ixen@copyhandler.com * -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU Library General Public License * -* (version 2) as published by the Free Software Foundation; * -* * -* This program is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public * -* License along with this program; if not, write to the * -* Free Software Foundation, Inc., * -* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * -***************************************************************************/ -#ifndef __SERIALIZATION_HELPERS_H__ -#define __SERIALIZATION_HELPERS_H__ - -#include "libchcore.h" -#include - -BEGIN_CHCORE_NAMESPACE - -namespace Serializers -{ - struct GeneralSerializer - { - template static void StoreValue(Serializer& rSerializer, const T& tValue) { tValue.Serialize(rSerializer); } - template static void LoadValue(Serializer& rSerializer, T& tValue) { tValue.Serialize(rSerializer); } - }; - - struct NativeSerializer - { - template static void StoreValue(Serializer& rSerializer, const T& tValue) { rSerializer.Store(tValue); } - template static void LoadValue(Serializer& rSerializer, T& tValue) { rSerializer.Load(tValue); } - }; - - struct EnumSerializer - { - template static void StoreValue(Serializer& rSerializer, const T& tValue) { Serialize(rSerializer, (int)tValue); } - template static void LoadValue(Serializer& rSerializer, T& tValue) { Serialize(rSerializer, *(int*)tValue); } - }; - - struct StlContainerSerializer - { - template static void StoreValue(Serializer& rSerializer, const T& tValue) - { - typedef typename T::value_type ItemType; - - Serialize(rSerializer, tValue.size()); - BOOST_FOREACH(const ItemType& rItem, tValue) - { - Serialize(rSerializer, rItem); - } - } - template static void LoadValue(Serializer& rSerializer, T& tValue) - { - typedef typename T::value_type ItemType; - ItemType item; - - size_t stCount = 0; - Serialize(rSerializer, stCount); - while(stCount--) - { - Serialize(rSerializer, item); - - std::back_inserter(tValue) = item; - } - } - }; - - template - struct is_serializer_native_type - { - static const bool value = boost::mpl::has_key::value; - }; - - // Main interface for serialization - template - inline void Serialize(TReadBinarySerializer& rSerializer, T& tValue) - { - typedef typename - boost::mpl::if_, EnumSerializer, - boost::mpl::if_, StlContainerSerializer, - boost::mpl::if_, NativeSerializer, - GeneralSerializer>::type >::type >::type SerializerType; - SerializerType::LoadValue(rSerializer, tValue); - } - - template - inline void Serialize(TWriteBinarySerializer& rSerializer, const T& tValue) - { - typedef typename - boost::mpl::if_, EnumSerializer, - boost::mpl::if_, StlContainerSerializer, - boost::mpl::if_, NativeSerializer, - GeneralSerializer>::type >::type >::type SerializerType; - SerializerType::StoreValue(rSerializer, tValue); - } - -#ifdef _MFC_VER - template<> - inline void Serialize(TReadBinarySerializer& rSerializer, CString& tValue) - { - TString strVal; - Serialize(rSerializer, strVal); - tValue = strVal; - } - - template<> - inline void Serialize(TWriteBinarySerializer& rSerializer, const CString& tValue) - { - Serialize(rSerializer, (PCTSTR)tValue); - } - -#endif -} - -END_CHCORE_NAMESPACE - -#endif Index: src/libchcore/SerializerDataTypes.h =================================================================== diff -u -N --- src/libchcore/SerializerDataTypes.h (revision 0) +++ src/libchcore/SerializerDataTypes.h (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -0,0 +1,28 @@ +// ============================================================================ +// Copyright (C) 2001-2014 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#ifndef __SERIALIZERDATATYPES_H__ +#define __SERIALIZERDATATYPES_H__ + +BEGIN_CHCORE_NAMESPACE + +typedef unsigned long object_id_t; + +END_CHCORE_NAMESPACE + +#endif Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,22 +22,21 @@ // ============================================================================ #include "stdafx.h" #include "TBasePathData.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" #include "ISerializerContainer.h" #include "ISerializerRowData.h" #include #include "TPathContainer.h" +#include BEGIN_CHCORE_NAMESPACE ////////////////////////////////////////////////////////////////////////////// // TBasePathData TBasePathData::TBasePathData() : - m_stObjectID(0), + m_oidObjectID(0), m_pathSrc(m_setModifications), m_bSkipFurtherProcessing(m_setModifications, false), m_pathDst(m_setModifications) @@ -46,16 +45,16 @@ } TBasePathData::TBasePathData(const TBasePathData& rEntry) : - m_stObjectID(rEntry.m_stObjectID), + m_oidObjectID(rEntry.m_oidObjectID), m_pathSrc(rEntry.m_pathSrc), m_pathDst(rEntry.m_pathDst), m_bSkipFurtherProcessing(rEntry.m_bSkipFurtherProcessing), m_setModifications(rEntry.m_setModifications) { } -TBasePathData::TBasePathData(size_t stObjectID, const TSmartPath& spSrcPath) : - m_stObjectID(stObjectID), +TBasePathData::TBasePathData(object_id_t oidObjectID, const TSmartPath& spSrcPath) : + m_oidObjectID(oidObjectID), m_pathSrc(m_setModifications, spSrcPath), m_bSkipFurtherProcessing(m_setModifications, false), m_pathDst(m_setModifications) @@ -96,7 +95,7 @@ bool bAdded = m_setModifications[eMod_Added]; if(m_setModifications.any()) { - ISerializerRowData& rRow = spContainer->GetRow(m_stObjectID, bAdded); + ISerializerRowData& rRow = spContainer->GetRow(m_oidObjectID, bAdded); if(bAdded || m_setModifications[eMod_SrcPath]) rRow.SetValue(_T("src_path"), m_pathSrc); if(bAdded || m_setModifications[eMod_SkipProcessing]) @@ -110,15 +109,15 @@ void TBasePathData::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("src_path"), IColumnsDefinition::eType_path); rColumns.AddColumn(_T("skip_processing"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("dst_path"), IColumnsDefinition::eType_path); } void TBasePathData::Load(const ISerializerRowReaderPtr& spRowReader) { - spRowReader->GetValue(_T("id"), m_stObjectID); + spRowReader->GetValue(_T("id"), m_oidObjectID); spRowReader->GetValue(_T("src_path"), m_pathSrc.Modify()); spRowReader->GetValue(_T("skip_processing"), m_bSkipFurtherProcessing.Modify()); spRowReader->GetValue(_T("dst_path"), m_pathDst.Modify()); @@ -135,21 +134,21 @@ m_pathSrc = pathSrc; } -size_t TBasePathData::GetObjectID() const +object_id_t TBasePathData::GetObjectID() const { - return m_stObjectID; + return m_oidObjectID; } -void TBasePathData::SetObjectID(size_t stObjectID) +void TBasePathData::SetObjectID(object_id_t oidObjectID) { - m_stObjectID = stObjectID; + m_oidObjectID = oidObjectID; } ////////////////////////////////////////////////////////////////////////////// // TBasePathDataContainer TBasePathDataContainer::TBasePathDataContainer() : - m_stLastObjectID(0) + m_oidLastObjectID(0) { } @@ -203,24 +202,24 @@ void TBasePathDataContainer::Add(const TBasePathDataPtr& spEntry) { boost::unique_lock lock(m_lock); - spEntry->SetObjectID(++m_stLastObjectID); + spEntry->SetObjectID(++m_oidLastObjectID); m_vEntries.push_back(spEntry); } -void TBasePathDataContainer::RemoveAt(size_t stIndex) +void TBasePathDataContainer::RemoveAt(file_count_t fcIndex) { boost::unique_lock lock(m_lock); - if(stIndex >= m_vEntries.size()) + if(fcIndex >= m_vEntries.size()) THROW_CORE_EXCEPTION(eErr_BoundsExceeded); - m_setRemovedObjects.Add(m_vEntries[stIndex]->GetObjectID()); - m_vEntries.erase(m_vEntries.begin() + stIndex); + m_setRemovedObjects.Add(m_vEntries[boost::numeric_cast(fcIndex)]->GetObjectID()); + m_vEntries.erase(m_vEntries.begin() + boost::numeric_cast(fcIndex)); } -TBasePathDataPtr TBasePathDataContainer::GetAt(size_t stIndex) const +TBasePathDataPtr TBasePathDataContainer::GetAt(file_count_t fcIndex) const { boost::shared_lock lock(m_lock); - return m_vEntries.at(stIndex); + return m_vEntries.at(boost::numeric_cast(fcIndex)); } @@ -259,10 +258,10 @@ return m_vEntries.empty(); } -size_t TBasePathDataContainer::GetCount() const +file_count_t TBasePathDataContainer::GetCount() const { boost::shared_lock lock(m_lock); - return m_vEntries.size(); + return boost::numeric_cast(m_vEntries.size()); } TBasePathDataContainer& TBasePathDataContainer::operator=(const TPathContainer& tPaths) @@ -272,7 +271,7 @@ for(size_t stIndex = 0; stIndex < tPaths.GetCount(); ++stIndex) { - TBasePathDataPtr spPathData = boost::make_shared(++m_stLastObjectID, tPaths.GetAt(stIndex)); + TBasePathDataPtr spPathData = boost::make_shared(++m_oidLastObjectID, tPaths.GetAt(stIndex)); m_vEntries.push_back(spPathData); } Index: src/libchcore/TBasePathData.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -31,6 +31,7 @@ #include "ISerializerRowData.h" #include "IColumnsDefinition.h" #include "ISerializerRowReader.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -53,11 +54,11 @@ public: TBasePathData(); - TBasePathData(size_t stObjectID, const TSmartPath& spSrcPath); + TBasePathData(object_id_t oidObjectID, const TSmartPath& spSrcPath); TBasePathData(const TBasePathData& rEntry); - size_t GetObjectID() const; - void SetObjectID(size_t stObjectID); + object_id_t GetObjectID() const; + void SetObjectID(object_id_t oidObjectID); TSmartPath GetSrcPath() const; void SetSrcPath(const TSmartPath& pathSrc); @@ -81,7 +82,7 @@ mutable BitSet m_setModifications; // attributes - size_t m_stObjectID; + object_id_t m_oidObjectID; TSharedModificationTracker m_pathSrc; TSharedModificationTracker m_bSkipFurtherProcessing; // specifies if the path should be (or not) processed further TSharedModificationTracker m_pathDst; @@ -104,14 +105,14 @@ // standard access to data void Add(const TBasePathDataPtr& spEntry); - void RemoveAt(size_t stIndex); - TBasePathDataPtr GetAt(size_t stIndex) const; - TBasePathDataPtr FindByID(size_t stObjectID) const; + void RemoveAt(file_count_t fcIndex); + TBasePathDataPtr GetAt(file_count_t fcIndex) const; + TBasePathDataPtr FindByID(size_t fcObjectID) const; void Clear(); bool IsEmpty() const; - size_t GetCount() const; + file_count_t GetCount() const; void Store(const ISerializerContainerPtr& spContainer) const; void Load(const ISerializerContainerPtr& spContainer); @@ -133,7 +134,7 @@ mutable boost::shared_mutex m_lock; #pragma warning(pop) - size_t m_stLastObjectID; + object_id_t m_oidLastObjectID; }; typedef boost::shared_ptr TBasePathDataContainerPtr; Index: src/libchcore/TBinarySerializer.cpp =================================================================== diff -u -N --- src/libchcore/TBinarySerializer.cpp (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TBinarySerializer.cpp (revision 0) @@ -1,495 +0,0 @@ -// ============================================================================ -// Copyright (C) 2001-2011 by Jozef Starosczyk -// ixen@copyhandler.com -// -// This program is free software you can redistribute it and/or modify -// it under the terms of the GNU Library General Public License -// (version 2) as published by the Free Software Foundation -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Library General Public -// License along with this program if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// ============================================================================ -/// @file TBinarySerializer.h -/// @date 2011/06/20 -/// @brief Contains declaration of TBinarySerializer class. -// ============================================================================ -#include "stdafx.h" -#include "TBinarySerializer.h" -#include -#include - -#include "TPath.h" -#include "ErrorCodes.h" -#include "TCoreException.h" - -BEGIN_CHCORE_NAMESPACE - -///////////////////////////////////////////////////////////////////////////////////////// -// class TReadBinarySerializer - -TReadBinarySerializer::TReadBinarySerializer() -{ -} - -TReadBinarySerializer::~TReadBinarySerializer() -{ - try - { - Close(); - } - catch(...) - { - } -} - -void TReadBinarySerializer::Init(const TSmartPath& pathFile) -{ - Close(); - - try - { - m_spInputStream = boost::make_shared(pathFile.ToString(), std::ios_base::in | std::ios_base::binary); - m_spArchive = boost::make_shared(std::tr1::ref(*m_spInputStream)); - } - catch(std::exception& e) - { - m_spArchive.reset(); - m_spInputStream.reset(); - - THROW_CORE_EXCEPTION_STD(eErr_CannotReadArchive, e); - } -} - -void TReadBinarySerializer::Close() -{ - // order is important - first close the archive, then input stream - m_spArchive.reset(); - m_spInputStream.reset(); -} - -void TReadBinarySerializer::Load(bool& bValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & bValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(short& shValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & shValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(unsigned short& ushValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ushValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(int& iValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & iValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(unsigned int& uiValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & uiValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(long& lValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & lValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(unsigned long& ulValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ulValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(long long& llValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & llValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(unsigned long long& ullValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ullValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(float& fValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & fValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(double& dValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & dValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -void TReadBinarySerializer::Load(TString& strValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - std::wstring wstrData; - (*m_spArchive) & wstrData; - strValue = wstrData.c_str(); - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeLoadError, e); - } -} - -///////////////////////////////////////////////////////////////////////////////////////// -// class TWriteBinarySerializer - -TWriteBinarySerializer::TWriteBinarySerializer() -{ -} - -TWriteBinarySerializer::~TWriteBinarySerializer() -{ - try - { - Close(); - } - catch(...) - { - } -} - -void TWriteBinarySerializer::Init(const TSmartPath& pathFile) -{ - try - { - m_spOutputStream = boost::make_shared(pathFile.ToString(), std::ios_base::out | std::ios_base::binary); - m_spArchive = boost::make_shared(std::tr1::ref(*m_spOutputStream)); - } - catch(std::exception&) - { - m_spArchive.reset(); - m_spOutputStream.reset(); - THROW_CORE_EXCEPTION(eErr_CannotWriteArchive); - } -} - -void TWriteBinarySerializer::Close() -{ - m_spArchive.reset(); - m_spOutputStream.reset(); -} - -void TWriteBinarySerializer::Store(bool bValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & bValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(short shValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & shValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(unsigned short ushValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ushValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(int iValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & iValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(unsigned int uiValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & uiValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(long lValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & lValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(unsigned long ulValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ulValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(long long llValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & llValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(unsigned long long ullValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & ullValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(float fValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & fValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(double dValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - (*m_spArchive) & dValue; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(const TString& strValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - std::wstring wstrData(strValue.c_str()); - (*m_spArchive) & wstrData; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -void TWriteBinarySerializer::Store(const wchar_t* strValue) -{ - if(!m_spArchive) - THROW_CORE_EXCEPTION(eErr_UseOfUninitializedObject); - - try - { - std::wstring wstrData(strValue); - (*m_spArchive) & wstrData; - } - catch (std::exception& e) - { - THROW_CORE_EXCEPTION_STD(eErr_SerializeStoreError, e); - } -} - -END_CHCORE_NAMESPACE Index: src/libchcore/TBinarySerializer.h =================================================================== diff -u -N --- src/libchcore/TBinarySerializer.h (revision dd61ac70dd276425fe97970b49b6854d02bfcc87) +++ src/libchcore/TBinarySerializer.h (revision 0) @@ -1,110 +0,0 @@ -// ============================================================================ -// Copyright (C) 2001-2011 by Jozef Starosczyk -// ixen@copyhandler.com -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU Library General Public License -// (version 2) as published by the Free Software Foundation; -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU Library General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., -// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// ============================================================================ -/// @file TBinarySerializer.h -/// @date 2011/06/20 -/// @brief Contains declaration of TBinarySerializer class. -// ============================================================================ -#ifndef __TBINARYSERIALIZER_H__ -#define __TBINARYSERIALIZER_H__ - -#include "libchcore.h" -#include -#include -#include -#pragma warning(push) -#pragma warning(disable: 4996 4310 4244) - #include - #include -#pragma warning(pop) - -BEGIN_CHCORE_NAMESPACE - -class TSmartPath; -class TString; - -class LIBCHCORE_API TReadBinarySerializer -{ -public: - typedef boost::mpl::set NativeTypes; - -public: - TReadBinarySerializer(); - ~TReadBinarySerializer(); - - void Init(const TSmartPath& pathFile); - void Close(); - - void Load(bool& bValue); - void Load(short& shValue); - void Load(unsigned short& ushValue); - void Load(int& iValue); - void Load(unsigned int& uiValue); - void Load(long& lValue); - void Load(unsigned long& ulValue); - void Load(long long& llValue); - void Load(unsigned long long& ullValue); - void Load(float& fValue); - void Load(double& dValue); - void Load(TString& strValue); - -private: -#pragma warning(push) -#pragma warning(disable: 4251) - boost::shared_ptr m_spInputStream; - boost::shared_ptr m_spArchive; -#pragma warning(pop) -}; - -class LIBCHCORE_API TWriteBinarySerializer -{ -public: - typedef boost::mpl::set NativeTypes; - -public: - TWriteBinarySerializer(); - ~TWriteBinarySerializer(); - - void Init(const TSmartPath& pathFile); - void Close(); - - void Store(bool bValue); - void Store(short shValue); - void Store(unsigned short ushValue); - void Store(int iValue); - void Store(unsigned int uiValue); - void Store(long lValue); - void Store(unsigned long ulValue); - void Store(long long llValue); - void Store(unsigned long long ullValue); - void Store(float fValue); - void Store(double dValue); - void Store(const TString& strValue); - void Store(const wchar_t* strValue); - -private: -#pragma warning(push) -#pragma warning(disable: 4251) - boost::shared_ptr m_spOutputStream; - boost::shared_ptr m_spArchive; -#pragma warning(pop) -}; - -END_CHCORE_NAMESPACE - -#endif Index: src/libchcore/TConfig.cpp =================================================================== diff -u -N -r5324d0ca7af614cb066df1f121a7a338c4f7d7ed -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision 5324d0ca7af614cb066df1f121a7a338c4f7d7ed) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -150,7 +150,7 @@ bool bAdded = rNode.m_setModifications[ConfigNode::eMod_Added]; if(rNode.m_setModifications.any()) { - ISerializerRowData& rRow = spContainer->GetRow(rNode.m_stObjectID, bAdded); + ISerializerRowData& rRow = spContainer->GetRow(rNode.m_oidObjectID, bAdded); if(bAdded || rNode.m_setModifications[ConfigNode::eMod_NodeName]) rRow.SetValue(_T("name"), rNode.GetNodeName()); if(bAdded || rNode.m_setModifications[ConfigNode::eMod_Order]) @@ -195,7 +195,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("name"), IColumnsDefinition::eType_string); rColumns.AddColumn(_T("node_order"), IColumnsDefinition::eType_int); rColumns.AddColumn(_T("value"), IColumnsDefinition::eType_string); Index: src/libchcore/TDateTime.cpp =================================================================== diff -u -N -r6a71d60b7ab5489db9ffc75784557e713df9a52f -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision 6a71d60b7ab5489db9ffc75784557e713df9a52f) +++ src/libchcore/TDateTime.cpp (.../TDateTime.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,8 +22,6 @@ // ============================================================================ #include "stdafx.h" #include "TDateTime.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" @@ -216,16 +214,6 @@ return rConfig.GetValue(pszNodeName, m_tTime); } -void TDateTime::Serialize(TReadBinarySerializer& rSerializer) -{ - Serializers::Serialize(rSerializer, m_tTime); -} - -void TDateTime::Serialize(TWriteBinarySerializer& rSerializer) const -{ - Serializers::Serialize(rSerializer, m_tTime); -} - time_t TDateTime::GetAsTimeT() const { return m_tTime; Index: src/libchcore/TDateTime.h =================================================================== diff -u -N -rb193a95402f2bf4c456fb9d65d111caaf6994823 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TDateTime.h (.../TDateTime.h) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TDateTime.h (.../TDateTime.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -29,8 +29,6 @@ BEGIN_CHCORE_NAMESPACE class TConfig; -class TReadBinarySerializer; -class TWriteBinarySerializer; class LIBCHCORE_API TDateTime { @@ -64,9 +62,6 @@ void StoreInConfig(TConfig& rConfig, PCTSTR pszNodeName) const; bool ReadFromConfig(const TConfig& rConfig, PCTSTR pszNodeName); - void Serialize(TReadBinarySerializer& rSerializer); - void Serialize(TWriteBinarySerializer& rSerializer) const; - private: time_t m_tTime; }; Index: src/libchcore/TFileFilter.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -20,8 +20,6 @@ #include "TFileFilter.h" #include "TFileInfo.h" #include "TConfig.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" BEGIN_CHCORE_NAMESPACE @@ -33,7 +31,7 @@ } TFileFilter::TFileFilter() : - m_stObjectID(0), + m_oidObjectID(0), m_setModifications(), m_bUseMask(m_setModifications, false), m_astrMask(m_setModifications), @@ -70,7 +68,7 @@ } TFileFilter::TFileFilter(const TFileFilter& rFilter) : - m_stObjectID(rFilter.m_stObjectID), + m_oidObjectID(rFilter.m_oidObjectID), m_setModifications(rFilter.m_setModifications), m_bUseMask(rFilter.m_bUseMask, m_setModifications), m_astrMask(rFilter.m_astrMask, m_setModifications), @@ -107,7 +105,7 @@ if(this == &rFilter) return *this; - m_stObjectID = rFilter.m_stObjectID; + m_oidObjectID = rFilter.m_oidObjectID; m_setModifications = rFilter.m_setModifications; // files mask @@ -538,7 +536,7 @@ void TFileFilter::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("use_mask"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("mask"), IColumnsDefinition::eType_string); rColumns.AddColumn(_T("use_exclude_mask"), IColumnsDefinition::eType_bool); @@ -573,7 +571,7 @@ bool bAdded = m_setModifications[eMod_Added]; if(m_setModifications.any()) { - ISerializerRowData& rRow = spContainer->GetRow(m_stObjectID, bAdded); + ISerializerRowData& rRow = spContainer->GetRow(m_oidObjectID, bAdded); if(bAdded || m_setModifications[eMod_UseMask]) rRow.SetValue(_T("use_mask"), m_bUseMask); @@ -674,14 +672,14 @@ m_setModifications.reset(); } -size_t TFileFilter::GetObjectID() const +object_id_t TFileFilter::GetObjectID() const { - return m_stObjectID; + return m_oidObjectID; } -void TFileFilter::SetObjectID(size_t stObjectID) +void TFileFilter::SetObjectID(object_id_t oidObjectID) { - m_stObjectID = stObjectID; + m_oidObjectID = oidObjectID; } void TFileFilter::ResetModifications() Index: src/libchcore/TFileFilter.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileFilter.h (.../TFileFilter.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TFileFilter.h (.../TFileFilter.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -74,16 +74,13 @@ void StoreInConfig(TConfig& rConfig) const; void ReadFromConfig(const TConfig& rConfig); - void Serialize(TReadBinarySerializer& rSerializer); - void Serialize(TWriteBinarySerializer& rSerializer) const; - void Store(const ISerializerContainerPtr& spContainer) const; void Load(const ISerializerRowReaderPtr& spRowReader); static void InitColumns(IColumnsDefinition& rColumns); // other - size_t GetObjectID() const; - void SetObjectID(size_t stObjectID); + object_id_t GetObjectID() const; + void SetObjectID(object_id_t oidObjectID); void ResetModifications(); // atrributes access @@ -218,7 +215,7 @@ }; // object identification - size_t m_stObjectID; + object_id_t m_oidObjectID; // modification management #pragma warning(push) Index: src/libchcore/TFileFiltersArray.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileFiltersArray.cpp (.../TFileFiltersArray.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TFileFiltersArray.cpp (.../TFileFiltersArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -20,8 +20,6 @@ #include "TFileFiltersArray.h" #include "TFileInfo.h" #include "TConfig.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TConfigArray.h" BEGIN_CHCORE_NAMESPACE Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -40,7 +40,7 @@ m_ftLastAccess(m_setModifications), m_ftLastWrite(m_setModifications), m_uiFlags(m_setModifications, 0), - m_stObjectID(0) + m_oidObjectID(0) { m_setModifications[eMod_Added] = true; } @@ -54,7 +54,7 @@ m_ftLastAccess(rSrc.m_ftLastAccess), m_ftLastWrite(rSrc.m_ftLastWrite), m_uiFlags(rSrc.m_uiFlags), - m_stObjectID(rSrc.m_stObjectID) + m_oidObjectID(rSrc.m_oidObjectID) { } @@ -74,7 +74,7 @@ m_ftLastAccess = rSrc.m_ftLastAccess; m_ftLastWrite = rSrc.m_ftLastWrite; m_uiFlags = rSrc.m_uiFlags; - m_stObjectID = rSrc.m_stObjectID; + m_oidObjectID = rSrc.m_oidObjectID; } return *this; @@ -141,11 +141,11 @@ return m_pathFile; } -size_t TFileInfo::GetSrcObjectID() const +object_id_t TFileInfo::GetSrcObjectID() const { if(m_spBasePathData.Get()) return m_spBasePathData.Get()->GetObjectID(); - return std::numeric_limits::max(); + return (object_id_t)-1; } TBasePathDataPtr TFileInfo::GetBasePathData() const @@ -250,7 +250,7 @@ { if(m_setModifications.any()) { - ISerializerRowData& rRow = spContainer->GetRow(m_stObjectID, m_setModifications[eMod_Added]); + ISerializerRowData& rRow = spContainer->GetRow(m_oidObjectID, m_setModifications[eMod_Added]); if(m_setModifications[eMod_Path]) rRow.SetValue(_T("rel_path"), m_pathFile); @@ -275,9 +275,9 @@ void TFileInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("rel_path"), IColumnsDefinition::eType_path); - rColumns.AddColumn(_T("base_path_id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("base_path_id"), ColumnType::value); rColumns.AddColumn(_T("attr"), IColumnsDefinition::eType_ulong); rColumns.AddColumn(_T("size"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("time_created"), IColumnsDefinition::eType_ulonglong); @@ -290,7 +290,7 @@ { size_t stBaseObjectID = 0; unsigned long long ullTime = 0; - spRowReader->GetValue(_T("id"), m_stObjectID); + spRowReader->GetValue(_T("id"), m_oidObjectID); spRowReader->GetValue(_T("rel_path"), m_pathFile.Modify()); spRowReader->GetValue(_T("base_path_id"), stBaseObjectID); spRowReader->GetValue(_T("attr"), m_dwAttributes.Modify()); @@ -312,14 +312,14 @@ m_setModifications.reset(); } -size_t TFileInfo::GetObjectID() const +object_id_t TFileInfo::GetObjectID() const { - return m_stObjectID; + return m_oidObjectID; } -void TFileInfo::SetObjectID(size_t stObjectID) +void TFileInfo::SetObjectID(object_id_t oidObjectID) { - m_stObjectID = stObjectID; + m_oidObjectID = oidObjectID; } END_CHCORE_NAMESPACE Index: src/libchcore/TFileInfo.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -62,13 +62,13 @@ FILETIME ftLastAccess, FILETIME ftLastWrite, uint_t uiFlags); // unique object id - size_t GetObjectID() const; - void SetObjectID(size_t stObjectID); + object_id_t GetObjectID() const; + void SetObjectID(object_id_t oidObjectID); // parent object TBasePathDataPtr GetBasePathData() const; void SetParentObject(const TBasePathDataPtr& spBasePathData); - size_t GetSrcObjectID() const; + object_id_t GetSrcObjectID() const; // file path const TSmartPath& GetFilePath() const; // returns path with m_pathFile (probably not full) @@ -125,7 +125,7 @@ typedef std::bitset Bitset; mutable Bitset m_setModifications; - size_t m_stObjectID; + object_id_t m_oidObjectID; TSharedModificationTracker m_pathFile; TSharedModificationTracker m_spBasePathData; Index: src/libchcore/TFileInfoArray.cpp =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,18 +22,17 @@ #include #include "TFileInfoArray.h" #include "../libicpf/exception.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TFileInfo.h" #include "ISerializerContainer.h" +#include BEGIN_CHCORE_NAMESPACE /////////////////////////////////////////////////////////////////////// // Array TFileInfoArray::TFileInfoArray() : m_bComplete(false), - m_stLastObjectID(0) + m_oidLastObjectID(0) { } @@ -44,33 +43,33 @@ void TFileInfoArray::AddFileInfo(const TFileInfoPtr& spFileInfo) { boost::unique_lock lock(m_lock); - spFileInfo->SetObjectID(++m_stLastObjectID); + spFileInfo->SetObjectID(++m_oidLastObjectID); m_vFiles.push_back(spFileInfo); } -size_t TFileInfoArray::GetSize() const +file_count_t TFileInfoArray::GetSize() const { boost::shared_lock lock(m_lock); - return m_vFiles.size(); + return boost::numeric_cast(m_vFiles.size()); } -TFileInfoPtr TFileInfoArray::GetAt(size_t stIndex) const +TFileInfoPtr TFileInfoArray::GetAt(file_count_t fcIndex) const { boost::shared_lock lock(m_lock); - if(stIndex >= m_vFiles.size()) + if(fcIndex >= m_vFiles.size()) THROW(_T("Out of bounds"), 0, 0, 0); - return m_vFiles.at(stIndex); + return m_vFiles.at(boost::numeric_cast(fcIndex)); } -TFileInfo TFileInfoArray::GetCopyAt(size_t stIndex) const +TFileInfo TFileInfoArray::GetCopyAt(file_count_t fcIndex) const { boost::shared_lock lock(m_lock); - if(stIndex >= m_vFiles.size()) + if(fcIndex >= m_vFiles.size()) THROW(_T("Out of bounds"), 0, 0, 0); - const TFileInfoPtr& spInfo = m_vFiles.at(stIndex); + const TFileInfoPtr& spInfo = m_vFiles.at(boost::numeric_cast(fcIndex)); if(!spInfo) THROW(_T("Invalid pointer"), 0, 0, 0); @@ -113,15 +112,15 @@ return m_bComplete; } -unsigned long long TFileInfoArray::CalculatePartialSize(size_t stCount) +unsigned long long TFileInfoArray::CalculatePartialSize(file_count_t fcCount) { unsigned long long ullSize = 0; boost::shared_lock lock(m_lock); - if(stCount > m_vFiles.size()) + if(fcCount > m_vFiles.size()) THROW(_T("Invalid argument"), 0, 0, 0); - for(std::vector::iterator iter = m_vFiles.begin(); iter != m_vFiles.begin() + stCount; ++iter) + for(std::vector::iterator iter = m_vFiles.begin(); iter != m_vFiles.begin() + boost::numeric_cast(fcCount); ++iter) { ullSize += (*iter)->GetLength64(); } @@ -162,7 +161,7 @@ vEntries.push_back(spFileInfo); - m_stLastObjectID = std::max(m_stLastObjectID, spFileInfo->GetObjectID()); + m_oidLastObjectID = std::max(m_oidLastObjectID, spFileInfo->GetObjectID()); } boost::unique_lock lock(m_lock); Index: src/libchcore/TFileInfoArray.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TFileInfoArray.h (.../TFileInfoArray.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TFileInfoArray.h (.../TFileInfoArray.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -25,6 +25,7 @@ #include "libchcore.h" #include "TPath.h" #include "TBasePathData.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -41,20 +42,20 @@ void AddFileInfo(const TFileInfoPtr& spFileInfo); /// Retrieves count of elements in this object - size_t GetSize() const; + file_count_t GetSize() const; /// Retrieves an element at the specified index - TFileInfoPtr GetAt(size_t stIndex) const; + TFileInfoPtr GetAt(file_count_t stIndex) const; /// Retrieves a copy of the element at a specified index - TFileInfo GetCopyAt(size_t stIndex) const; + TFileInfo GetCopyAt(file_count_t stIndex) const; /// Removes all elements from this object void Clear(); // specialized operations on contents of m_vFiles - /// Calculates the size of the first stCount file info objects - unsigned long long CalculatePartialSize(size_t stCount); + /// Calculates the size of the first fcCount file info objects + unsigned long long CalculatePartialSize(file_count_t fcCount); /// Calculates the size of all file info objects inside this object unsigned long long CalculateTotalSize() const; @@ -76,7 +77,7 @@ std::vector m_vFiles; mutable boost::shared_mutex m_lock; #pragma warning(pop) - size_t m_stLastObjectID; + object_id_t m_oidLastObjectID; }; END_CHCORE_NAMESPACE Index: src/libchcore/TModPathContainer.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -33,7 +33,7 @@ // ============================================================================ TModPathContainer::TModPathContainer() : m_vPaths(), - m_stNextObjectID(1) + m_oidNextObjectID(1) { } @@ -46,7 +46,7 @@ // ============================================================================ TModPathContainer::TModPathContainer(const TModPathContainer& rSrcContainer) : m_vPaths(rSrcContainer.m_vPaths), - m_stNextObjectID(rSrcContainer.m_stNextObjectID) + m_oidNextObjectID(rSrcContainer.m_oidNextObjectID) { } @@ -73,7 +73,7 @@ if(this != &rSrcContainer) { m_vPaths = rSrcContainer.m_vPaths; - m_stNextObjectID = rSrcContainer.m_stNextObjectID; + m_oidNextObjectID = rSrcContainer.m_oidNextObjectID; } return *this; @@ -85,7 +85,7 @@ for(size_t stIndex = 0; stIndex < rSrcContainer.GetCount(); ++stIndex) { - m_vPaths.insert(std::make_pair(m_stNextObjectID++, TModificationTracker(rSrcContainer.GetAt(stIndex), true))); + m_vPaths.insert(std::make_pair(m_oidNextObjectID++, TModificationTracker(rSrcContainer.GetAt(stIndex), true))); } return *this; @@ -100,7 +100,7 @@ // ============================================================================ void TModPathContainer::Add(const TSmartPath& spPath) { - m_vPaths.insert(std::make_pair(m_stNextObjectID++, TModificationTracker(spPath, true))); + m_vPaths.insert(std::make_pair(m_oidNextObjectID++, TModificationTracker(spPath, true))); } // ============================================================================ @@ -137,7 +137,7 @@ return iter->second.Modify(); } -size_t TModPathContainer::GetOidAt(size_t stIndex) const +object_id_t TModPathContainer::GetOidAt(size_t stIndex) const { if(stIndex > m_vPaths.size()) THROW_CORE_EXCEPTION(eErr_BoundsExceeded); @@ -198,7 +198,7 @@ else { m_setRemovedItems.Clear(); - m_stNextObjectID = 1; + m_oidNextObjectID = 1; } m_vPaths.clear(); @@ -228,29 +228,29 @@ return m_vPaths.empty(); } -const TSmartPath& TModPathContainer::GetAtOid(size_t stObjectID) const +const TSmartPath& TModPathContainer::GetAtOid(object_id_t oidObjectID) const { - return m_vPaths.at(stObjectID); + return m_vPaths.at(oidObjectID); } -TSmartPath& TModPathContainer::GetAtOid(size_t stObjectID) +TSmartPath& TModPathContainer::GetAtOid(object_id_t oidObjectID) { - return m_vPaths.at(stObjectID).Modify(); + return m_vPaths.at(oidObjectID).Modify(); } -void TModPathContainer::SetByOid(size_t stObjectID, const TSmartPath& spPath) +void TModPathContainer::SetByOid(object_id_t oidObjectID, const TSmartPath& spPath) { - DataMap::iterator iterFnd = m_vPaths.find(stObjectID); + DataMap::iterator iterFnd = m_vPaths.find(oidObjectID); if(iterFnd != m_vPaths.end()) iterFnd->second = spPath; else - m_vPaths.insert(std::make_pair(stObjectID, TModificationTracker(spPath, true))); + m_vPaths.insert(std::make_pair(oidObjectID, TModificationTracker(spPath, true))); } -void TModPathContainer::DeleteOid(size_t stObjectID) +void TModPathContainer::DeleteOid(object_id_t oidObjectID) { - m_vPaths.erase(stObjectID); - m_setRemovedItems.Add(stObjectID); + m_vPaths.erase(oidObjectID); + m_setRemovedItems.Add(oidObjectID); } bool TModPathContainer::HasModifications() const @@ -306,20 +306,20 @@ { m_setRemovedItems.Clear(); m_vPaths.clear(); - m_stNextObjectID = 1; + m_oidNextObjectID = 1; InitColumns(spContainer); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); while(spRowReader->Next()) { - size_t stObjectID = 0; + object_id_t oidObjectID = 0; TSmartPath path; - spRowReader->GetValue(_T("id"), stObjectID); + spRowReader->GetValue(_T("id"), oidObjectID); spRowReader->GetValue(_T("path"), path); - m_vPaths.insert(std::make_pair(stObjectID, TModificationTracker(path, false))); + m_vPaths.insert(std::make_pair(oidObjectID, TModificationTracker(path, false))); } ClearModifications(); @@ -330,7 +330,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("path"), IColumnsDefinition::eType_path); } } Index: src/libchcore/TModPathContainer.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TModPathContainer.h (.../TModPathContainer.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TModPathContainer.h (.../TModPathContainer.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -43,19 +43,19 @@ const TSmartPath& GetAt(size_t stIndex) const; TSmartPath& GetAt(size_t stIndex); - size_t GetOidAt(size_t stIndex) const; + object_id_t GetOidAt(size_t stIndex) const; void SetAt(size_t stIndex, const TSmartPath& spPath); void DeleteAt(size_t stIndex); #pragma endregion #pragma region Object id-based interface - const TSmartPath& GetAtOid(size_t stObjectID) const; - TSmartPath& GetAtOid(size_t stObjectID); + const TSmartPath& GetAtOid(object_id_t oidObjectID) const; + TSmartPath& GetAtOid(object_id_t oidObjectID); - void SetByOid(size_t stObjectID, const TSmartPath& spPath); - void DeleteOid(size_t stObjectID); + void SetByOid(object_id_t oidObjectID, const TSmartPath& spPath); + void DeleteOid(object_id_t oidObjectID); #pragma endregion #pragma region Generic interface @@ -82,10 +82,10 @@ #pragma warning(push) #pragma warning(disable: 4251) mutable TRemovedObjects m_setRemovedItems; - typedef boost::container::flat_map > DataMap; + typedef boost::container::flat_map > DataMap; DataMap m_vPaths; #pragma warning(pop) - size_t m_stNextObjectID; + object_id_t m_oidNextObjectID; }; END_CHCORE_NAMESPACE Index: src/libchcore/TRemovedObjects.cpp =================================================================== diff -u -N -r293e52b38d46653068006262172018a0f0d0a31c -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TRemovedObjects.cpp (.../TRemovedObjects.cpp) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TRemovedObjects.cpp (.../TRemovedObjects.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -29,25 +29,24 @@ TRemovedObjects::~TRemovedObjects() { - } -void TRemovedObjects::Add(size_t stObjectID) +void TRemovedObjects::Add(object_id_t oidObjectID) { - m_setObjects.insert(stObjectID); + m_setObjects.insert(oidObjectID); } size_t TRemovedObjects::GetCount() const { return m_setObjects.size(); } -size_t TRemovedObjects::GetAt(size_t stIndex) const +object_id_t TRemovedObjects::GetAt(size_t stIndex) const { if(stIndex >= m_setObjects.size()) THROW_CORE_EXCEPTION(eErr_InvalidArgument); - std::set::const_iterator iter = m_setObjects.begin(); + std::set::const_iterator iter = m_setObjects.begin(); std::advance(iter, stIndex); return *iter; } Index: src/libchcore/TRemovedObjects.h =================================================================== diff -u -N -r293e52b38d46653068006262172018a0f0d0a31c -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TRemovedObjects.h (.../TRemovedObjects.h) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TRemovedObjects.h (.../TRemovedObjects.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -20,6 +20,7 @@ #define __TREMOVEDOBJECTS_H__ #include "libchcore.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -29,17 +30,17 @@ TRemovedObjects(); ~TRemovedObjects(); - void Add(size_t stObjectID); + void Add(object_id_t oidObjectID); size_t GetCount() const; - size_t GetAt(size_t stIndex) const; + object_id_t GetAt(size_t stIndex) const; void Clear(); bool IsEmpty() const; private: #pragma warning(push) #pragma warning(disable: 4251) - std::set m_setObjects; + std::set m_setObjects; #pragma warning(pop) }; Index: src/libchcore/TSQLiteSerializerContainer.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -50,30 +50,30 @@ delete m_pPoolRows; } -ISerializerRowData& TSQLiteSerializerContainer::GetRow(size_t stRowID, bool bMarkAsAdded) +ISerializerRowData& TSQLiteSerializerContainer::GetRow(object_id_t oidRowID, bool bMarkAsAdded) { - RowMap::iterator iterFnd = m_mapRows.find(stRowID); + RowMap::iterator iterFnd = m_mapRows.find(oidRowID); if(iterFnd == m_mapRows.end()) { void* pMemoryBlock = GetPool().malloc(); if(!pMemoryBlock) THROW_SERIALIZER_EXCEPTION(eErr_InternalProblem, _T("Cannot allocate memory")); - iterFnd = m_mapRows.insert(std::make_pair(stRowID, TSQLiteSerializerRowData(stRowID, m_tColumns, bMarkAsAdded, (unsigned long long*)pMemoryBlock, GetPool().get_requested_size(), m_poolStrings))).first; + iterFnd = m_mapRows.insert(std::make_pair(oidRowID, TSQLiteSerializerRowData(oidRowID, m_tColumns, bMarkAsAdded, (unsigned long long*)pMemoryBlock, GetPool().get_requested_size(), m_poolStrings))).first; } else if(bMarkAsAdded) iterFnd->second.MarkAsAdded(); return (*iterFnd).second; } -void TSQLiteSerializerContainer::DeleteRow(size_t stRowID) +void TSQLiteSerializerContainer::DeleteRow(object_id_t oidRowID) { - RowMap::iterator iterFnd = m_mapRows.find(stRowID); + RowMap::iterator iterFnd = m_mapRows.find(oidRowID); if(iterFnd != m_mapRows.end()) m_mapRows.erase(iterFnd); - m_setDeleteItems.insert(stRowID); + m_setDeleteItems.insert(oidRowID); } void TSQLiteSerializerContainer::DeleteRows(const TRemovedObjects& setObjects) @@ -150,7 +150,7 @@ const size_t stMaxToRemoveAtOnce = 10; // delete items in chunks - std::set::const_iterator iterToDelete = m_setDeleteItems.begin(); + std::set::const_iterator iterToDelete = m_setDeleteItems.begin(); while(iterToDelete != m_setDeleteItems.end()) { TString strItemsToRemove; Index: src/libchcore/TSQLiteSerializerContainer.h =================================================================== diff -u -N -r7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision 7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66) +++ src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -44,8 +44,8 @@ virtual IColumnsDefinition& GetColumnsDefinition(); - virtual ISerializerRowData& GetRow(size_t stRowID, bool bMarkAsAdded); - virtual void DeleteRow(size_t stRowID); + virtual ISerializerRowData& GetRow(object_id_t oidRowID, bool bMarkAsAdded); + virtual void DeleteRow(object_id_t oidRowID); virtual void DeleteRows(const TRemovedObjects& setObjects); virtual ISerializerRowReaderPtr GetRowReader(); @@ -64,10 +64,10 @@ boost::pool<>* m_pPoolRows; - typedef boost::container::flat_map RowMap; // maps row id to row data + typedef boost::container::flat_map RowMap; // maps row id to row data RowMap m_mapRows; - std::set m_setDeleteItems; + std::set m_setDeleteItems; TString m_strName; sqlite::TSQLiteDatabasePtr m_spDB; Index: src/libchcore/TSQLiteSerializerRowData.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -28,7 +28,7 @@ BEGIN_CHCORE_NAMESPACE /////////////////////////////////////////////////////////////////////////// -TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes, TPlainStringPool& poolStrings) : +TSQLiteSerializerRowData::TSQLiteSerializerRowData(object_id_t oidRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes, TPlainStringPool& poolStrings) : m_rColumns(rColumnDefinition), m_pPoolMemory(pPoolMemory), m_poolStrings(poolStrings) @@ -43,7 +43,7 @@ // set id size_t stIDIndex = rColumnDefinition.GetColumnIndex(_T("id")); - SetValue(stIDIndex, (unsigned long long)stRowID); + SetValue(stIDIndex, oidRowID); if(bAdded) MarkAsAdded(); Index: src/libchcore/TSQLiteSerializerRowData.h =================================================================== diff -u -N -r7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision 7b830c34855c8aaa81aac2c6e0ca0fa6bae95e66) +++ src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -39,7 +39,7 @@ static const unsigned long long AddedBit = 1; private: - TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes, TPlainStringPool& poolStrings); + TSQLiteSerializerRowData(object_id_t oidRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes, TPlainStringPool& poolStrings); public: TSQLiteSerializerRowData(const TSQLiteSerializerRowData& rSrc); Index: src/libchcore/TSharedModificationTracker.h =================================================================== diff -u -N -r19925be73ffcadd9f345f10e03e55aadb3f0eeac -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSharedModificationTracker.h (.../TSharedModificationTracker.h) (revision 19925be73ffcadd9f345f10e03e55aadb3f0eeac) +++ src/libchcore/TSharedModificationTracker.h (.../TSharedModificationTracker.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -27,6 +27,9 @@ class TSharedModificationTracker { public: + typedef T value_type; + +public: TSharedModificationTracker(Bitset& rBitset) : m_tValue(), m_rBitset(rBitset) Index: src/libchcore/TStringArray.cpp =================================================================== diff -u -N -rb193a95402f2bf4c456fb9d65d111caaf6994823 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,8 +22,6 @@ // ============================================================================ #include "stdafx.h" #include "TStringArray.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" @@ -204,16 +202,6 @@ return TStringArrayConstIterator(m_vItems.end()); } -void TStringArray::Serialize(TReadBinarySerializer& rSerializer) -{ - Serializers::Serialize(rSerializer, m_vItems); -} - -void TStringArray::Serialize(TWriteBinarySerializer& rSerializer) const -{ - Serializers::Serialize(rSerializer, m_vItems); -} - bool TStringArray::operator==(const TStringArray& rSrc) const { if(rSrc.GetCount() != GetCount()) Index: src/libchcore/TStringArray.h =================================================================== diff -u -N -rb193a95402f2bf4c456fb9d65d111caaf6994823 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TStringArray.h (.../TStringArray.h) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TStringArray.h (.../TStringArray.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -28,9 +28,6 @@ BEGIN_CHCORE_NAMESPACE -class TReadBinarySerializer; -class TWriteBinarySerializer; - class LIBCHCORE_API TStringArrayIterator { protected: @@ -112,9 +109,6 @@ TStringArrayConstIterator Begin() const; TStringArrayConstIterator End() const; - void Serialize(TReadBinarySerializer& rSerializer); - void Serialize(TWriteBinarySerializer& rSerializer) const; - private: #pragma warning(push) #pragma warning(disable: 4251) Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -43,17 +43,17 @@ TSubTasksArray::TSubTasksArray(TSubTaskContext& rSubTaskContext) : m_rSubTaskContext(rSubTaskContext), m_eOperationType(m_setModifications, eOperation_None), - m_lSubOperationIndex(0), - m_lLastStoredIndex(-1) + m_oidSubOperationIndex(0), + m_oidLastStoredIndex((object_id_t)-1) { m_setModifications[eMod_Added] = true; } TSubTasksArray::TSubTasksArray(const TOperationPlan& rOperationPlan, TSubTaskContext& rSubTaskContext) : m_rSubTaskContext(rSubTaskContext), m_eOperationType(m_setModifications, eOperation_None), - m_lSubOperationIndex(0), - m_lLastStoredIndex(-1) + m_oidSubOperationIndex(0), + m_oidLastStoredIndex((object_id_t)-1) { m_setModifications[eMod_Added] = true; Init(rOperationPlan); @@ -66,7 +66,7 @@ void TSubTasksArray::Init(const TOperationPlan& rOperationPlan) { m_vSubTasks.clear(); - m_lSubOperationIndex.store(0, boost::memory_order_release); + m_oidSubOperationIndex.store(0, boost::memory_order_release); m_eOperationType = rOperationPlan.GetOperationType(); @@ -101,7 +101,7 @@ void TSubTasksArray::ResetProgressAndStats() { - m_lSubOperationIndex.store(0, boost::memory_order_release); + m_oidSubOperationIndex.store(0, boost::memory_order_release); std::pair tupleRow; BOOST_FOREACH(tupleRow, m_vSubTasks) @@ -117,12 +117,12 @@ { TSubTaskBase::ESubOperationResult eResult = TSubTaskBase::eSubResult_Continue; - size_t stSize = m_vSubTasks.size(); - long lIndex = m_lSubOperationIndex.load(boost::memory_order_acquire); + object_id_t oidSize = boost::numeric_cast(m_vSubTasks.size()); + object_id_t oidIndex = m_oidSubOperationIndex.load(boost::memory_order_acquire); - while(boost::numeric_cast(lIndex) < stSize) + while(oidIndex < oidSize) { - std::pair& rCurrentSubTask = m_vSubTasks.at(lIndex); + std::pair& rCurrentSubTask = m_vSubTasks.at(boost::numeric_cast(oidIndex)); TSubTaskBasePtr spCurrentSubTask = rCurrentSubTask.first; // if we run in estimation mode only, then stop processing and return to the caller @@ -136,7 +136,7 @@ if(eResult != TSubTaskBase::eSubResult_Continue) break; - lIndex = m_lSubOperationIndex.fetch_add(1, boost::memory_order_release) + 1; + oidIndex = m_oidSubOperationIndex.fetch_add(1, boost::memory_order_release) + 1; } return eResult; @@ -153,8 +153,8 @@ // current task // ugly const_cast - const method, non-const interlocked intrinsic and we're really not modifying the member... - long lIndex = m_lSubOperationIndex.load(boost::memory_order_acquire); - rSnapshot.SetCurrentSubtaskIndex(lIndex); + object_id_t oidIndex = m_oidSubOperationIndex.load(boost::memory_order_acquire); + rSnapshot.SetCurrentSubtaskIndex(oidIndex); // progress for(size_t stSubOperationIndex = 0; stSubOperationIndex < m_vSubTasks.size(); ++stSubOperationIndex) @@ -194,44 +194,44 @@ InitSubtasksColumns(spContainer); // base data - long lCurrentIndex = m_lSubOperationIndex.load(boost::memory_order_acquire); + object_id_t oidCurrentIndex = m_oidSubOperationIndex.load(boost::memory_order_acquire); // subtasks are stored only once when added as they don't change (at least in context of their order and type) if(bAdded) { - if(m_lLastStoredIndex != -1) + if(m_oidLastStoredIndex != -1) THROW_CORE_EXCEPTION(eErr_InternalProblem); for(size_t stSubOperationIndex = 0; stSubOperationIndex < m_vSubTasks.size(); ++stSubOperationIndex) { const std::pair& rCurrentSubTask = m_vSubTasks[stSubOperationIndex]; - ISerializerRowData& rRow = spContainer->GetRow(stSubOperationIndex, bAdded); + ISerializerRowData& rRow = spContainer->GetRow(boost::numeric_cast(stSubOperationIndex), bAdded); rRow.SetValue(_T("type"), rCurrentSubTask.first->GetSubOperationType()); rRow.SetValue(_T("is_current"), false); rRow.SetValue(_T("is_estimation"), rCurrentSubTask.second); } } // serialize current index - if(bAdded || lCurrentIndex != m_lLastStoredIndex) + if(bAdded || oidCurrentIndex != m_oidLastStoredIndex) { // mark subtask at current index as "current"; don't do that if we just finished. - if(boost::numeric_cast(lCurrentIndex) != m_vSubTasks.size()) + if(boost::numeric_cast(oidCurrentIndex) != m_vSubTasks.size()) { - ISerializerRowData& rRow = spContainer->GetRow(lCurrentIndex, false); + ISerializerRowData& rRow = spContainer->GetRow(oidCurrentIndex, false); rRow.SetValue(_T("is_current"), true); } // unmark the old "current" subtask - if(m_lLastStoredIndex != -1) + if(m_oidLastStoredIndex != -1) { - ISerializerRowData& rRow = spContainer->GetRow(m_lLastStoredIndex, false); + ISerializerRowData& rRow = spContainer->GetRow(m_oidLastStoredIndex, false); rRow.SetValue(_T("is_current"), false); } } - m_lLastStoredIndex = lCurrentIndex; + m_oidLastStoredIndex = oidCurrentIndex; } m_setModifications.reset(); @@ -260,7 +260,7 @@ /////////////////////////////////////////////////////////////////////// { - m_lLastStoredIndex = -1; + m_oidLastStoredIndex = (object_id_t)-1; ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtasks")); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); @@ -269,36 +269,36 @@ while(spRowReader->Next()) { - long lID = 0; + object_id_t oidID = 0; int iType = 0; bool bIsCurrent = false; bool bIsEstimation = false; - spRowReader->GetValue(_T("id"), lID); + spRowReader->GetValue(_T("id"), oidID); spRowReader->GetValue(_T("type"), iType); spRowReader->GetValue(_T("is_current"), bIsCurrent); spRowReader->GetValue(_T("is_estimation"), bIsEstimation); if(bIsCurrent) { - m_lSubOperationIndex.store(lID, boost::memory_order_release); - m_lLastStoredIndex = lID; + m_oidSubOperationIndex.store(oidID, boost::memory_order_release); + m_oidLastStoredIndex = oidID; } // create subtask, load it and put into the array TSubTaskBasePtr spSubTask = CreateSubtask((ESubOperationType)iType, m_rSubTaskContext); spSubTask->Load(spSerializer); - if(boost::numeric_cast(lID) != m_vSubTasks.size()) + if(boost::numeric_cast(oidID) != m_vSubTasks.size()) THROW_CORE_EXCEPTION(eErr_InvalidData); m_vSubTasks.push_back(std::make_pair(spSubTask, bIsEstimation)); } - if(m_lLastStoredIndex == -1) + if(m_oidLastStoredIndex == -1) { - m_lSubOperationIndex.store(boost::numeric_cast(m_vSubTasks.size()), boost::memory_order_release); - m_lLastStoredIndex = boost::numeric_cast(m_vSubTasks.size()); + m_oidSubOperationIndex.store(boost::numeric_cast(m_vSubTasks.size()), boost::memory_order_release); + m_oidLastStoredIndex = boost::numeric_cast(m_vSubTasks.size()); } } @@ -331,7 +331,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("type"), IColumnsDefinition::eType_int); rColumns.AddColumn(_T("is_current"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("is_estimation"), IColumnsDefinition::eType_bool); @@ -345,7 +345,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("operation"), IColumnsDefinition::eType_int); } Index: src/libchcore/TSubTaskArray.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskArray.h (.../TSubTaskArray.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TSubTaskArray.h (.../TSubTaskArray.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -91,10 +91,10 @@ std::vector > m_vSubTasks; // pointer to the subtask object / is this the part of estimation? - mutable boost::atomic m_lSubOperationIndex; // index of sub-operation from TOperationDescription + mutable boost::atomic m_oidSubOperationIndex; // index of sub-operation from TOperationDescription #pragma warning(pop) - mutable long m_lLastStoredIndex; + mutable object_id_t m_oidLastStoredIndex; friend class TTaskProcessingGuard; }; Index: src/libchcore/TSubTaskArrayStatsSnapshot.cpp =================================================================== diff -u -N -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskArrayStatsSnapshot.cpp (.../TSubTaskArrayStatsSnapshot.cpp) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskArrayStatsSnapshot.cpp (.../TSubTaskArrayStatsSnapshot.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -20,11 +20,12 @@ #include "TSubTaskArrayStatsSnapshot.h" #include "ErrorCodes.h" #include "TCoreException.h" +#include BEGIN_CHCORE_NAMESPACE TSubTaskArrayStatsSnapshot::TSubTaskArrayStatsSnapshot() : - m_stCurrentSubtaskIndex(0) + m_oidCurrentSubtaskIndex(0) { } @@ -48,10 +49,10 @@ TSubTaskStatsSnapshotPtr TSubTaskArrayStatsSnapshot::GetCurrentSubTaskSnapshot() const { - if(m_stCurrentSubtaskIndex >= m_vSubTaskSnapshots.size()) + if(m_oidCurrentSubtaskIndex >= m_vSubTaskSnapshots.size()) return TSubTaskStatsSnapshotPtr(); - return m_vSubTaskSnapshots[m_stCurrentSubtaskIndex]; + return m_vSubTaskSnapshots[boost::numeric_cast(m_oidCurrentSubtaskIndex)]; } size_t TSubTaskArrayStatsSnapshot::GetSubTaskSnapshotCount() const Index: src/libchcore/TSubTaskArrayStatsSnapshot.h =================================================================== diff -u -N -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskArrayStatsSnapshot.h (.../TSubTaskArrayStatsSnapshot.h) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskArrayStatsSnapshot.h (.../TSubTaskArrayStatsSnapshot.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -21,6 +21,7 @@ #include "libchcore.h" #include "TSubTaskStatsSnapshot.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -36,11 +37,11 @@ size_t GetSubTaskSnapshotCount() const; TSubTaskStatsSnapshotPtr GetCurrentSubTaskSnapshot() const; - size_t GetCurrentSubtaskIndex() const { return m_stCurrentSubtaskIndex; } - void SetCurrentSubtaskIndex(size_t val) { m_stCurrentSubtaskIndex = val; } + object_id_t GetCurrentSubtaskIndex() const { return m_oidCurrentSubtaskIndex; } + void SetCurrentSubtaskIndex(object_id_t val) { m_oidCurrentSubtaskIndex = val; } private: - size_t m_stCurrentSubtaskIndex; + object_id_t m_oidCurrentSubtaskIndex; #pragma warning(push) #pragma warning(disable: 4251) std::vector m_vSubTaskSnapshots; Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -49,7 +49,7 @@ // class TCopyMoveProgressInfo TCopyMoveProgressInfo::TCopyMoveProgressInfo() : - m_stCurrentIndex(m_setModifications, 0), + m_fcCurrentIndex(m_setModifications, 0), m_ullCurrentFileProcessedSize(m_setModifications, 0) { m_setModifications[eMod_Added] = true; @@ -62,26 +62,26 @@ void TCopyMoveProgressInfo::ResetProgress() { boost::unique_lock lock(m_lock); - m_stCurrentIndex = 0; + m_fcCurrentIndex = 0; m_ullCurrentFileProcessedSize = 0; } - void TCopyMoveProgressInfo::SetCurrentIndex(size_t stIndex) + void TCopyMoveProgressInfo::SetCurrentIndex(file_count_t fcIndex) { boost::unique_lock lock(m_lock); - m_stCurrentIndex = stIndex; + m_fcCurrentIndex = fcIndex; } void TCopyMoveProgressInfo::IncreaseCurrentIndex() { boost::unique_lock lock(m_lock); - ++m_stCurrentIndex.Modify(); + ++m_fcCurrentIndex.Modify(); } - size_t TCopyMoveProgressInfo::GetCurrentIndex() const + file_count_t TCopyMoveProgressInfo::GetCurrentIndex() const { boost::shared_lock lock(m_lock); - return m_stCurrentIndex; + return m_fcCurrentIndex; } void TCopyMoveProgressInfo::SetCurrentFileProcessedSize(unsigned long long ullSize) @@ -113,8 +113,8 @@ boost::shared_lock lock(m_lock); if(m_setModifications.any()) { - if(m_stCurrentIndex.IsModified()) - rRowData.SetValue(_T("current_index"), m_stCurrentIndex); + if(m_fcCurrentIndex.IsModified()) + rRowData.SetValue(_T("current_index"), m_fcCurrentIndex); if(m_ullCurrentFileProcessedSize.IsModified()) rRowData.SetValue(_T("cf_processed_size"), m_ullCurrentFileProcessedSize); @@ -124,16 +124,16 @@ void TCopyMoveProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); - rColumns.AddColumn(_T("cf_processed_size"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); + rColumns.AddColumn(_T("current_index"), ColumnType::value); + rColumns.AddColumn(_T("cf_processed_size"), ColumnType::value); } void TCopyMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) { boost::unique_lock lock(m_lock); - spRowReader->GetValue(_T("current_index"), m_stCurrentIndex.Modify()); + spRowReader->GetValue(_T("current_index"), m_fcCurrentIndex.Modify()); spRowReader->GetValue(_T("cf_processed_size"), m_ullCurrentFileProcessedSize.Modify()); m_setModifications.reset(); @@ -204,7 +204,7 @@ return eResult; // begin at index which wasn't processed previously - size_t stSize = rFilesCache.GetSize(); + file_count_t fcSize = rFilesCache.GetSize(); bool bIgnoreFolders = GetTaskPropValue(rConfig); bool bForceDirectories = GetTaskPropValue(rConfig); @@ -222,17 +222,17 @@ TString strFormat; strFormat = _T("Processing files/folders (ProcessFiles):\r\n\tOnlyCreate: %create\r\n\tFiles/folders count: %filecount\r\n\tIgnore Folders: %ignorefolders\r\n\tDest path: %dstpath\r\n\tCurrent index (0-based): %currindex"); strFormat.Replace(_T("%create"), boost::lexical_cast(ccp.bOnlyCreate).c_str()); - strFormat.Replace(_T("%filecount"), boost::lexical_cast(stSize).c_str()); + strFormat.Replace(_T("%filecount"), boost::lexical_cast(fcSize).c_str()); strFormat.Replace(_T("%ignorefolders"), boost::lexical_cast(bIgnoreFolders).c_str()); strFormat.Replace(_T("%dstpath"), pathDestination.ToString()); strFormat.Replace(_T("%currindex"), boost::lexical_cast(m_tProgressInfo.GetCurrentIndex()).c_str()); rLog.logi(strFormat.c_str()); - size_t stIndex = m_tProgressInfo.GetCurrentIndex(); - for(; stIndex < stSize; stIndex++) + file_count_t fcIndex = m_tProgressInfo.GetCurrentIndex(); + for(; fcIndex < fcSize; fcIndex++) { - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // should we kill ? if(rThreadController.KillRequested()) @@ -243,11 +243,11 @@ } // next file to be copied - TFileInfoPtr spFileInfo = rFilesCache.GetAt(stIndex); + TFileInfoPtr spFileInfo = rFilesCache.GetAt(fcIndex); TSmartPath pathCurrent = spFileInfo->GetFullFilePath(); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(pathCurrent.ToString()); m_tSubTaskStats.SetCurrentItemProcessedSize(0); m_tSubTaskStats.SetCurrentItemTotalSize(spFileInfo->GetLength64()); @@ -303,10 +303,10 @@ TLocalFilesystem::SetAttributes(ccp.pathDstFile, spFileInfo->GetAttributes()); // as above } - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(TString()); // log Index: src/libchcore/TSubTaskCopyMove.h =================================================================== diff -u -N -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -26,14 +26,13 @@ #include "libchcore.h" #include "TSubTaskBase.h" #include "DataBuffer.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE class TLocalFilesystemFile; typedef boost::shared_ptr TFileInfoPtr; struct CUSTOM_COPY_PARAMS; -class TReadBinarySerializer; -class TWriteBinarySerializer; class TDataBufferManager; class TSimpleDataBuffer; @@ -53,9 +52,9 @@ virtual void ResetProgress(); // file being processed - void SetCurrentIndex(size_t stIndex); + void SetCurrentIndex(file_count_t fcIndex); void IncreaseCurrentIndex(); - size_t GetCurrentIndex() const; + file_count_t GetCurrentIndex() const; // part of file being processed void SetCurrentFileProcessedSize(unsigned long long ullSize); @@ -82,7 +81,7 @@ typedef std::bitset Bitset; mutable Bitset m_setModifications; - TSharedModificationTracker m_stCurrentIndex; + TSharedModificationTracker m_fcCurrentIndex; TSharedModificationTracker m_ullCurrentFileProcessedSize; // count of bytes processed for current file mutable boost::shared_mutex m_lock; Index: src/libchcore/TSubTaskDelete.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -44,8 +44,8 @@ // class TDeleteProgressInfo TDeleteProgressInfo::TDeleteProgressInfo() : - m_stCurrentIndex(0), - m_stLastStoredIndex(std::numeric_limits::max()) + m_fcCurrentIndex(0), + m_fcLastStoredIndex((file_count_t)-1) { } @@ -56,55 +56,55 @@ void TDeleteProgressInfo::ResetProgress() { boost::unique_lock lock(m_lock); - m_stCurrentIndex = 0; + m_fcCurrentIndex = 0; } - void TDeleteProgressInfo::SetCurrentIndex(size_t stIndex) + void TDeleteProgressInfo::SetCurrentIndex(file_count_t fcIndex) { boost::unique_lock lock(m_lock); - m_stCurrentIndex = stIndex; + m_fcCurrentIndex = fcIndex; } void TDeleteProgressInfo::IncreaseCurrentIndex() { boost::unique_lock lock(m_lock); - ++m_stCurrentIndex; + ++m_fcCurrentIndex; } - size_t TDeleteProgressInfo::GetCurrentIndex() const + file_count_t TDeleteProgressInfo::GetCurrentIndex() const { boost::shared_lock lock(m_lock); - return m_stCurrentIndex; + return m_fcCurrentIndex; } void TDeleteProgressInfo::Store(ISerializerRowData& rRowData) const { boost::shared_lock lock(m_lock); - if(m_stCurrentIndex != m_stLastStoredIndex) + if(m_fcCurrentIndex != m_fcLastStoredIndex) { - rRowData.SetValue(_T("current_index"), m_stCurrentIndex); - m_stLastStoredIndex = m_stCurrentIndex; + rRowData.SetValue(_T("current_index"), m_fcCurrentIndex); + m_fcLastStoredIndex = m_fcCurrentIndex; } } void TDeleteProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); + rColumns.AddColumn(_T("current_index"), ColumnType::value); } void TDeleteProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) { boost::unique_lock lock(m_lock); - spRowReader->GetValue(_T("current_index"), m_stCurrentIndex); - m_stLastStoredIndex = m_stCurrentIndex; + spRowReader->GetValue(_T("current_index"), m_fcCurrentIndex); + m_fcLastStoredIndex = m_fcCurrentIndex; } bool TDeleteProgressInfo::WasSerialized() const { boost::shared_lock lock(m_lock); - return m_stLastStoredIndex != std::numeric_limits::max(); + return m_fcLastStoredIndex != (file_count_t)-1; } } @@ -151,15 +151,15 @@ TString strFormat; // index points to 0 or next item to process - size_t stIndex = m_tProgressInfo.GetCurrentIndex(); - while(stIndex < rFilesCache.GetSize()) + file_count_t fcIndex = m_tProgressInfo.GetCurrentIndex(); + while(fcIndex < rFilesCache.GetSize()) { - spFileInfo = rFilesCache.GetAt(rFilesCache.GetSize() - stIndex - 1); + spFileInfo = rFilesCache.GetAt(rFilesCache.GetSize() - fcIndex - 1); - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(spFileInfo->GetFullFilePath().ToString()); // check for kill flag @@ -173,7 +173,7 @@ // current processed element if(!spFileInfo->IsProcessed()) { - ++stIndex; + ++fcIndex; continue; } @@ -211,7 +211,7 @@ return TSubTaskBase::eSubResult_CancelRequest; case IFeedbackHandler::eResult_Retry: - continue; // no stIndex bump, since we are trying again + continue; // no fcIndex bump, since we are trying again case IFeedbackHandler::eResult_Pause: return TSubTaskBase::eSubResult_PauseRequest; @@ -225,13 +225,13 @@ } } - ++stIndex; + ++fcIndex; }//while - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(TString()); // log Index: src/libchcore/TSubTaskDelete.h =================================================================== diff -u -N -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -28,9 +28,6 @@ BEGIN_CHCORE_NAMESPACE -class TReadBinarySerializer; -class TWriteBinarySerializer; - namespace details { /////////////////////////////////////////////////////////////////////////// @@ -44,18 +41,18 @@ virtual void ResetProgress(); - void SetCurrentIndex(size_t stIndex); + void SetCurrentIndex(file_count_t fcIndex); void IncreaseCurrentIndex(); - size_t GetCurrentIndex() const; + file_count_t GetCurrentIndex() const; void Store(ISerializerRowData& rRowData) const; static void InitColumns(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader); bool WasSerialized() const; private: - size_t m_stCurrentIndex; - mutable size_t m_stLastStoredIndex; + file_count_t m_fcCurrentIndex; + mutable file_count_t m_fcLastStoredIndex; mutable boost::shared_mutex m_lock; }; } Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -46,8 +46,8 @@ // class TFastMoveProgressInfo TFastMoveProgressInfo::TFastMoveProgressInfo() : - m_stCurrentIndex(0), - m_stLastStoredIndex(std::numeric_limits::max()) + m_fcCurrentIndex(0), + m_fcLastStoredIndex((file_count_t)-1) { } @@ -58,55 +58,55 @@ void TFastMoveProgressInfo::ResetProgress() { boost::unique_lock lock(m_lock); - m_stCurrentIndex = 0; + m_fcCurrentIndex = 0; } - void TFastMoveProgressInfo::SetCurrentIndex(size_t stIndex) + void TFastMoveProgressInfo::SetCurrentIndex(file_count_t fcIndex) { boost::unique_lock lock(m_lock); - m_stCurrentIndex = stIndex; + m_fcCurrentIndex = fcIndex; } void TFastMoveProgressInfo::IncreaseCurrentIndex() { boost::unique_lock lock(m_lock); - ++m_stCurrentIndex; + ++m_fcCurrentIndex; } - size_t TFastMoveProgressInfo::GetCurrentIndex() const + file_count_t TFastMoveProgressInfo::GetCurrentIndex() const { boost::shared_lock lock(m_lock); - return m_stCurrentIndex; + return m_fcCurrentIndex; } void TFastMoveProgressInfo::Store(ISerializerRowData& rRowData) const { boost::shared_lock lock(m_lock); - if(m_stCurrentIndex != m_stLastStoredIndex) + if(m_fcCurrentIndex != m_fcLastStoredIndex) { - rRowData.SetValue(_T("current_index"), m_stCurrentIndex); - m_stLastStoredIndex = m_stCurrentIndex; + rRowData.SetValue(_T("current_index"), m_fcCurrentIndex); + m_fcLastStoredIndex = m_fcCurrentIndex; } } void TFastMoveProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); + rColumns.AddColumn(_T("current_index"), ColumnType::value); } void TFastMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) { boost::unique_lock lock(m_lock); - spRowReader->GetValue(_T("current_index"), m_stCurrentIndex); - m_stLastStoredIndex = m_stCurrentIndex; + spRowReader->GetValue(_T("current_index"), m_fcCurrentIndex); + m_fcLastStoredIndex = m_fcCurrentIndex; } bool TFastMoveProgressInfo::WasSerialized() const { boost::shared_lock lock(m_lock); - return m_stLastStoredIndex != std::numeric_limits::max(); + return m_fcLastStoredIndex != (file_count_t)-1; } } @@ -162,18 +162,18 @@ bool bRetry = true; bool bSkipInputPath = false; - size_t stSize = spBasePaths->GetCount(); - size_t stIndex = m_tProgressInfo.GetCurrentIndex(); - for(; stIndex < stSize ; stIndex++) + file_count_t fcSize = spBasePaths->GetCount(); + file_count_t fcIndex = m_tProgressInfo.GetCurrentIndex(); + for(; fcIndex < fcSize ; fcIndex++) { - TBasePathDataPtr spBasePath = spBasePaths->GetAt(stIndex); + TBasePathDataPtr spBasePath = spBasePaths->GetAt(fcIndex); TSmartPath pathCurrent = spBasePath->GetSrcPath(); // store currently processed index - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(pathCurrent.ToString()); // retrieve base path data @@ -293,10 +293,10 @@ } } - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(TString()); // log Index: src/libchcore/TSubTaskFastMove.h =================================================================== diff -u -N -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -26,12 +26,11 @@ #include "libchcore.h" #include "TSubTaskBase.h" #include "TPath.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE class TFileFiltersArray; -class TReadBinarySerializer; -class TWriteBinarySerializer; namespace details { @@ -46,18 +45,18 @@ virtual void ResetProgress(); - void SetCurrentIndex(size_t stIndex); + void SetCurrentIndex(file_count_t fcIndex); void IncreaseCurrentIndex(); - size_t GetCurrentIndex() const; + file_count_t GetCurrentIndex() const; void Store(ISerializerRowData& rRowData) const; static void InitColumns(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader); bool WasSerialized() const; private: - size_t m_stCurrentIndex; - mutable size_t m_stLastStoredIndex; + file_count_t m_fcCurrentIndex; + mutable file_count_t m_fcLastStoredIndex; mutable boost::shared_mutex m_lock; }; } Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -N -r2fe97a93f21771d75901d4b6559057d1ea055104 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 2fe97a93f21771d75901d4b6559057d1ea055104) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -46,50 +46,36 @@ // class TScanDirectoriesProgressInfo TScanDirectoriesProgressInfo::TScanDirectoriesProgressInfo() : - m_stCurrentIndex(0) + m_fcCurrentIndex(0) { } TScanDirectoriesProgressInfo::~TScanDirectoriesProgressInfo() { } -/* - void TScanDirectoriesProgressInfo::Serialize(TReadBinarySerializer& rSerializer) - { - boost::unique_lock lock(m_lock); - Serializers::Serialize(rSerializer, m_stCurrentIndex); - } - - void TScanDirectoriesProgressInfo::Serialize(TWriteBinarySerializer& rSerializer) const - { - boost::shared_lock lock(m_lock); - Serializers::Serialize(rSerializer, m_stCurrentIndex); - } -*/ - void TScanDirectoriesProgressInfo::ResetProgress() { boost::unique_lock lock(m_lock); - m_stCurrentIndex = 0; + m_fcCurrentIndex = 0; } - void TScanDirectoriesProgressInfo::SetCurrentIndex(size_t stIndex) + void TScanDirectoriesProgressInfo::SetCurrentIndex(file_count_t fcIndex) { boost::unique_lock lock(m_lock); - m_stCurrentIndex = stIndex; + m_fcCurrentIndex = fcIndex; } void TScanDirectoriesProgressInfo::IncreaseCurrentIndex() { boost::unique_lock lock(m_lock); - ++m_stCurrentIndex; + ++m_fcCurrentIndex; } - size_t TScanDirectoriesProgressInfo::GetCurrentIndex() const + file_count_t TScanDirectoriesProgressInfo::GetCurrentIndex() const { boost::shared_lock lock(m_lock); - return m_stCurrentIndex; + return m_fcCurrentIndex; } } @@ -148,18 +134,18 @@ bool bRetry = true; bool bSkipInputPath = false; - size_t stSize = spBasePaths->GetCount(); + file_count_t fcSize = spBasePaths->GetCount(); // NOTE: in theory, we should resume the scanning, but in practice we are always restarting scanning if interrupted. - size_t stIndex = 0; // m_tProgressInfo.GetCurrentIndex() - for(; stIndex < stSize; stIndex++) + file_count_t fcIndex = 0; // m_tProgressInfo.GetCurrentIndex() + for(; fcIndex < fcSize; fcIndex++) { - TBasePathDataPtr spBasePath = spBasePaths->GetAt(stIndex); + TBasePathDataPtr spBasePath = spBasePaths->GetAt(fcIndex); TSmartPath pathCurrent = spBasePath->GetSrcPath(); - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(pathCurrent.ToString()); bSkipInputPath = false; @@ -261,10 +247,10 @@ } // calc size of all files - m_tProgressInfo.SetCurrentIndex(stIndex); + m_tProgressInfo.SetCurrentIndex(fcIndex); // new stats - m_tSubTaskStats.SetProcessedCount(stIndex); + m_tSubTaskStats.SetProcessedCount(fcIndex); m_tSubTaskStats.SetCurrentPath(TString()); rFilesCache.SetComplete(true); Index: src/libchcore/TSubTaskScanDirectory.h =================================================================== diff -u -N -r0b8ae6ab8b538881b651126bf8e6de9c9912a782 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision 0b8ae6ab8b538881b651126bf8e6de9c9912a782) +++ src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -27,12 +27,11 @@ #include "TSubTaskBase.h" #include "TPath.h" #include "TBasePathData.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE class TFileFiltersArray; -class TReadBinarySerializer; -class TWriteBinarySerializer; namespace details { @@ -47,12 +46,12 @@ virtual void ResetProgress(); - void SetCurrentIndex(size_t stIndex); + void SetCurrentIndex(file_count_t fcIndex); void IncreaseCurrentIndex(); - size_t GetCurrentIndex() const; + file_count_t GetCurrentIndex() const; private: - size_t m_stCurrentIndex; + file_count_t m_fcCurrentIndex; mutable boost::shared_mutex m_lock; }; } Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -52,8 +52,8 @@ m_bSubTaskIsRunning(m_setModifications, false), m_ullTotalSize(m_setModifications, 0), m_ullProcessedSize(m_setModifications, 0), - m_stTotalCount(m_setModifications, 0), - m_stProcessedCount(m_setModifications, 0), + m_fcTotalCount(m_setModifications, 0), + m_fcProcessedCount(m_setModifications, 0), m_iCurrentBufferIndex(m_setModifications, 0), m_strCurrentPath(m_setModifications), m_tSizeSpeed(m_setModifications, DefaultSpeedTrackTime, DefaultSpeedSampleTime), @@ -71,8 +71,8 @@ m_bSubTaskIsRunning = false; m_ullTotalSize = 0; m_ullProcessedSize = 0; - m_stTotalCount = 0; - m_stProcessedCount = 0; + m_fcTotalCount = 0; + m_fcProcessedCount = 0; m_iCurrentBufferIndex = 0; m_strCurrentPath.Modify().Clear(); m_tTimer.Modify().Reset(); @@ -96,8 +96,8 @@ UpdateTime(lock); spStatsSnapshot->SetRunning(m_bSubTaskIsRunning); - spStatsSnapshot->SetProcessedCount(m_stProcessedCount); - spStatsSnapshot->SetTotalCount(m_stTotalCount); + spStatsSnapshot->SetProcessedCount(m_fcProcessedCount); + spStatsSnapshot->SetTotalCount(m_fcTotalCount); spStatsSnapshot->SetProcessedSize(m_ullProcessedSize); spStatsSnapshot->SetTotalSize(m_ullTotalSize); spStatsSnapshot->SetCurrentBufferIndex(m_iCurrentBufferIndex); @@ -123,37 +123,37 @@ m_bSubTaskIsRunning = false; } -void TSubTaskStatsInfo::IncreaseProcessedCount(size_t stIncreaseBy) +void TSubTaskStatsInfo::IncreaseProcessedCount(file_count_t fcIncreaseBy) { boost::unique_lock lock(m_lock); - m_stProcessedCount.Modify() += stIncreaseBy; + m_fcProcessedCount.Modify() += fcIncreaseBy; - m_tCountSpeed.Modify().AddSample(stIncreaseBy, m_tTimer.Modify().Tick()); + m_tCountSpeed.Modify().AddSample(fcIncreaseBy, m_tTimer.Modify().Tick()); - _ASSERTE(m_stProcessedCount <= m_stTotalCount); - if(m_stProcessedCount > m_stTotalCount) + _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); + if(m_fcProcessedCount > m_fcTotalCount) THROW_CORE_EXCEPTION(eErr_InternalProblem); } -void TSubTaskStatsInfo::SetProcessedCount(size_t stProcessedCount) +void TSubTaskStatsInfo::SetProcessedCount(file_count_t fcProcessedCount) { boost::unique_lock lock(m_lock); - m_tCountSpeed.Modify().AddSample(0/*stProcessedCount - m_stProcessedCount*/, m_tTimer.Modify().Tick()); + m_tCountSpeed.Modify().AddSample(0/*fcProcessedCount - m_fcProcessedCount*/, m_tTimer.Modify().Tick()); - m_stProcessedCount = stProcessedCount; + m_fcProcessedCount = fcProcessedCount; - _ASSERTE(m_stProcessedCount <= m_stTotalCount); - if(m_stProcessedCount > m_stTotalCount) + _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); + if(m_fcProcessedCount > m_fcTotalCount) THROW_CORE_EXCEPTION(eErr_InternalProblem); } -void TSubTaskStatsInfo::SetTotalCount(size_t stCount) +void TSubTaskStatsInfo::SetTotalCount(file_count_t fcCount) { boost::unique_lock lock(m_lock); - m_stTotalCount = stCount; - _ASSERTE(m_stProcessedCount <= m_stTotalCount); - if(m_stProcessedCount > m_stTotalCount) + m_fcTotalCount = fcCount; + _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); + if(m_fcProcessedCount > m_fcTotalCount) THROW_CORE_EXCEPTION(eErr_InternalProblem); } @@ -294,10 +294,10 @@ if(m_tSizeSpeed.IsModified()) rRowData.SetValue(_T("size_speed"), m_tSizeSpeed.Get().ToString()); - if(m_stTotalCount.IsModified()) - rRowData.SetValue(_T("total_count"), m_stTotalCount); + if(m_fcTotalCount.IsModified()) + rRowData.SetValue(_T("total_count"), m_fcTotalCount); if(m_ullProcessedSize.IsModified()) - rRowData.SetValue(_T("processed_count"), m_stProcessedCount); + rRowData.SetValue(_T("processed_count"), m_fcProcessedCount); if(m_tSizeSpeed.IsModified()) rRowData.SetValue(_T("count_speed"), m_tCountSpeed.Get().ToString()); @@ -327,8 +327,8 @@ rColumnDefs.AddColumn(_T("total_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("processed_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("size_speed"), IColumnsDefinition::eType_string); - rColumnDefs.AddColumn(_T("total_count"), IColumnsDefinition::eType_ulonglong); - rColumnDefs.AddColumn(_T("processed_count"), IColumnsDefinition::eType_ulonglong); + rColumnDefs.AddColumn(_T("total_count"), ColumnType::value); + rColumnDefs.AddColumn(_T("processed_count"), ColumnType::value); rColumnDefs.AddColumn(_T("count_speed"), IColumnsDefinition::eType_string); rColumnDefs.AddColumn(_T("ci_processed_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("ci_total_size"), IColumnsDefinition::eType_ulonglong); @@ -353,8 +353,8 @@ spRowReader->GetValue(_T("size_speed"), strSpeed); m_tSizeSpeed.Modify().FromString(strSpeed); - spRowReader->GetValue(_T("total_count"), m_stTotalCount.Modify()); - spRowReader->GetValue(_T("processed_count"), m_stProcessedCount.Modify()); + spRowReader->GetValue(_T("total_count"), m_fcTotalCount.Modify()); + spRowReader->GetValue(_T("processed_count"), m_fcProcessedCount.Modify()); spRowReader->GetValue(_T("count_speed"), strSpeed); m_tCountSpeed.Modify().FromString(strSpeed); @@ -374,7 +374,7 @@ m_setModifications.reset(); } -void TSubTaskStatsInfo::Init(int iCurrentBufferIndex, size_t stTotalCount, size_t stProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath) +void TSubTaskStatsInfo::Init(int iCurrentBufferIndex, file_count_t fcTotalCount, file_count_t fcProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath) { boost::unique_lock lock(m_lock); @@ -383,11 +383,11 @@ m_iCurrentBufferIndex = iCurrentBufferIndex; - m_stTotalCount = stTotalCount; - m_stProcessedCount = stProcessedCount; + m_fcTotalCount = fcTotalCount; + m_fcProcessedCount = fcProcessedCount; - _ASSERTE(m_stProcessedCount <= m_stTotalCount); - if(m_stProcessedCount > m_stTotalCount) + _ASSERTE(m_fcProcessedCount <= m_fcTotalCount); + if(m_fcProcessedCount > m_fcTotalCount) THROW_CORE_EXCEPTION(eErr_InternalProblem); m_ullTotalSize = ullTotalSize; Index: src/libchcore/TSubTaskStatsInfo.h =================================================================== diff -u -N -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -33,6 +33,7 @@ #include "ISerializerRowReader.h" #include "TSharedModificationTracker.h" #include +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -63,17 +64,17 @@ public: TSubTaskStatsInfo(); - void Init(int iCurrentBufferIndex, size_t stTotalCount, size_t stProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath); + void Init(int iCurrentBufferIndex, file_count_t fcTotalCount, file_count_t fcProcessedCount, unsigned long long ullTotalSize, unsigned long long ullProcessedSize, const TString& strCurrentPath); void Clear(); bool IsInitialized() const; void GetSnapshot(TSubTaskStatsSnapshotPtr& spStatsSnapshot) const; - void IncreaseProcessedCount(size_t stIncreaseBy); - void SetProcessedCount(size_t stIndex); + void IncreaseProcessedCount(file_count_t fcIncreaseBy); + void SetProcessedCount(file_count_t fcIndex); - void SetTotalCount(size_t stCount); + void SetTotalCount(file_count_t fcCount); // size stats void IncreaseProcessedSize(unsigned long long ullIncreaseBy); @@ -148,8 +149,8 @@ TSharedModificationTracker m_ullProcessedSize; mutable TSharedModificationTracker m_tSizeSpeed; - TSharedModificationTracker m_stTotalCount; - TSharedModificationTracker m_stProcessedCount; + TSharedModificationTracker m_fcTotalCount; + TSharedModificationTracker m_fcProcessedCount; mutable TSharedModificationTracker m_tCountSpeed; TSharedModificationTracker m_ullCurrentItemProcessedSize; Index: src/libchcore/TSubTaskStatsSnapshot.cpp =================================================================== diff -u -N -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskStatsSnapshot.cpp (.../TSubTaskStatsSnapshot.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -34,8 +34,8 @@ m_bSubTaskIsRunning(false), m_ullTotalSize(0), m_ullProcessedSize(0), - m_stTotalCount(0), - m_stProcessedCount(0), + m_fcTotalCount(0), + m_fcProcessedCount(0), m_iCurrentBufferIndex(TBufferSizes::eBuffer_Default), m_strCurrentPath(0), m_timeElapsed(0), @@ -52,8 +52,8 @@ m_bSubTaskIsRunning = false; m_ullTotalSize = 0; m_ullProcessedSize = 0; - m_stTotalCount = 0; - m_stProcessedCount = 0; + m_fcTotalCount = 0; + m_fcProcessedCount = 0; m_iCurrentBufferIndex = TBufferSizes::eBuffer_Default; m_strCurrentPath = 0; m_timeElapsed = 0; @@ -69,8 +69,8 @@ // we're treating each of the items as 512B object to process // to have some balance between items' count and items' size in // progress information - unsigned long long ullProcessed = 512ULL * m_stProcessedCount + m_ullProcessedSize; - unsigned long long ullTotal = 512ULL * m_stTotalCount + m_ullTotalSize; + unsigned long long ullProcessed = 512ULL * m_fcProcessedCount + m_ullProcessedSize; + unsigned long long ullTotal = 512ULL * m_fcTotalCount + m_ullTotalSize; if(ullTotal != 0) return Math::Div64(ullProcessed, ullTotal); @@ -108,7 +108,7 @@ double TSubTaskStatsSnapshot::GetAvgCountSpeed() const { if(m_timeElapsed) - return Math::Div64(m_stProcessedCount, m_timeElapsed / 1000); + return Math::Div64(m_fcProcessedCount, m_timeElapsed / 1000); else return 0.0; } Index: src/libchcore/TSubTaskStatsSnapshot.h =================================================================== diff -u -N -ra5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TSubTaskStatsSnapshot.h (.../TSubTaskStatsSnapshot.h) (revision a5f396da5ed5ffb3fcd9fdf22afb5a7fd07e1ab8) +++ src/libchcore/TSubTaskStatsSnapshot.h (.../TSubTaskStatsSnapshot.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -26,6 +26,7 @@ #include "libchcore.h" #include "TString.h" #include "ESubTaskTypes.h" +#include "CommonDataTypes.h" BEGIN_CHCORE_NAMESPACE @@ -41,11 +42,11 @@ bool IsRunning() const { return m_bSubTaskIsRunning; } // count stats - void SetProcessedCount(size_t stIndex) { m_stProcessedCount = stIndex; } - size_t GetProcessedCount() const { return m_stProcessedCount; } + void SetProcessedCount(file_count_t fcIndex) { m_fcProcessedCount = fcIndex; } + file_count_t GetProcessedCount() const { return m_fcProcessedCount; } - void SetTotalCount(size_t stCount) { m_stTotalCount = stCount; } - size_t GetTotalCount() const { return m_stTotalCount; } + void SetTotalCount(file_count_t fcCount) { m_fcTotalCount = fcCount; } + file_count_t GetTotalCount() const { return m_fcTotalCount; } // size stats void SetProcessedSize(unsigned long long ullProcessedSize) { m_ullProcessedSize = ullProcessedSize; } @@ -103,8 +104,8 @@ double m_dSizeSpeed; // subtask count of items and its speed per second - size_t m_stTotalCount; - size_t m_stProcessedCount; + file_count_t m_fcTotalCount; + file_count_t m_fcProcessedCount; double m_dCountSpeed; // current item size Index: src/libchcore/TTask.cpp =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTask.cpp (.../TTask.cpp) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/libchcore/TTask.cpp (.../TTask.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -23,8 +23,6 @@ #include "TSubTaskScanDirectory.h" #include "TSubTaskCopyMove.h" #include "TSubTaskDelete.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include #include "../libicpf/exception.h" #include Index: src/libchcore/TTaskBaseData.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -130,7 +130,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("name"), IColumnsDefinition::eType_string); rColumns.AddColumn(_T("log_path"), IColumnsDefinition::eType_path); rColumns.AddColumn(_T("current_state"), IColumnsDefinition::eType_int); Index: src/libchcore/TTaskDefinition.h =================================================================== diff -u -N -r8b7479db2ee71a3d00779c67fe6a1b1d9ec414b8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskDefinition.h (.../TTaskDefinition.h) (revision 8b7479db2ee71a3d00779c67fe6a1b1d9ec414b8) +++ src/libchcore/TTaskDefinition.h (.../TTaskDefinition.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -31,9 +31,6 @@ BEGIN_CHCORE_NAMESPACE -class TReadBinarySerializer; -class TWriteBinarySerializer; - /////////////////////////////////////////////////////////////////////////// // TTaskDefinition Index: src/libchcore/TTaskInfo.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -27,13 +27,13 @@ TTaskInfoEntry::TTaskInfoEntry() : m_iOrder(m_setModifications, 0), m_pathSerializeLocation(m_setModifications), - m_stObjectID(0) + m_oidObjectID(0) { m_setModifications[eMod_Added] = true; } -TTaskInfoEntry::TTaskInfoEntry(taskid_t tTaskID, const TSmartPath& pathTask, int iOrder, const TTaskPtr& spTask) : - m_stObjectID(tTaskID), +TTaskInfoEntry::TTaskInfoEntry(object_id_t oidTaskID, const TSmartPath& pathTask, int iOrder, const TTaskPtr& spTask) : + m_oidObjectID(oidTaskID), m_pathSerializeLocation(m_setModifications, pathTask), m_iOrder(m_setModifications, iOrder), m_spTask(spTask) @@ -77,7 +77,7 @@ return; bool bAdded = m_setModifications[eMod_Added]; - ISerializerRowData& rRow = spContainer->GetRow(m_stObjectID, bAdded); + ISerializerRowData& rRow = spContainer->GetRow(m_oidObjectID, bAdded); if(bAdded || m_setModifications[eMod_TaskPath]) rRow.SetValue(_T("path"), m_pathSerializeLocation); @@ -89,7 +89,7 @@ void TTaskInfoEntry::Load(const ISerializerRowReaderPtr& spRowReader) { - spRowReader->GetValue(_T("id"), m_stObjectID); + spRowReader->GetValue(_T("id"), m_oidObjectID); spRowReader->GetValue(_T("path"), m_pathSerializeLocation.Modify()); spRowReader->GetValue(_T("task_order"), m_iOrder.Modify()); @@ -98,14 +98,14 @@ void TTaskInfoEntry::InitColumns(IColumnsDefinition& rColumnDefs) { - rColumnDefs.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumnDefs.AddColumn(_T("id"), ColumnType::value); rColumnDefs.AddColumn(_T("path"), IColumnsDefinition::eType_path); rColumnDefs.AddColumn(_T("task_order"), IColumnsDefinition::eType_int); } -size_t TTaskInfoEntry::GetObjectID() const +object_id_t TTaskInfoEntry::GetObjectID() const { - return m_stObjectID; + return m_oidObjectID; } void TTaskInfoEntry::ResetModifications() @@ -115,13 +115,13 @@ /////////////////////////////////////////////////////////////////////////// TTaskInfoContainer::TTaskInfoContainer() : - m_stLastObjectID(0) + m_oidLastObjectID(0) { } void TTaskInfoContainer::Add(const TSmartPath& pathTask, int iOrder, const TTaskPtr& spTask) { - m_vTaskInfos.push_back(TTaskInfoEntry(++m_stLastObjectID, pathTask, iOrder, spTask)); + m_vTaskInfos.push_back(TTaskInfoEntry(++m_oidLastObjectID, pathTask, iOrder, spTask)); } void TTaskInfoContainer::RemoveAt(size_t stIndex) @@ -130,9 +130,9 @@ THROW_CORE_EXCEPTION(eErr_BoundsExceeded); std::vector::iterator iter = m_vTaskInfos.begin() + stIndex; - taskid_t tTaskID = (*iter).GetObjectID(); + object_id_t oidTaskID = (*iter).GetObjectID(); m_vTaskInfos.erase(m_vTaskInfos.begin() + stIndex); - m_setRemovedTasks.Add(tTaskID); + m_setRemovedTasks.Add(oidTaskID); } void TTaskInfoContainer::Clear() @@ -220,15 +220,15 @@ tEntry.Load(spRowReader); m_vTaskInfos.push_back(tEntry); - m_stLastObjectID = std::max(m_stLastObjectID, tEntry.GetObjectID()); + m_oidLastObjectID = std::max(m_oidLastObjectID, tEntry.GetObjectID()); } } -TTaskInfoEntry& TTaskInfoContainer::GetAtOid(size_t stObjectID) +TTaskInfoEntry& TTaskInfoContainer::GetAtOid(object_id_t oidObjectID) { for(std::vector::iterator iter = m_vTaskInfos.begin(); iter != m_vTaskInfos.end(); ++iter) { - if((*iter).GetObjectID() == stObjectID) + if((*iter).GetObjectID() == oidObjectID) return *iter; } Index: src/libchcore/TTaskInfo.h =================================================================== diff -u -N -rfc67a825635691930b3ac00dc95b16e59f3d2fae -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskInfo.h (.../TTaskInfo.h) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TTaskInfo.h (.../TTaskInfo.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -49,9 +49,9 @@ public: TTaskInfoEntry(); - TTaskInfoEntry(taskid_t tTaskID, const TSmartPath& pathTask, int iOrder, const TTaskPtr& spTask); + TTaskInfoEntry(object_id_t oidTaskID, const TSmartPath& pathTask, int iOrder, const TTaskPtr& spTask); - size_t GetObjectID() const; + object_id_t GetObjectID() const; TSmartPath GetTaskSerializeLocation() const; void SetTaskSerializeLocation(const TSmartPath& pathTask); @@ -71,7 +71,7 @@ private: #pragma warning(push) #pragma warning(disable:4251) - size_t m_stObjectID; + object_id_t m_oidObjectID; typedef std::bitset Bitset; mutable std::bitset m_setModifications; TSharedModificationTracker m_pathSerializeLocation; @@ -92,7 +92,7 @@ TTaskInfoEntry& GetAt(size_t stIndex); const TTaskInfoEntry& GetAt(size_t stIndex) const; - TTaskInfoEntry& GetAtOid(size_t stObjectID); + TTaskInfoEntry& GetAtOid(object_id_t oidObjectID); bool GetByTaskID(taskid_t tTaskID, TTaskInfoEntry& rInfo) const; @@ -115,7 +115,7 @@ std::vector m_vTaskInfos; mutable TRemovedObjects m_setRemovedTasks; #pragma warning(pop) - size_t m_stLastObjectID; + object_id_t m_oidLastObjectID; }; END_CHCORE_NAMESPACE Index: src/libchcore/TTaskLocalStats.cpp =================================================================== diff -u -N -rffdee64cb0f2d472bb4102abe80ee12783e794c8 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) +++ src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -189,7 +189,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("id"), ColumnType::value); rColumns.AddColumn(_T("elapsed_time"), IColumnsDefinition::eType_ulonglong); } } Index: src/libchcore/TTaskManager.cpp =================================================================== diff -u -N -rc9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision c9092a6f41bed1c132d5d5ddfe430e8b3ddd70ca) +++ src/libchcore/TTaskManager.cpp (.../TTaskManager.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -478,7 +478,7 @@ } // retrieve information about tasks to load - std::vector > vObjects; + std::vector > vObjects; { boost::shared_lock lock(m_lock); @@ -490,7 +490,7 @@ } } - typedef std::pair PairInfo; + typedef std::pair PairInfo; BOOST_FOREACH(const PairInfo& rInfo, vObjects) { IFeedbackHandlerPtr spHandler = m_spFeedbackFactory->Create(); Index: src/libchcore/TTaskOperationPlan.cpp =================================================================== diff -u -N -r548382442cbf7bed7f744b279ce3f66b54992724 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision 548382442cbf7bed7f744b279ce3f66b54992724) +++ src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -22,8 +22,6 @@ // ============================================================================ #include "stdafx.h" #include "TTaskOperationPlan.h" -#include "TBinarySerializer.h" -#include "SerializationHelpers.h" #include "TCoreException.h" #include "ErrorCodes.h" @@ -131,16 +129,4 @@ return m_vSubOperations[stIndex].second; } -void TOperationPlan::Serialize(TReadBinarySerializer& rSerializer) -{ - EOperationType eOperation = eOperation_None; - Serializers::Serialize(rSerializer, eOperation); - SetOperationType(eOperation); -} - -void TOperationPlan::Serialize(TWriteBinarySerializer& rSerializer) const -{ - Serializers::Serialize(rSerializer, GetOperationType()); -} - END_CHCORE_NAMESPACE Index: src/libchcore/TTaskOperationPlan.h =================================================================== diff -u -N -r835e0344e9677ff02eb3b539061c48c9f3a616ce -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TTaskOperationPlan.h (.../TTaskOperationPlan.h) (revision 835e0344e9677ff02eb3b539061c48c9f3a616ce) +++ src/libchcore/TTaskOperationPlan.h (.../TTaskOperationPlan.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -29,9 +29,6 @@ BEGIN_CHCORE_NAMESPACE -class TReadBinarySerializer; -class TWriteBinarySerializer; - /////////////////////////////////////////////////////////////////////////// // TOperationPlan @@ -48,9 +45,6 @@ void SetOperationType(EOperationType eOperation); EOperationType GetOperationType() const; - void Serialize(TReadBinarySerializer& rSerializer); - void Serialize(TWriteBinarySerializer& rSerializer) const; - private: size_t GetSubOperationsCount() const; ESubOperationType GetSubOperationAt(size_t stIndex) const; Index: src/libchcore/TaskID.h =================================================================== diff -u -N -rb1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/TaskID.h (.../TaskID.h) (revision b1ecc12ba4c1f2a7b4acd6e82fc4193535e55ff0) +++ src/libchcore/TaskID.h (.../TaskID.h) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -20,10 +20,11 @@ #define __TASKID_H__ #include "libchcore.h" +#include "SerializerDataTypes.h" BEGIN_CHCORE_NAMESPACE -typedef size_t taskid_t; +typedef object_id_t taskid_t; enum ENoTaskID { NoTaskID = 0 }; END_CHCORE_NAMESPACE Index: src/libchcore/Tests/TestsTSmartPath.cpp =================================================================== diff -u -N -r87d0eedf59f1fce036b73f21506464803f4e8063 -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/Tests/TestsTSmartPath.cpp (.../TestsTSmartPath.cpp) (revision 87d0eedf59f1fce036b73f21506464803f4e8063) +++ src/libchcore/Tests/TestsTSmartPath.cpp (.../TestsTSmartPath.cpp) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -1106,15 +1106,3 @@ path.FromString(_T("some path")); EXPECT_EQ(9, path.GetLength()); } - -/* -bool IsEmpty() const; -size_t GetLength() const; - -// Serialization -void Serialize(TReadBinarySerializer& rSerializer); -void Serialize(TWriteBinarySerializer& rSerializer) const; - -void StoreInConfig(TConfig& rConfig, PCTSTR pszPropName) const; -bool ReadFromConfig(const TConfig& rConfig, PCTSTR pszPropName); -*/ Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -N -r5324d0ca7af614cb066df1f121a7a338c4f7d7ed -ra44714d5c7ec0f50a376f4d0ea919ee5a224f834 --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision 5324d0ca7af614cb066df1f121a7a338c4f7d7ed) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision a44714d5c7ec0f50a376f4d0ea919ee5a224f834) @@ -976,6 +976,10 @@ Name="Tools" > + + @@ -1000,10 +1004,6 @@ > - - @@ -1024,14 +1024,6 @@ > - - - - @@ -1412,6 +1404,10 @@ > + +