NCBI C++ ToolKit
data_source.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

00001 #ifndef OBJECTS_OBJMGR_IMPL___DATA_SOURCE__HPP
00002 #define OBJECTS_OBJMGR_IMPL___DATA_SOURCE__HPP
00003 
00004 /*  $Id: data_source.hpp 64301 2014-09-03 13:27:28Z vasilche $
00005 * ===========================================================================
00006 *
00007 *                            PUBLIC DOMAIN NOTICE
00008 *               National Center for Biotechnology Information
00009 *
00010 *  This software/database is a "United States Government Work" under the
00011 *  terms of the United States Copyright Act.  It was written as part of
00012 *  the author's official duties as a United States Government employee and
00013 *  thus cannot be copyrighted.  This software/database is freely available
00014 *  to the public for use. The National Library of Medicine and the U.S.
00015 *  Government have not placed any restriction on its use or reproduction.
00016 *
00017 *  Although all reasonable efforts have been taken to ensure the accuracy
00018 *  and reliability of the software and data, the NLM and the U.S.
00019 *  Government do not and cannot warrant the performance or results that
00020 *  may be obtained by using this software or data. The NLM and the U.S.
00021 *  Government disclaim all warranties, express or implied, including
00022 *  warranties of performance, merchantability or fitness for any particular
00023 *  purpose.
00024 *
00025 *  Please cite the author in any work or product based on this material.
00026 *
00027 * ===========================================================================
00028 *
00029 * Author: Aleksey Grichenko, Michael Kimelman, Eugene Vasilchenko
00030 *
00031 * File Description:
00032 *   Data source for object manager
00033 *
00034 */
00035 
00036 #include <objmgr/impl/tse_info.hpp>
00037 
00038 #include <objects/seq/Seq_inst.hpp>
00039 #include <objmgr/data_loader.hpp>
00040 
00041 #include <corelib/ncbimtx.hpp>
00042 
00043 //#define DEBUG_MAPS
00044 #ifdef DEBUG_MAPS
00045 # include <util/debug/map.hpp>
00046 # include <util/debug/set.hpp>
00047 #endif
00048 
00049 #include <set>
00050 #include <map>
00051 #include <list>
00052 #include <vector>
00053 
00054 BEGIN_NCBI_SCOPE
00055 BEGIN_SCOPE(objects)
00056 
00057 // objects
00058 class CDelta_seq;
00059 class CDelta_ext;
00060 class CSeq_interval;
00061 class CSeq_data;
00062 class CSeq_entry;
00063 class CSeq_annot;
00064 class CBioseq;
00065 class CBioseq_set;
00066 
00067 // infos
00068 class CTSE_Info;
00069 class CSeq_entry_Info;
00070 class CSeq_annot_Info;
00071 class CBioseq_set_Info;
00072 class CBioseq_Info;
00073 
00074 // others
00075 class CBioseq_Handle;
00076 class CPrefetchTokenOld_Impl;
00077 class CPrefetchThreadOld;
00078 class CDSAnnotLockReadGuard;
00079 class CDSAnnotLockWriteGuard;
00080 class CScope_Impl;
00081 
00082 /*
00083 struct SBlobIdComp
00084 {
00085     typedef CConstRef<CObject>                      TBlobId;
00086 
00087     SBlobIdComp(CDataLoader* dl = 0)
00088         : m_DataLoader(dl)
00089         {
00090         }
00091 
00092     bool operator()(const TBlobId& id1, const TBlobId& id2) const
00093         {
00094             if ( m_DataLoader ) {
00095                 return m_DataLoader->LessBlobId(id1, id2);
00096             }
00097             else {
00098                 return id1 < id2;
00099             }
00100         }
00101         
00102     CRef<CDataLoader> m_DataLoader;
00103 };
00104 */
00105 
00106 struct SSeqMatch_DS : public SSeqMatch_TSE
00107 {
00108     SSeqMatch_DS(void)
00109         {
00110         }
00111     SSeqMatch_DS(const CTSE_Lock& tse_lock, const CSeq_id_Handle& id)
00112         : SSeqMatch_TSE(tse_lock->GetSeqMatch(id)),
00113           m_TSE_Lock(tse_lock)
00114         {
00115         }
00116 
00117     CTSE_Lock               m_TSE_Lock;
00118 };
00119 
00120 
00121 class NCBI_XOBJMGR_EXPORT CDataSource : public CObject
00122 {
00123 public:
00124     /// 'ctors
00125     CDataSource(void);
00126     CDataSource(CDataLoader& loader);
00127     CDataSource(const CObject& shared_object, const CSeq_entry& entry);
00128     virtual ~CDataSource(void);
00129 
00130     // typedefs
00131     typedef int                                     TPriority;
00132     typedef CTSE_Lock                               TTSE_Lock;
00133     typedef CTSE_LockSet                            TTSE_LockSet;
00134     typedef set<CSeq_id_Handle>                     TSeq_idSet;
00135     typedef vector<pair<TTSE_Lock,CSeq_id_Handle> > TTSE_LockMatchSet;
00136     typedef CRef<CTSE_Info>                         TTSE_Ref;
00137     typedef CBlobIdKey                              TBlobId;
00138 
00139     typedef CDSAnnotLockReadGuard                   TAnnotLockReadGuard;
00140     typedef CDSAnnotLockWriteGuard                  TAnnotLockWriteGuard;
00141     typedef CRWLock TMainLock;
00142     typedef CMutex TAnnotLock;
00143     typedef CMutex TCacheLock;
00144 
00145     /// Register new TSE (Top Level Seq-entry)
00146     TTSE_Lock AddTSE(CSeq_entry& se,
00147                      CTSE_Info::TBlobState = CBioseq_Handle::fState_none);
00148     TTSE_Lock AddTSE(CSeq_entry& se,
00149                      bool dead);
00150     TTSE_Lock AddTSE(CRef<CTSE_Info> tse);
00151     TTSE_Lock AddStaticTSE(CSeq_entry& se);
00152     TTSE_Lock AddStaticTSE(CRef<CTSE_Info> tse);
00153 
00154     // Modification methods.
00155     /// Add new sub-entry to "parent".
00156     CRef<CSeq_entry_Info> AttachEntry(CBioseq_set_Info& parent,
00157                                       CSeq_entry& entry,
00158                                       int index = -1);
00159     void RemoveEntry(CSeq_entry_Info& entry);
00160 
00161     /// Add annotations to a Seq-entry.
00162     CRef<CSeq_annot_Info> AttachAnnot(CSeq_entry_Info& parent,
00163                                       CSeq_annot& annot);
00164     CRef<CSeq_annot_Info> AttachAnnot(CBioseq_Base_Info& parent,
00165                                       CSeq_annot& annot);
00166     // Remove/replace seq-annot from the given entry
00167     void RemoveAnnot(CSeq_annot_Info& annot);
00168     CRef<CSeq_annot_Info> ReplaceAnnot(CSeq_annot_Info& old_annot,
00169                                        CSeq_annot& new_annot);
00170 
00171     /// Get TSE info by seq-id handle. This should also get the list of all
00172     /// seq-ids for all bioseqs and the list of seq-ids used in annotations.
00173     //TTSE_Lock GetBlobById(const CSeq_id_Handle& idh);
00174 
00175     // Remove TSE from the datasource, update indexes
00176     void DropAllTSEs(void);
00177     bool DropStaticTSE(CTSE_Info& info);
00178     bool DropTSE(CTSE_Info& info);
00179 
00180     // Contains (or can load) any entries?
00181     bool IsEmpty(void) const;
00182     const CTSE_LockSet& GetStaticBlobs(void) const;
00183 
00184     CDataLoader* GetDataLoader(void) const;
00185     const CConstRef<CObject>& GetSharedObject(void) const;
00186     TTSE_Lock GetSharedTSE(void) const;
00187     bool CanBeEdited(void) const;
00188 
00189     void UpdateAnnotIndex(void);
00190     void UpdateAnnotIndex(const CSeq_entry_Info& entry_info);
00191     void UpdateAnnotIndex(const CSeq_annot_Info& annot_info);
00192 
00193     void GetTSESetWithOrphanAnnots(const TSeq_idSet& ids,
00194                                    TTSE_LockMatchSet& tse_set,
00195                                    const SAnnotSelector* sel);
00196     void GetTSESetWithBioseqAnnots(const CBioseq_Info& bioseq,
00197                                    const TTSE_Lock& tse,
00198                                    TTSE_LockMatchSet& tse_set,
00199                                    const SAnnotSelector* sel);
00200 
00201     // Fill the set with bioseq handles for all sequences from a given TSE.
00202     // Return empty tse lock if the entry was not found or is not a TSE.
00203     // "filter" may be used to select a particular sequence type.
00204     // "level" may be used to select bioseqs from given levels only.
00205     // Used to initialize bioseq iterators.
00206     typedef vector< CConstRef<CBioseq_Info> > TBioseq_InfoSet;
00207     typedef int TBioseqLevelFlag;
00208     void GetBioseqs(const CSeq_entry_Info& entry,
00209                     TBioseq_InfoSet& bioseqs,
00210                     CSeq_inst::EMol filter,
00211                     TBioseqLevelFlag level);
00212 
00213     SSeqMatch_DS BestResolve(const CSeq_id_Handle& idh);
00214     typedef vector<SSeqMatch_DS> TSeqMatches;
00215     TSeqMatches GetMatches(const CSeq_id_Handle& idh,
00216                            const TTSE_LockSet& locks);
00217 
00218     typedef vector<CSeq_id_Handle> TIds;
00219     void GetIds(const CSeq_id_Handle& idh, TIds& ids);
00220     CSeq_id_Handle GetAccVer(const CSeq_id_Handle& idh);
00221     TGi GetGi(const CSeq_id_Handle& idh);
00222     string GetLabel(const CSeq_id_Handle& idh);
00223     int GetTaxId(const CSeq_id_Handle& idh);
00224     TSeqPos GetSequenceLength(const CSeq_id_Handle& idh);
00225     CSeq_inst::TMol GetSequenceType(const CSeq_id_Handle& idh);
00226     int GetSequenceState(const CSeq_id_Handle& idh);
00227     int GetSequenceHash(const CSeq_id_Handle& idh);
00228 
00229     // bulk interface
00230     typedef vector<bool> TLoaded;
00231     typedef vector<TGi> TGis;
00232     typedef vector<string> TLabels;
00233     typedef vector<int> TTaxIds;
00234     typedef vector<TSeqPos> TSequenceLengths;
00235     typedef vector<CSeq_inst::TMol> TSequenceTypes;
00236     typedef vector<int> TSequenceStates;
00237     typedef vector<int> TSequenceHashes;
00238     void GetAccVers(const TIds& ids, TLoaded& loaded, TIds& ret);
00239     void GetGis(const TIds& ids, TLoaded& loaded, TGis& ret);
00240     void GetLabels(const TIds& ids, TLoaded& loaded, TLabels& ret);
00241     void GetTaxIds(const TIds& ids, TLoaded& loaded, TTaxIds& ret);
00242     void GetSequenceLengths(const TIds& ids, TLoaded& loaded,
00243                             TSequenceLengths& ret);
00244     void GetSequenceTypes(const TIds& ids, TLoaded& loaded,
00245                           TSequenceTypes& ret);
00246     void GetSequenceStates(const TIds& ids, TLoaded& loaded,
00247                            TSequenceStates& ret);
00248     void GetSequenceHashes(const TIds& ids, TLoaded& loaded,
00249                            TSequenceHashes& ret);
00250 
00251     typedef map<CSeq_id_Handle, SSeqMatch_DS>       TSeqMatchMap;
00252     void GetBlobs(TSeqMatchMap& match_map);
00253 
00254     bool IsLive(const CTSE_Info& tse);
00255 
00256     string GetName(void) const;
00257 
00258     TPriority GetDefaultPriority(void) const;
00259     void SetDefaultPriority(TPriority priority);
00260 
00261     // get locks
00262     enum FLockFlags {
00263         fLockNoHistory = 1<<0,
00264         fLockNoManual  = 1<<1,
00265         fLockNoThrow   = 1<<2
00266     };
00267     typedef int TLockFlags;
00268     TTSE_Lock x_LockTSE(const CTSE_Info& tse_info,
00269                         const TTSE_LockSet& locks,
00270                         TLockFlags = 0);
00271     CTSE_LoadLock GetTSE_LoadLock(const TBlobId& blob_id);
00272     CTSE_LoadLock GetTSE_LoadLockIfLoaded(const TBlobId& blob_id);
00273     bool IsLoaded(const CTSE_Info& tse) const;
00274     void SetLoaded(CTSE_LoadLock& lock);
00275 
00276     typedef pair<CConstRef<CSeq_entry_Info>, TTSE_Lock> TSeq_entry_Lock;
00277     typedef pair<CConstRef<CSeq_annot_Info>, TTSE_Lock> TSeq_annot_Lock;
00278     typedef pair<TSeq_annot_Lock, int> TSeq_feat_Lock;
00279     typedef pair<CConstRef<CBioseq_set_Info>, TTSE_Lock> TBioseq_set_Lock;
00280     typedef pair<CConstRef<CBioseq_Info>, TTSE_Lock> TBioseq_Lock;
00281 
00282     TSeq_entry_Lock GetSeq_entry_Lock(const CBlobIdKey& blob_id);
00283 
00284     TTSE_Lock FindTSE_Lock(const CSeq_entry& entry,
00285                            const TTSE_LockSet& history) const;
00286     TSeq_entry_Lock FindSeq_entry_Lock(const CSeq_entry& entry,
00287                                        const TTSE_LockSet& history) const;
00288     TSeq_annot_Lock FindSeq_annot_Lock(const CSeq_annot& annot,
00289                                        const TTSE_LockSet& history) const;
00290     TBioseq_set_Lock FindBioseq_set_Lock(const CBioseq_set& seqset,
00291                                        const TTSE_LockSet& history) const;
00292     TBioseq_Lock FindBioseq_Lock(const CBioseq& bioseq,
00293                                  const TTSE_LockSet& history) const;
00294     TSeq_feat_Lock FindSeq_feat_Lock(const CSeq_id_Handle& loc_id,
00295                                      TSeqPos loc_pos,
00296                                      const CSeq_feat& feat) const;
00297 
00298     typedef vector<TBlobId> TLoadedBlob_ids;
00299     enum {
00300         fLoaded_bioseqs       = 1<<0,
00301         fLoaded_bioseq_annots = 1<<1,
00302         fLoaded_orphan_annots = 1<<2,
00303         fLoaded_annots        = fLoaded_bioseq_annots | fLoaded_orphan_annots,
00304         fLoaded_all           = fLoaded_bioseqs | fLoaded_annots
00305     };
00306     typedef int TLoadedTypes;
00307     void GetLoadedBlob_ids(const CSeq_id_Handle& idh,
00308                            TLoadedTypes types,
00309                            TLoadedBlob_ids& blob_ids) const;
00310 
00311     virtual void Prefetch(CPrefetchTokenOld_Impl& token);
00312 
00313     TMainLock& GetMainLock() const { return m_DSMainLock; }
00314 
00315 private:
00316     // internal typedefs
00317 
00318     // blob lookup map
00319     typedef map<TBlobId, TTSE_Ref>                  TBlob_Map;
00320     // unlocked blobs cache
00321     typedef list<TTSE_Ref>                          TBlob_Cache;
00322 
00323 #ifdef DEBUG_MAPS
00324     typedef debug::set<TTSE_Ref>                    TTSE_Set;
00325     typedef debug::map<CSeq_id_Handle, TTSE_Set>    TSeq_id2TSE_Set;
00326 #else
00327     typedef set<TTSE_Ref>                           TTSE_Set;
00328     typedef map<CSeq_id_Handle, TTSE_Set>           TSeq_id2TSE_Set;
00329 #endif
00330 
00331     // registered objects
00332     typedef map<const CObject*, const CTSE_Info_Object*> TInfoMap;
00333 
00334     // friend classes
00335     friend class CAnnotTypes_CI; // using mutex etc.
00336     friend class CBioseq_Handle; // using mutex
00337     friend class CGBDataLoader;  //
00338     friend class CTSE_Info;
00339     friend class CTSE_Split_Info;
00340     friend class CTSE_Lock;
00341     friend class CTSE_LoadLock;
00342     friend class CSeq_entry_Info;
00343     friend class CSeq_annot_Info;
00344     friend class CBioseq_set_Info;
00345     friend class CBioseq_Info;
00346     friend class CPrefetchTokenOld_Impl;
00347     friend class CScope_Impl;
00348     friend class CDSAnnotLockReadGuard;
00349     friend class CDSAnnotLockWriteGuard;
00350 
00351     // 
00352     void x_SetLock(CTSE_Lock& lock, CConstRef<CTSE_Info> tse) const;
00353     //void x_SetLoadLock(CTSE_LoadLock& lock, CRef<CTSE_Info> tse) const;
00354     void x_ReleaseLastLock(CTSE_Lock& lock);
00355     void x_SetLoadLock(CTSE_LoadLock& loadlock, CTSE_Lock& lock);
00356     void x_SetLoadLock(CTSE_LoadLock& loadlock,
00357                        CTSE_Info& tse, CRef<CTSE_Info::CLoadMutex> load_mutex);
00358     void x_ReleaseLastLoadLock(CTSE_LoadLock& lock);
00359     void x_ReleaseLastTSELock(CRef<CTSE_Info> info);
00360 
00361     // attach, detach, index & unindex methods
00362     // TSE
00363     void x_ForgetTSE(CRef<CTSE_Info> info);
00364     void x_DropTSE(CRef<CTSE_Info> info);
00365 
00366     void x_Map(const CObject* obj, const CTSE_Info_Object* info);
00367     void x_Unmap(const CObject* obj, const CTSE_Info_Object* info);
00368 
00369     // lookup Xxx_Info objects
00370     // TSE
00371     CConstRef<CTSE_Info>
00372     x_FindTSE_Info(const CSeq_entry& tse) const;
00373     // Seq-entry
00374     CConstRef<CSeq_entry_Info>
00375     x_FindSeq_entry_Info(const CSeq_entry& entry) const;
00376     // Bioseq
00377     CConstRef<CBioseq_Info>
00378     x_FindBioseq_Info(const CBioseq& seq) const;
00379     // Seq-annot
00380     CConstRef<CSeq_annot_Info>
00381     x_FindSeq_annot_Info(const CSeq_annot& annot) const;
00382     CConstRef<CBioseq_set_Info>
00383     x_FindBioseq_set_Info(const CBioseq_set& seqset) const;
00384 
00385     // Find the seq-entry with best bioseq for the seq-id handle.
00386     // The best bioseq is the bioseq from the live TSE or from the
00387     // only one TSE containing the ID (no matter live or dead).
00388     // If no matches were found, return 0.
00389     TTSE_Lock x_FindBestTSE(const CSeq_id_Handle& handle,
00390                             const TTSE_LockSet& locks);
00391     SSeqMatch_DS x_GetSeqMatch(const CSeq_id_Handle& idh,
00392                                const TTSE_LockSet& locks);
00393 
00394     void x_SetDirtyAnnotIndex(CTSE_Info& tse);
00395     void x_ResetDirtyAnnotIndex(CTSE_Info& tse);
00396 
00397     void x_IndexTSE(TSeq_id2TSE_Set& tse_map,
00398                     const CSeq_id_Handle& id, CTSE_Info* tse_info);
00399     void x_UnindexTSE(TSeq_id2TSE_Set& tse_map,
00400                       const CSeq_id_Handle& id, CTSE_Info* tse_info);
00401     void x_IndexSeqTSE(const CSeq_id_Handle& idh, CTSE_Info* tse_info);
00402     void x_IndexSeqTSE(const vector<CSeq_id_Handle>& idh, CTSE_Info* tse_info);
00403     void x_UnindexSeqTSE(const CSeq_id_Handle& ids, CTSE_Info* tse_info);
00404     void x_IndexAnnotTSE(const CSeq_id_Handle& idh,
00405                          CTSE_Info* tse_info,
00406                          bool orphan);
00407     void x_UnindexAnnotTSE(const CSeq_id_Handle& idh,
00408                            CTSE_Info* tse_info,
00409                            bool orphan);
00410     void x_IndexAnnotTSEs(CTSE_Info* tse_info);
00411     void x_UnindexAnnotTSEs(CTSE_Info* tse_info);
00412 
00413     // Global cleanup -- search for unlocked TSEs and drop them.
00414     void x_CleanupUnusedEntries(void);
00415 
00416     // Change live/dead status of a TSE
00417     void x_CollectBioseqs(const CSeq_entry_Info& info,
00418                           TBioseq_InfoSet& bioseqs,
00419                           CSeq_inst::EMol filter,
00420                           TBioseqLevelFlag level);
00421 
00422     // choice should be only eBioseqCore, eExtAnnot, or eOrphanAnnot
00423     TTSE_LockSet x_GetRecords(const CSeq_id_Handle& idh,
00424                               CDataLoader::EChoice choice);
00425 
00426     void x_AddTSEAnnots(TTSE_LockMatchSet& ret,
00427                         const CSeq_id_Handle& id,
00428                         const CTSE_Lock& tse_lock);
00429     void x_AddTSEBioseqAnnots(TTSE_LockMatchSet& ret,
00430                               const CBioseq_Info& bioseq,
00431                               const CTSE_Lock& tse_lock);
00432     void x_AddTSEOrphanAnnots(TTSE_LockMatchSet& ret,
00433                               const TSeq_idSet& ids,
00434                               const CTSE_Lock& tse_lock);
00435 
00436     // Used to lock: m_*_InfoMap, m_TSE_seq
00437     // Is locked before locks in CTSE_Info
00438     mutable TMainLock     m_DSMainLock;
00439     // Used to lock: m_TSE_annot, m_TSE_annot_is_dirty
00440     // Is locked after locks in CTSE_Info
00441     mutable TAnnotLock    m_DSAnnotLock;
00442     // Used to lock: m_TSE_Cache, CTSE_Info::m_CacheState, m_TSE_Map
00443     mutable TCacheLock    m_DSCacheLock;
00444 
00445     CRef<CDataLoader>     m_Loader;
00446     CConstRef<CObject>    m_SharedObject;
00447     TTSE_LockSet          m_StaticBlobs;        // manually added TSEs
00448 
00449     TInfoMap              m_InfoMap;            // All known TSE objects
00450 
00451     TSeq_id2TSE_Set       m_TSE_seq;            // id -> TSE with bioseq
00452     TSeq_id2TSE_Set       m_TSE_seq_annot;      // id -> TSE with bioseq annots
00453     TSeq_id2TSE_Set       m_TSE_orphan_annot;   // id -> TSE with orphan annots
00454     TTSE_Set              m_DirtyAnnot_TSEs;    // TSE with uninexed annots
00455 
00456     // Default priority for the datasource
00457     TPriority             m_DefaultPriority;
00458 
00459     TBlob_Map             m_Blob_Map;       // TBlobId -> CTSE_Info
00460     mutable TBlob_Cache   m_Blob_Cache;     // unlocked blobs
00461     mutable size_t        m_Blob_Cache_Size;// list<>::size() is slow
00462 
00463     // Prefetching thread and lock, used when initializing the thread
00464     CRef<CPrefetchThreadOld> m_PrefetchThread;
00465     CFastMutex            m_PrefetchLock;
00466 
00467     // hide copy constructor
00468     CDataSource(const CDataSource&);
00469     CDataSource& operator=(const CDataSource&);
00470 };
00471 
00472 
00473 class NCBI_XOBJMGR_EXPORT CDSAnnotLockReadGuard
00474 {
00475 public:
00476     explicit CDSAnnotLockReadGuard(EEmptyGuard);
00477     explicit CDSAnnotLockReadGuard(CDataSource& ds);
00478 
00479     void Guard(CDataSource& ds);
00480 
00481 private:
00482     CDataSource::TMainLock::TReadLockGuard     m_MainGuard;
00483     CDataSource::TAnnotLock::TReadLockGuard    m_AnnotGuard;
00484 };
00485 
00486 
00487 class NCBI_XOBJMGR_EXPORT CDSAnnotLockWriteGuard
00488 {
00489 public:
00490     explicit CDSAnnotLockWriteGuard(EEmptyGuard);
00491     explicit CDSAnnotLockWriteGuard(CDataSource& ds);
00492 
00493     void Guard(CDataSource& ds);
00494 
00495 private:
00496     CDataSource::TMainLock::TReadLockGuard      m_MainGuard;
00497     CDataSource::TAnnotLock::TWriteLockGuard    m_AnnotGuard;
00498 };
00499 
00500 
00501 
00502 inline
00503 CDataLoader* CDataSource::GetDataLoader(void) const
00504 {
00505     return m_Loader.GetNCPointerOrNull();
00506 }
00507 
00508 
00509 inline
00510 const CConstRef<CObject>& CDataSource::GetSharedObject(void) const
00511 {
00512     return m_SharedObject;
00513 }
00514 
00515 
00516 inline
00517 bool CDataSource::CanBeEdited(void) const
00518 {
00519     return !m_Loader && !m_SharedObject;
00520 }
00521 
00522 
00523 inline
00524 bool CDataSource::IsEmpty(void) const
00525 {
00526     return m_Loader == 0  &&  m_Blob_Map.empty();
00527 }
00528 
00529 
00530 inline
00531 const CTSE_LockSet& CDataSource::GetStaticBlobs(void) const
00532 {
00533     return m_StaticBlobs;
00534 }
00535 
00536 
00537 inline
00538 bool CDataSource::IsLive(const CTSE_Info& tse)
00539 {
00540     return !tse.IsDead();
00541 }
00542 
00543 
00544 inline
00545 CDataSource::TPriority CDataSource::GetDefaultPriority(void) const
00546 {
00547     return m_DefaultPriority;
00548 }
00549 
00550 
00551 inline
00552 void CDataSource::SetDefaultPriority(TPriority priority)
00553 {
00554     m_DefaultPriority = priority;
00555 }
00556 
00557 
00558 END_SCOPE(objects)
00559 END_NCBI_SCOPE
00560 
00561 #endif  // OBJECTS_OBJMGR_IMPL___DATA_SOURCE__HPP
Modified on Wed Sep 17 18:24:34 2014 by modify_doxy.py rev. 426318