// Created on: 1999-11-03
// Created by: Denis PASCAL
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

#ifndef _TNaming_Scope_HeaderFile
#define _TNaming_Scope_HeaderFile

#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>

#include <TDF_Label.hxx>
#include <NCollection_Map.hxx>
class TDF_Label;
class TopoDS_Shape;
class TNaming_NamedShape;

//! this class manage a scope of labels
//! ===================================
class TNaming_Scope
{
public:
  DEFINE_STANDARD_ALLOC

  //! WithValid = FALSE
  Standard_EXPORT TNaming_Scope();

  //! if <WithValid> the scope is defined by the map. If not
  //! on the whole framework.
  Standard_EXPORT TNaming_Scope(const bool WithValid);

  //! create a scope with a map. WithValid = TRUE.
  Standard_EXPORT TNaming_Scope(NCollection_Map<TDF_Label>& valid);

  Standard_EXPORT bool WithValid() const;

  Standard_EXPORT void WithValid(const bool mode);

  Standard_EXPORT void ClearValid();

  Standard_EXPORT void Valid(const TDF_Label& L);

  Standard_EXPORT void ValidChildren(const TDF_Label& L, const bool withroot = true);

  Standard_EXPORT void Unvalid(const TDF_Label& L);

  Standard_EXPORT void UnvalidChildren(const TDF_Label& L, const bool withroot = true);

  Standard_EXPORT bool IsValid(const TDF_Label& L) const;

  Standard_EXPORT const NCollection_Map<TDF_Label>& GetValid() const;

  Standard_EXPORT NCollection_Map<TDF_Label>& ChangeValid();

  //! Returns the current value of <NS> according to the
  //! Valid Scope.
  Standard_EXPORT TopoDS_Shape CurrentShape(const occ::handle<TNaming_NamedShape>& NS) const;

private:
  bool                       myWithValid;
  NCollection_Map<TDF_Label> myValid;
};

#endif // _TNaming_Scope_HeaderFile
