proj_tree.hpp

来自「ncbi源码」· HPP 代码 · 共 245 行

HPP
245
字号
/* * =========================================================================== * PRODUCTION $Log: proj_tree.hpp,v $ * PRODUCTION Revision 1000.2  2004/06/16 17:05:24  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== */#ifndef PROJECT_TREE_BUILDER__PROJ_TREE__HPP#define PROJECT_TREE_BUILDER__PROJ_TREE__HPP/* $Id: proj_tree.hpp,v 1000.2 2004/06/16 17:05:24 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Author:  Viatcheslav Gorelenkov * */#include <app/project_tree_builder/proj_item.hpp>#include <set>#include <app/project_tree_builder/file_contents.hpp>#include <corelib/ncbienv.hpp>BEGIN_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////////// CProjectItemsTree --////// Build tree abstraction.////// Container for project items as well as utilits for tree analysis /// and navigation.class CProjectItemsTree{public:    CProjectItemsTree(void);    CProjectItemsTree(const string& root_src);    CProjectItemsTree(const CProjectItemsTree& projects);    CProjectItemsTree& operator= (const CProjectItemsTree& projects);    ~CProjectItemsTree(void);    /// Root directory of Project Tree.    string m_RootSrc;    /// Project ID / ProjectItem.    typedef map<CProjKey, CProjItem> TProjects;    TProjects m_Projects;    /// Full file path / File contents.    typedef map<string, CSimpleMakeFileContents> TFiles;    /// Collect all depends for all project items.    void GetInternalDepends(list<CProjKey>* depends) const;    /// Get depends that are not inside this project tree.    void GetExternalDepends(list<CProjKey>* externalDepends) const;    // for navigation through the tree use class CProjectTreeFolders below.    friend class CProjectTreeBuilder;private:    //helper for CProjectTreeBuilder    static void CreateFrom(	const string&      root_src,                            const TFiles&      makein,                             const TFiles&      makelib,                             const TFiles&      makeapp,                             const TFiles&      makemsvc,                             CProjectItemsTree* tree);    void Clear(void);    void SetFrom(const CProjectItemsTree& projects);};/////////////////////////////////////////////////////////////////////////////////// CCyclicDepends --////// Analyzer of cyclic dependencies in project tree.////// Looks for dependencies cycles and report them.class CCyclicDepends{public:    typedef CProjectItemsTree::TProjects TProjects;    typedef list<CProjKey>               TDependsChain;    typedef list<TDependsChain>          TDependsChains;    typedef set <TDependsChain>          TDependsCycles;        static void FindCycles(const TProjects& tree,                           TDependsCycles*  cycles);private:    static bool IsInAnyCycle(const CProjKey&       proj_id,                             const TDependsCycles& cycles);    static void AnalyzeProjItem(const CProjKey&  proj_id,                                const TProjects& tree,                                TDependsCycles*  cycles);    static bool ExtendChains(const CProjKey&  proj_id,                              const TProjects& tree,                             TDependsChains*  chains,                             TDependsChain*   cycle_found);    static bool IsCyclic(const CProjKey&       proj_id,                          const TDependsChains& chains,                         TDependsChain*        cycle_found);};/////////////////////////////////////////////////////////////////////////////////// SProjectTreeFolder --////// Abstraction of a folder in project tree.////// One project tree folder.struct  SProjectTreeFolder{    SProjectTreeFolder()        :m_Parent(NULL)    {    }    SProjectTreeFolder(const string& name, SProjectTreeFolder* parent)        :m_Name  (name),         m_Parent(parent)    {    }    string    m_Name;        typedef map<string, SProjectTreeFolder* > TSiblings;    TSiblings m_Siblings;    typedef set<CProjKey> TProjects;    TProjects m_Projects;    SProjectTreeFolder* m_Parent;    bool IsRoot(void) const    {        return m_Parent == NULL;    }};/////////////////////////////////////////////////////////////////////////////////// CProjectTreeFolders --////// Abstraction of project tree structure.////// Creates project tree structure as a tree of SProjectTreeFolder(s).class CProjectTreeFolders{public:    CProjectTreeFolders(const CProjectItemsTree& tree);        SProjectTreeFolder m_RootParent;    typedef list<string> TPath;    SProjectTreeFolder* FindFolder(const TPath& path);    SProjectTreeFolder* FindOrCreateFolder(const TPath& path);        static void CreatePath(const string& root_src_dir,                            const string& project_base_dir,                           TPath*        path);private:    SProjectTreeFolder* CreateFolder(SProjectTreeFolder* parent,                                      const string&       folder_name);    list<SProjectTreeFolder> m_Folders;    CProjectTreeFolders(void);    CProjectTreeFolders(const CProjectTreeFolders&);    CProjectTreeFolders& operator= (const CProjectTreeFolders&);};END_NCBI_SCOPE/* * =========================================================================== * $Log: proj_tree.hpp,v $ * Revision 1000.2  2004/06/16 17:05:24  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4  2004/06/10 15:12:55  gorelenk * Added newline at the file end to avoid GCC warning. * * Revision 1.3  2004/05/10 19:47:39  gorelenk * Changed CreateFrom in CProjectItemsTree. * * Revision 1.2  2004/03/18 17:41:03  gorelenk * Aligned classes member-functions parameters inside declarations. * * Revision 1.1  2004/03/02 16:35:16  gorelenk * Initial revision. * * =========================================================================== */#endif //PROJECT_TREE_BUILDER__PROJ_TREE__HPP

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?