// Created on: 1998-07-22
// Created by: Christian CAILLET
// Copyright (c) 1998-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 _XSControl_Vars_HeaderFile
#define _XSControl_Vars_HeaderFile

#include <Standard.hxx>
#include <Standard_Type.hxx>

#include <Standard_Transient.hxx>
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
class Geom_Geometry;
class Geom2d_Curve;
class Geom_Curve;
class Geom_Surface;
class gp_Pnt;
class gp_Pnt2d;
class TopoDS_Shape;

//! Defines a receptacle for externally defined variables, each
//! one has a name
//!
//! I.E. a WorkSession for XSTEP is generally used inside a
//! context, which brings variables, especially shapes and
//! geometries. For instance DRAW or an application engine
//!
//! This class provides a common form for this. It also provides
//! a default implementation (locally recorded variables in a
//! dictionary), but which is aimed to be redefined
class XSControl_Vars : public Standard_Transient
{

public:
  Standard_EXPORT XSControl_Vars();

  Standard_EXPORT virtual void Set(const char* const                      name,
                                   const occ::handle<Standard_Transient>& val);

  Standard_EXPORT virtual occ::handle<Standard_Transient> Get(const char*& name) const;

  Standard_EXPORT virtual occ::handle<Geom_Geometry> GetGeom(const char*& name) const;

  Standard_EXPORT virtual occ::handle<Geom2d_Curve> GetCurve2d(const char*& name) const;

  Standard_EXPORT virtual occ::handle<Geom_Curve> GetCurve(const char*& name) const;

  Standard_EXPORT virtual occ::handle<Geom_Surface> GetSurface(const char*& name) const;

  Standard_EXPORT virtual void SetPoint(const char* const name, const gp_Pnt& val);

  Standard_EXPORT virtual void SetPoint2d(const char* const name, const gp_Pnt2d& val);

  Standard_EXPORT virtual bool GetPoint(const char*& name, gp_Pnt& pnt) const;

  Standard_EXPORT virtual bool GetPoint2d(const char*& name, gp_Pnt2d& pnt) const;

  Standard_EXPORT virtual void SetShape(const char* const name, const TopoDS_Shape& val);

  Standard_EXPORT virtual TopoDS_Shape GetShape(const char*& name) const;

  DEFINE_STANDARD_RTTIEXT(XSControl_Vars, Standard_Transient)

private:
  NCollection_DataMap<TCollection_AsciiString, occ::handle<Standard_Transient>> thevars;
};

#endif // _XSControl_Vars_HeaderFile
