// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Guillaume Damiand // #ifndef CGAL_DART_H #define CGAL_DART_H 1 #include #include #include #include #include namespace CGAL { template class Compact_container; template class Concurrent_compact_container; template class Compact_container_with_index; template class Combinatorial_map_storage_1; template class Combinatorial_map_storage_with_index; template class Generalized_map_storage_1; template class Generalized_map_storage_with_index; template class CMap_linear_cell_complex_storage_1; template class CMap_linear_cell_complex_storage_with_index; template class GMap_linear_cell_complex_storage_1; template class GMap_linear_cell_complex_storage_with_index; namespace internal { template struct Init_id; } // end namespace internal /** @file Dart.h * Definition of nD dart. */ /** Definition of nD dart without information. * The_dart class describes an nD dart (basic element of a combinatorial or generalized map). * A dart is composed with handle towards its neighbors, * a bitset containing Boolean marks, and handle towards enabled attributes. * n is the dimension of the space (2 for 2D, 3 for 3D...) * Refs the ref class */ template struct Dart_without_info: public Add_id { public: template friend class Compact_container; template friend class Concurrent_compact_container; template friend class Compact_container_with_index; template friend class Combinatorial_map_storage_1; template friend class Combinatorial_map_storage_with_index; template friend class Generalized_map_storage_1; template friend class Generalized_map_storage_with_index; template friend class CMap_linear_cell_complex_storage_1; template friend class CMap_linear_cell_complex_storage_with_index; template friend class GMap_linear_cell_complex_storage_1; template friend class GMap_linear_cell_complex_storage_with_index; template friend struct internal::Init_id; typedef Dart_without_info Self; typedef typename Refs::Dart_descriptor Dart_descriptor; typedef typename Refs::size_type size_type; typedef typename Refs::Dart_const_descriptor Dart_const_descriptor; typedef typename Refs::Helper Helper; typedef WithId Has_id; using Type_for_compact_container=typename Refs::Type_for_compact_container; /// Typedef for attributes template struct Attribute_descriptor: public Refs::template Attribute_descriptor {}; template struct Attribute_const_descriptor: public Refs::template Attribute_const_descriptor {}; /// The number of used marks. static const size_type NB_MARKS = Refs::NB_MARKS; /// The dimension of the combinatorial map. static const unsigned int dimension = d; Type_for_compact_container for_compact_container() const { return mf[0].for_compact_container(); } void for_compact_container(Type_for_compact_container p) { mf[0].for_compact_container(p); } Dart_descriptor get_f(unsigned int i) const { assert(i<=dimension); return mf[i]; } protected: /** Default constructor: no real initialisation, * because this is done in the combinatorial map class. */ Dart_without_info() {} /** Copy constructor: * @param adart a dart. */ Dart_without_info(const Dart_without_info& adart) : mmarks(adart.mmarks), mattribute_descriptors(adart.mattribute_descriptors) { for (unsigned int i = 0; i <= dimension; ++i) mf[i] = adart.mf[i]; } /** Return the mark value of a given mark number. * @param amark the mark number. * @return the value for this number. */ bool get_mark(size_type amark) const { CGAL_assertion(amark>=0 && amark=0 && amark=0 && amark get_marks() const { return mmarks; } /** Set simultaneously all the marks of this dart to a given value. * @param amarks the value of the marks. */ void set_marks(const std::bitset& amarks) const { mmarks = amarks; } /// @return a handle on the i-attribute template typename Attribute_descriptor::type attribute() { CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mattribute_descriptors); } template typename Attribute_const_descriptor::type attribute() const { CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, "attribute called but i-attributes are disabled."); return std::get::value> (mattribute_descriptors); } protected: /// Neighboors for each dimension +1 (from 0 to dimension). Dart_descriptor mf[dimension+1]; /// Values of Boolean marks. mutable std::bitset mmarks; /// Attributes enabled typename Helper::Attribute_descriptors mattribute_descriptors; }; // Dart definition with an info; // (there is a specialization below when Info_==void) template struct Dart : public Dart_without_info { public: template friend class Compact_container; template friend class Concurrent_compact_container; template friend class Compact_container_with_index; template friend class Combinatorial_map_storage_1; template friend class Combinatorial_map_storage_with_index; template friend class Generalized_map_storage_1; template friend class Generalized_map_storage_with_index; template friend class CMap_linear_cell_complex_storage_1; template friend class CMap_linear_cell_complex_storage_with_index; template friend class GMap_linear_cell_complex_storage_1; template friend class GMap_linear_cell_complex_storage_with_index; typedef Dart Self; typedef Info_ Info; protected: /** Default constructor: no real initialisation, * because this is done in the combinatorial or generalized map class. */ Dart() {} Dart(const Info_& info) : minfo(info) {} Info_& info() { return minfo; } const Info_& info() const { return minfo; } protected: Info minfo; }; // Specialization of Dart class when info==void template struct Dart : public Dart_without_info { public: typedef CGAL::Void Info; }; } // namespace CGAL #endif // CGAL_DART_H // // EOF //