igraph_utils.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: igraph_utils.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:48:15 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_GRAPH___IGRAPH_UTILS__HPP
- #define GUI_GRAPH___IGRAPH_UTILS__HPP
- /* $Id: igraph_utils.hpp,v 1000.1 2004/06/01 19:48:15 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.
- *
- * ===========================================================================
- *
- * Authors: Andrey Yazhuk
- *
- * File Description:
- *
- */
- #include <corelib/ncbistl.hpp>
- #include <corelib/ncbistd.hpp>
- #include <set>
- #include <algorithm>
- #include <gui/opengl/glcolor.hpp>
- /** @addtogroup GUI_GRAPH
- *
- * @{
- */
- BEGIN_NCBI_SCOPE
- template<class P> void destroy(P pT) { delete pT; }
- template<class P> void destroy_null(P& pT) { delete pT; pT = NULL; }
- template<class P> void destroy_null_array(P& pT) { delete[] pT; pT = NULL; }
- template<class P> struct Destroyer
- {
- static void destroy(P pT) { delete pT; };
- static void destroy_null(P& pT) { delete pT; pT = NULL; };
- };
- template<class ContT> void destroy_and_erase_elems(ContT& C)
- {
- typedef typename ContT::value_type value_type;
- for_each(C.begin(), C.end(), Destroyer<value_type>::destroy);
- C.clear();
- }
- template<class InIt> void destroy_elems(InIt first, InIt last)
- {
- typedef typename InIt::value_type value_type;
- for_each(first, last, Destroyer<value_type>::destroy);
- }
- template<class T> bool set_contains(const set<T>& Set, const T& Elem)
- {
- return Set.find(Elem)!=Set.end();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: igraph_utils.hpp,v $
- * Revision 1000.1 2004/06/01 19:48:15 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- *
- * Revision 1.13 2004/05/11 18:54:43 dicuccio
- * Added doxygen modules info
- *
- * Revision 1.12 2003/10/29 23:09:36 yazhuk
- * Moved glColorC() to glbitmapfont.hpp
- *
- * Revision 1.11 2003/10/08 14:11:30 dicuccio
- * Code clean-up. Use <> instead of "" for #includes. Moved CGlPane into opengl.
- * Moved CGlPoint and CGlRect into opengl.
- *
- * Revision 1.10 2003/09/25 20:33:29 yazhuk
- * Added CGlRect::CenterPoint() function
- *
- * Revision 1.9 2003/09/10 21:51:24 yazhuk
- * GCC compilation fixes
- *
- * Revision 1.8 2003/09/10 20:34:23 yazhuk
- * Added CGlRect<>::SetSize function
- *
- * Revision 1.7 2003/08/28 19:17:01 yazhuk
- * Cosmetic changes to function names
- *
- * Revision 1.6 2003/08/14 18:01:16 yazhuk
- * Added Move... functions
- *
- * Revision 1.5 2003/08/11 16:08:26 yazhuk
- * Compilation fixes for GCC.
- *
- * Revision 1.4 2003/08/11 13:16:56 dicuccio
- * Restore missing ';' after class declaration
- *
- * Revision 1.3 2003/08/11 11:37:56 dicuccio
- * Compilation fixes for WorkShop compiler
- *
- * Revision 1.2 2003/08/10 14:11:18 dicuccio
- * Compilation fixes for gcc
- *
- * Revision 1.1 2003/08/08 16:01:35 yazhuk
- * Initial revision.
- *
- * ===========================================================================
- */
- #endif