Index: src/libchcore/IColumnsDefinition.h =================================================================== diff -u -r9479911a096555a7504c5c8a8eaee83ecb63440c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision 9479911a096555a7504c5c8a8eaee83ecb63440c) +++ src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -40,7 +40,7 @@ virtual IColumnsDefinition& operator%(const TString& strColName) = 0; }; -typedef boost::shared_ptr IColumnsDefinitionPtr; +//typedef boost::shared_ptr IColumnsDefinitionPtr; END_CHCORE_NAMESPACE Index: src/libchcore/ISerializerContainer.h =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/ISerializerContainer.h (.../ISerializerContainer.h) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/ISerializerContainer.h (.../ISerializerContainer.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -35,7 +35,7 @@ virtual ~ISerializerContainer(); // columns - virtual IColumnsDefinitionPtr GetColumnsDefinition() const = 0; + virtual IColumnsDefinition& GetColumnsDefinition() = 0; // prepare data to be stored virtual ISerializerRowDataPtr AddRow(size_t stRowID) = 0; Index: src/libchcore/ISerializerRowReader.h =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/ISerializerRowReader.h (.../ISerializerRowReader.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/ISerializerRowReader.h (.../ISerializerRowReader.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -31,7 +31,7 @@ public: virtual ~ISerializerRowReader(); - virtual IColumnsDefinitionPtr GetColumnsDefinitions() const = 0; + virtual IColumnsDefinition& GetColumnsDefinitions() const = 0; virtual bool Next() = 0; Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -114,12 +114,9 @@ m_setModifications.reset(); } -void TBasePathData::InitLoader(const IColumnsDefinitionPtr& spColumnDefs) +void TBasePathData::InitLoader(IColumnsDefinition& rColumnDefs) { - if(!spColumnDefs) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); - - *spColumnDefs % _T("id") % _T("src_path") % _T("skip_processing") % _T("dst_path"); + rColumnDefs % _T("id") % _T("src_path") % _T("skip_processing") % _T("dst_path"); } void TBasePathData::Load(const ISerializerRowReaderPtr& spRowReader) @@ -191,9 +188,9 @@ m_vEntries.clear(); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - TBasePathData::InitLoader(spRowReader->GetColumnsDefinitions()); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + TBasePathData::InitLoader(rColumns); while(spRowReader->Next()) { Index: src/libchcore/TBasePathData.h =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TBasePathData.h (.../TBasePathData.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -70,7 +70,7 @@ bool IsDestinationPathSet() const; void Store(const ISerializerContainerPtr& spContainer) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumnDefs); + static void InitLoader(IColumnsDefinition& rColumnDefs); void Load(const ISerializerRowReaderPtr& spRowReader); private: Index: src/libchcore/TConfig.cpp =================================================================== diff -u -r87049cc3ff8e2886cfbe078d0ab81d3556eba8ea -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision 87049cc3ff8e2886cfbe078d0ab81d3556eba8ea) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -177,9 +177,9 @@ m_pImpl->m_mic.clear(); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - *spColumns % _T("name") % _T("node_order") % _T("value"); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + rColumns % _T("name") % _T("node_order") % _T("value"); while(spRowReader->Next()) { Index: src/libchcore/TFileFilter.cpp =================================================================== diff -u -rb193a95402f2bf4c456fb9d65d111caaf6994823 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -536,9 +536,9 @@ } } -void TFileFilter::SetupLoader(const IColumnsDefinitionPtr& spColumns) +void TFileFilter::SetupLoader(IColumnsDefinition& rColumns) { - *spColumns + rColumns % _T("id") % _T("use_mask") % _T("mask") Index: src/libchcore/TFileFilter.h =================================================================== diff -u -rb193a95402f2bf4c456fb9d65d111caaf6994823 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileFilter.h (.../TFileFilter.h) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TFileFilter.h (.../TFileFilter.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -79,7 +79,7 @@ void Store(const ISerializerContainerPtr& spContainer) const; void Load(const ISerializerRowReaderPtr& spRowReader); - static void SetupLoader(const IColumnsDefinitionPtr& spColumns); + static void SetupLoader(IColumnsDefinition& rColumns); // other size_t GetObjectID() const; Index: src/libchcore/TFileFiltersArray.cpp =================================================================== diff -u -rb193a95402f2bf4c456fb9d65d111caaf6994823 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileFiltersArray.cpp (.../TFileFiltersArray.cpp) (revision b193a95402f2bf4c456fb9d65d111caaf6994823) +++ src/libchcore/TFileFiltersArray.cpp (.../TFileFiltersArray.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -162,9 +162,9 @@ void TFileFiltersArray::Load(const ISerializerContainerPtr& spContainer) { - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) - TFileFilter::SetupLoader(spColumns); + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) + TFileFilter::SetupLoader(rColumns); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); while(spRowReader->Next()) Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -277,9 +277,9 @@ m_setModifications.reset(); } -void TFileInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) +void TFileInfo::InitLoader(IColumnsDefinition& rColumns) { - *spColumns % _T("id") % _T("rel_path") % _T("base_path_id") % _T("attr") % _T("size") % _T("time_created") % _T("time_last_write") % _T("time_last_access") % _T("flags"); + rColumns % _T("id") % _T("rel_path") % _T("base_path_id") % _T("attr") % _T("size") % _T("time_created") % _T("time_last_write") % _T("time_last_access") % _T("flags"); } void TFileInfo::Load(const ISerializerRowReaderPtr& spRowReader, const TBasePathDataContainerPtr& spSrcContainer) Index: src/libchcore/TFileInfo.h =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TFileInfo.h (.../TFileInfo.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -99,7 +99,7 @@ bool IsProcessed() const; void Store(const ISerializerContainerPtr& spContainer) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumns); + static void InitLoader(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader, const TBasePathDataContainerPtr& spSrcContainer); private: Index: src/libchcore/TFileInfoArray.cpp =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TFileInfoArray.cpp (.../TFileInfoArray.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -149,9 +149,9 @@ void TFileInfoArray::Load(const ISerializerContainerPtr& spContainer, const TBasePathDataContainerPtr& spBasePaths) { - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) - TFileInfo::InitLoader(spColumns); + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) + TFileInfo::InitLoader(rColumns); std::vector vEntries; ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); Index: src/libchcore/TModPathContainer.cpp =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -309,8 +309,8 @@ m_vPaths.clear(); m_stNextObjectID = 1; - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - *spColumns % _T("id") % _T("path"); + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + rColumns % _T("id") % _T("path"); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); while(spRowReader->Next()) Index: src/libchcore/TSQLiteSerializerContainer.cpp =================================================================== diff -u -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) +++ src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -32,15 +32,13 @@ using namespace sqlite; TSQLiteSerializerContainer::TSQLiteSerializerContainer(const TString& strName, const sqlite::TSQLiteDatabasePtr& spDB) : - m_spColumns(new TSQLiteColumnsDefinition), m_strName(strName), m_spDB(spDB) { } TSQLiteSerializerContainer::TSQLiteSerializerContainer(const TString& strName, size_t stParentID, const sqlite::TSQLiteDatabasePtr& spDB) : m_stParentID(stParentID), - m_spColumns(new TSQLiteColumnsDefinition), m_strName(strName), m_spDB(spDB) { @@ -53,7 +51,7 @@ chcore::ISerializerRowDataPtr TSQLiteSerializerContainer::AddRow(size_t stRowID) { RowMap::iterator iterInsert = m_mapRows.insert( - std::make_pair(stRowID, TSQLiteSerializerRowDataPtr(new TSQLiteSerializerRowData(stRowID, m_spColumns, true))) + std::make_pair(stRowID, TSQLiteSerializerRowDataPtr(new TSQLiteSerializerRowData(stRowID, m_tColumns, true))) ).first; return (*iterInsert).second; } @@ -62,7 +60,7 @@ { RowMap::iterator iterFnd = m_mapRows.find(stRowID); if(iterFnd == m_mapRows.end()) - iterFnd = m_mapRows.insert(std::make_pair(stRowID, TSQLiteSerializerRowDataPtr(new TSQLiteSerializerRowData(stRowID, m_spColumns, false)))).first; + iterFnd = m_mapRows.insert(std::make_pair(stRowID, TSQLiteSerializerRowDataPtr(new TSQLiteSerializerRowData(stRowID, m_tColumns, false)))).first; return (*iterFnd).second; } @@ -87,13 +85,13 @@ ISerializerRowReaderPtr TSQLiteSerializerContainer::GetRowReader() { - TSQLiteSerializerRowReaderPtr spRowReader(new TSQLiteSerializerRowReader(m_spDB, m_spColumns, m_strName)); + TSQLiteSerializerRowReaderPtr spRowReader(new TSQLiteSerializerRowReader(m_spDB, m_tColumns, m_strName)); return spRowReader; } -chcore::IColumnsDefinitionPtr TSQLiteSerializerContainer::GetColumnsDefinition() const +IColumnsDefinition& TSQLiteSerializerContainer::GetColumnsDefinition() { - return m_spColumns; + return m_tColumns; } void TSQLiteSerializerContainer::Flush() Index: src/libchcore/TSQLiteSerializerContainer.h =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -38,7 +38,7 @@ virtual ~TSQLiteSerializerContainer(); - virtual IColumnsDefinitionPtr GetColumnsDefinition() const; + virtual IColumnsDefinition& GetColumnsDefinition(); virtual ISerializerRowDataPtr AddRow(size_t stRowID); virtual ISerializerRowDataPtr GetRow(size_t stRowID); @@ -60,7 +60,7 @@ typedef std::map RowMap; // maps row id to row data RowMap m_mapRows; - TSQLiteColumnDefinitionPtr m_spColumns; + TSQLiteColumnsDefinition m_tColumns; std::set m_setDeleteItems; Index: src/libchcore/TSQLiteSerializerRowData.cpp =================================================================== diff -u -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) +++ src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -116,8 +116,8 @@ /////////////////////////////////////////////////////////////////////////// -TRowID::TRowID(const TSQLiteColumnDefinitionPtr& spColumnDefinition) : - m_bitset(spColumnDefinition->GetCount() + 1) // count of columns and a bit for add/modify +TRowID::TRowID(const TSQLiteColumnsDefinition& rColumnDefinition) : + m_bitset(rColumnDefinition.GetCount() + 1) // count of columns and a bit for add/modify { } @@ -161,13 +161,11 @@ } /////////////////////////////////////////////////////////////////////////// -TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, const TSQLiteColumnDefinitionPtr& spColumnDefinition, bool bAdded) : +TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded) : m_stRowID(stRowID), - m_spColumns(spColumnDefinition), + m_rColumns(rColumnDefinition), m_bAdded(bAdded) { - if(!spColumnDefinition) - THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("No column definition provided")); } TSQLiteSerializerRowData::~TSQLiteSerializerRowData() @@ -176,7 +174,7 @@ ISerializerRowData& TSQLiteSerializerRowData::operator%(const TRowData& rData) { - size_t stColumn = m_spColumns->GetColumnIndex(rData.m_strColName); + size_t stColumn = m_rColumns.GetColumnIndex(rData.m_strColName); std::map::iterator iterFnd = m_mapValues.find(stColumn); if(iterFnd == m_mapValues.end()) m_mapValues.insert(std::make_pair(stColumn, rData.m_varValue)); @@ -188,7 +186,7 @@ ISerializerRowData& TSQLiteSerializerRowData::SetValue(const TRowData& rData) { - size_t stColumn = m_spColumns->GetColumnIndex(rData.m_strColName); + size_t stColumn = m_rColumns.GetColumnIndex(rData.m_strColName); std::map::iterator iterFnd = m_mapValues.find(stColumn); if(iterFnd == m_mapValues.end()) m_mapValues.insert(std::make_pair(stColumn, rData.m_varValue)); @@ -242,7 +240,7 @@ for(MapVariants::const_iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) { - strQuery += boost::str(boost::wformat(_T("%1%,")) % m_spColumns->GetColumnName(iterVariant->first)).c_str(); + strQuery += boost::str(boost::wformat(_T("%1%,")) % m_rColumns.GetColumnName(iterVariant->first)).c_str(); strParams += _T("?,"); } @@ -262,7 +260,7 @@ for(MapVariants::const_iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) { - strQuery += boost::str(boost::wformat(_T("%1%=?,")) % m_spColumns->GetColumnName(iterVariant->first)).c_str(); + strQuery += boost::str(boost::wformat(_T("%1%=?,")) % m_rColumns.GetColumnName(iterVariant->first)).c_str(); } strQuery.TrimRightSelf(_T(",")); @@ -276,7 +274,7 @@ TRowID TSQLiteSerializerRowData::GetChangeIdentification() const { - TRowID rowID(m_spColumns); + TRowID rowID(m_rColumns); rowID.SetAddedBit(m_bAdded); for(MapVariants::const_iterator iterVariant = m_mapValues.begin(); iterVariant != m_mapValues.end(); ++iterVariant) { Index: src/libchcore/TSQLiteSerializerRowData.h =================================================================== diff -u -r5693271a6736f524997e3951fc7b7b6323bc6447 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision 5693271a6736f524997e3951fc7b7b6323bc6447) +++ src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -33,7 +33,7 @@ class LIBCHCORE_API TRowID { public: - TRowID(const TSQLiteColumnDefinitionPtr& spColumnDefinition); + TRowID(const TSQLiteColumnsDefinition& rColumnDefinition); ~TRowID(); void Clear(); @@ -55,8 +55,12 @@ class LIBCHCORE_API TSQLiteSerializerRowData : public ISerializerRowData { +private: + TSQLiteSerializerRowData(const TSQLiteSerializerRowData&); + TSQLiteSerializerRowData& operator=(const TSQLiteSerializerRowData&); + public: - TSQLiteSerializerRowData(size_t stRowID, const TSQLiteColumnDefinitionPtr& spColumnDefinition, bool bAdded); + TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded); virtual ~TSQLiteSerializerRowData(); virtual ISerializerRowData& operator%(const TRowData& rData); @@ -72,7 +76,7 @@ bool m_bAdded; #pragma warning(push) #pragma warning(disable: 4251) - TSQLiteColumnDefinitionPtr m_spColumns; + TSQLiteColumnsDefinition& m_rColumns; typedef std::map MapVariants; // column id -> variant data MapVariants m_mapValues; Index: src/libchcore/TSQLiteSerializerRowReader.cpp =================================================================== diff -u -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) +++ src/libchcore/TSQLiteSerializerRowReader.cpp (.../TSQLiteSerializerRowReader.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -27,13 +27,13 @@ BEGIN_CHCORE_NAMESPACE -TSQLiteSerializerRowReader::TSQLiteSerializerRowReader(const sqlite::TSQLiteDatabasePtr& spDatabase, const TSQLiteColumnDefinitionPtr& spColumns, const TString& strContainerName) : +TSQLiteSerializerRowReader::TSQLiteSerializerRowReader(const sqlite::TSQLiteDatabasePtr& spDatabase, TSQLiteColumnsDefinition& rColumns, const TString& strContainerName) : m_spStatement(new sqlite::TSQLiteStatement(spDatabase)), - m_spColumns(spColumns), + m_rColumns(rColumns), m_bInitialized(false), m_strContainerName(strContainerName) { - if(!m_spColumns || m_strContainerName.IsEmpty()) + if(m_strContainerName.IsEmpty()) THROW_CORE_EXCEPTION(eErr_InvalidArgument); } @@ -43,14 +43,14 @@ bool TSQLiteSerializerRowReader::Next() { - if(m_spColumns->IsEmpty()) + if(m_rColumns.IsEmpty()) THROW_CORE_EXCEPTION(eErr_SerializeLoadError); if(!m_bInitialized) { // generate query to retrieve data from db TString strQuery; - strQuery = boost::str(boost::wformat(L"SELECT %1% FROM %2% ORDER BY id") % (PCTSTR)m_spColumns->GetCommaSeparatedColumns() % (PCTSTR)m_strContainerName).c_str(); + strQuery = boost::str(boost::wformat(L"SELECT %1% FROM %2% ORDER BY id") % (PCTSTR)m_rColumns.GetCommaSeparatedColumns() % (PCTSTR)m_strContainerName).c_str(); DBTRACE1_D(_T("Executing query: %s\n"), (PCTSTR)strQuery); m_spStatement->Prepare(strQuery); @@ -161,13 +161,13 @@ if(!m_bInitialized) THROW_CORE_EXCEPTION(eErr_SerializeLoadError); - size_t stColumn = m_spColumns->GetColumnIndex(strColName); + size_t stColumn = m_rColumns.GetColumnIndex(strColName); return boost::numeric_cast(stColumn); } -IColumnsDefinitionPtr TSQLiteSerializerRowReader::GetColumnsDefinitions() const +IColumnsDefinition& TSQLiteSerializerRowReader::GetColumnsDefinitions() const { - return m_spColumns; + return m_rColumns; } END_CHCORE_NAMESPACE Index: src/libchcore/TSQLiteSerializerRowReader.h =================================================================== diff -u -ra5aa3c3cb78f3767641de2627d1a49a1dc35b429 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSQLiteSerializerRowReader.h (.../TSQLiteSerializerRowReader.h) (revision a5aa3c3cb78f3767641de2627d1a49a1dc35b429) +++ src/libchcore/TSQLiteSerializerRowReader.h (.../TSQLiteSerializerRowReader.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -28,11 +28,15 @@ class LIBCHCORE_API TSQLiteSerializerRowReader : public ISerializerRowReader { +private: + TSQLiteSerializerRowReader(const TSQLiteSerializerRowReader&); + TSQLiteSerializerRowReader& operator=(const TSQLiteSerializerRowReader&); + public: - TSQLiteSerializerRowReader(const sqlite::TSQLiteDatabasePtr& spDatabase, const TSQLiteColumnDefinitionPtr& spColumns, const TString& strContainerName); + TSQLiteSerializerRowReader(const sqlite::TSQLiteDatabasePtr& spDatabase, TSQLiteColumnsDefinition& rColumns, const TString& strContainerName); virtual ~TSQLiteSerializerRowReader(); - virtual IColumnsDefinitionPtr GetColumnsDefinitions() const; + virtual IColumnsDefinition& GetColumnsDefinitions() const; virtual bool Next(); @@ -57,7 +61,7 @@ #pragma warning(disable: 4251) bool m_bInitialized; sqlite::TSQLiteStatementPtr m_spStatement; - TSQLiteColumnDefinitionPtr m_spColumns; + TSQLiteColumnsDefinition& m_rColumns; TString m_strContainerName; #pragma warning(pop) }; Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -rc8e73b75027d5e17fb8b1e1eb40e64f40fc62547 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision c8e73b75027d5e17fb8b1e1eb40e64f40fc62547) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -257,9 +257,9 @@ ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtasks_info")); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - *spColumns % _T("id") % _T("operation"); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + rColumns % _T("id") % _T("operation"); if(spRowReader->Next()) spRowReader->GetValue(_T("operation"), *(int*)&m_eOperationType.Modify()); @@ -272,9 +272,9 @@ ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtasks")); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - *spColumns % _T("id") % _T("type") % _T("is_current") % _T("is_estimation"); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + rColumns % _T("id") % _T("type") % _T("is_current") % _T("is_estimation"); while(spRowReader->Next()) { Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -rd0bc3c187684f54894c7280a936d5507a5e49f35 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -122,9 +122,9 @@ } } - void TCopyMoveProgressInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) + void TCopyMoveProgressInfo::InitLoader(IColumnsDefinition& rColumns) { - *spColumns % _T("current_index") % _T("cf_processed_size"); + rColumns % _T("current_index") % _T("cf_processed_size"); } void TCopyMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) @@ -1333,11 +1333,11 @@ { ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_copymove")); - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) { - details::TCopyMoveProgressInfo::InitLoader(spColumns); - TSubTaskStatsInfo::InitLoader(spColumns); + details::TCopyMoveProgressInfo::InitLoader(rColumns); + TSubTaskStatsInfo::InitLoader(rColumns); } ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); Index: src/libchcore/TSubTaskCopyMove.h =================================================================== diff -u -rd0bc3c187684f54894c7280a936d5507a5e49f35 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) +++ src/libchcore/TSubTaskCopyMove.h (.../TSubTaskCopyMove.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -64,7 +64,7 @@ void DecreaseCurrentFileProcessedSize(unsigned long long ullSizeToSubtract); void Store(const ISerializerRowDataPtr& spRowData) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumns); + static void InitLoader(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader); bool WasSerialized() const; Index: src/libchcore/TSubTaskDelete.cpp =================================================================== diff -u -r19925be73ffcadd9f345f10e03e55aadb3f0eeac -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 19925be73ffcadd9f345f10e03e55aadb3f0eeac) +++ src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -87,9 +87,9 @@ } } - void TDeleteProgressInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) + void TDeleteProgressInfo::InitLoader(IColumnsDefinition& rColumns) { - *spColumns % _T("current_index"); + rColumns % _T("current_index"); } void TDeleteProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) @@ -268,11 +268,11 @@ { ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_delete")); - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) { - details::TDeleteProgressInfo::InitLoader(spColumns); - TSubTaskStatsInfo::InitLoader(spColumns); + details::TDeleteProgressInfo::InitLoader(rColumns); + TSubTaskStatsInfo::InitLoader(rColumns); } ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); Index: src/libchcore/TSubTaskDelete.h =================================================================== diff -u -r19925be73ffcadd9f345f10e03e55aadb3f0eeac -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision 19925be73ffcadd9f345f10e03e55aadb3f0eeac) +++ src/libchcore/TSubTaskDelete.h (.../TSubTaskDelete.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -49,7 +49,7 @@ size_t GetCurrentIndex() const; void Store(const ISerializerRowDataPtr& spRowData) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumns); + static void InitLoader(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader); bool WasSerialized() const; Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -r19925be73ffcadd9f345f10e03e55aadb3f0eeac -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 19925be73ffcadd9f345f10e03e55aadb3f0eeac) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -89,9 +89,9 @@ } } - void TFastMoveProgressInfo::InitLoader(const IColumnsDefinitionPtr& spColumns) + void TFastMoveProgressInfo::InitLoader(IColumnsDefinition& rColumns) { - *spColumns % _T("current_index"); + rColumns % _T("current_index"); } void TFastMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) @@ -327,11 +327,11 @@ { ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_fastmove")); - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) { - details::TFastMoveProgressInfo::InitLoader(spColumns); - TSubTaskStatsInfo::InitLoader(spColumns); + details::TFastMoveProgressInfo::InitLoader(rColumns); + TSubTaskStatsInfo::InitLoader(rColumns); } ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); Index: src/libchcore/TSubTaskFastMove.h =================================================================== diff -u -r19925be73ffcadd9f345f10e03e55aadb3f0eeac -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision 19925be73ffcadd9f345f10e03e55aadb3f0eeac) +++ src/libchcore/TSubTaskFastMove.h (.../TSubTaskFastMove.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -51,7 +51,7 @@ size_t GetCurrentIndex() const; void Store(const ISerializerRowDataPtr& spRowData) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumns); + static void InitLoader(IColumnsDefinition& rColumns); void Load(const ISerializerRowReaderPtr& spRowReader); bool WasSerialized() const; Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -rd0bc3c187684f54894c7280a936d5507a5e49f35 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -320,12 +320,9 @@ m_setModifications.reset(); } -void TSubTaskStatsInfo::InitLoader(const IColumnsDefinitionPtr& spColumnDefs) +void TSubTaskStatsInfo::InitLoader(IColumnsDefinition& rColumnDefs) { - if(!spColumnDefs) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); - - *spColumnDefs + rColumnDefs % _T("is_running") % _T("is_initialized") % _T("total_size") Index: src/libchcore/TSubTaskStatsInfo.h =================================================================== diff -u -rd0bc3c187684f54894c7280a936d5507a5e49f35 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision d0bc3c187684f54894c7280a936d5507a5e49f35) +++ src/libchcore/TSubTaskStatsInfo.h (.../TSubTaskStatsInfo.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -100,7 +100,7 @@ // serialization void Store(const ISerializerRowDataPtr& spRowData) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumnDefs); + static void InitLoader(IColumnsDefinition& rColumnDefs); void Load(const ISerializerRowReaderPtr& spRowReader); private: Index: src/libchcore/TTaskBaseData.cpp =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -112,9 +112,9 @@ { ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - *spColumns % _T("name") % _T("log_path") % _T("current_state") % _T("destination_path"); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + rColumns % _T("name") % _T("log_path") % _T("current_state") % _T("destination_path"); bool bResult = spRowReader->Next(); if(bResult) Index: src/libchcore/TTaskInfo.cpp =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -102,12 +102,9 @@ m_setModifications.reset(); } -void TTaskInfoEntry::InitLoader(const IColumnsDefinitionPtr& spColumnDefs) +void TTaskInfoEntry::InitLoader(IColumnsDefinition& rColumnDefs) { - if(!spColumnDefs) - THROW_CORE_EXCEPTION(eErr_InvalidPointer); - - *spColumnDefs % _T("id") % _T("path") % _T("task_order"); + rColumnDefs % _T("id") % _T("path") % _T("task_order"); } size_t TTaskInfoEntry::GetObjectID() const @@ -216,9 +213,9 @@ void TTaskInfoContainer::Load(const ISerializerContainerPtr& spContainer) { ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); - IColumnsDefinitionPtr spColumns = spRowReader->GetColumnsDefinitions(); - if(spColumns->IsEmpty()) - TTaskInfoEntry::InitLoader(spColumns); + IColumnsDefinition& rColumns = spRowReader->GetColumnsDefinitions(); + if(rColumns.IsEmpty()) + TTaskInfoEntry::InitLoader(rColumns); TTaskInfoEntry tEntry; while(spRowReader->Next()) Index: src/libchcore/TTaskInfo.h =================================================================== diff -u -r293e52b38d46653068006262172018a0f0d0a31c -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TTaskInfo.h (.../TTaskInfo.h) (revision 293e52b38d46653068006262172018a0f0d0a31c) +++ src/libchcore/TTaskInfo.h (.../TTaskInfo.h) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -63,7 +63,7 @@ void SetOrder(int iOrder); void Store(const ISerializerContainerPtr& spContainer) const; - static void InitLoader(const IColumnsDefinitionPtr& spColumnDefs); + static void InitLoader(IColumnsDefinition& rColumnDefs); void Load(const ISerializerRowReaderPtr& spRowReader); void ResetModifications(); Index: src/libchcore/TTaskLocalStats.cpp =================================================================== diff -u -r320c4eb6ba3a38dcd6fbda6a9a12a8350a153e41 -r081055369d6b332ef1651877756657973b1b2d9c --- src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision 320c4eb6ba3a38dcd6fbda6a9a12a8350a153e41) +++ src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision 081055369d6b332ef1651877756657973b1b2d9c) @@ -175,9 +175,9 @@ { boost::unique_lock lock(m_lock); - IColumnsDefinitionPtr spColumns = spContainer->GetColumnsDefinition(); - if(spColumns->IsEmpty()) - *spColumns % _T("id") % _T("elapsed_time"); + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) + rColumns % _T("id") % _T("elapsed_time"); ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); if(spRowReader->Next())