⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 label.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
字号:
// Copyright (c) 2005  Stanford University (USA).// All rights reserved.//// This file is part of CGAL (www.cgal.org); you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public License as// published by the Free Software Foundation; version 2.1 of the License.// See the file LICENSE.LGPL distributed with CGAL.//// Licensees holding a valid commercial license may use this file in// accordance with the commercial license agreement provided with the software.//// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.//// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.3-branch/Kinetic_data_structures/include/CGAL/Tools/Label.h $// $Id: Label.h 36638 2007-02-27 22:45:58Z drussel $// //// Author(s)     : Daniel Russel <drussel@alumni.princeton.edu>#ifndef CGAL_LABEL_H_#define CGAL_LABEL_H_#include <CGAL/basic.h>#include <iostream>#include <sstream>CGAL_BEGIN_NAMESPACE//! A type which provides opaque, typed identifiers./*!  Basically this is just an int with a type associated with it  and one value (-1) picked out as the null value. It implements  comparisons and things.*/template <class A_Type>class Label{protected:  typedef Label<A_Type> This;  int id_;public:  //! Construct it from an int  explicit Label(int i):id_(i){}  //! Construct a default (null) label  Label():id_(-1) {    if(0) print();                        // make sure it is compiled  }  //! Make the next label  This  next_label() {    return Label(id_+1);  }  //! Return the null label  bool is_valid() const {    return id_ >=0;  }  unsigned int to_index() const {    //CGAL_precondition(is_valid());    assert(is_valid()); // change to remove PDB dependency on libCGAL    return id_;  }  bool operator<(const This &o) const  {    return id_ < o.id_;  }  bool operator>=(const This &o) const  {    return id_ >= o.id_;  }    bool operator<=(const This &o) const  {    return id_ <= o.id_;  }  bool operator>(const This &o) const  {    return id_ > o.id_;  }  bool operator==(const This &o) const  {    return id_ == o.id_;  }  bool operator!=(const This &o) const  {    return id_ != o.id_;  }  template <class OS>  void write(OS &out) const  {    if (id_ == -1) out << "N";    else out << id_;  }  void print() const  {    write(std::cout);  }  //! Convert to a string  std::string string() const  {    std::ostringstream os;    write(os);    return os.str();  }};template <class A_type>std::ostream& operator<<(std::ostream &out, const Label<A_type> &label){  out << "(";  label.write(out);  out << ")";  return out;}CGAL_END_NAMESPACE#endif

⌨️ 快捷键说明

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