Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-02 09:48:36

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file orange/orangeinp/ObjectInterface.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <memory>
0010 #include <string>
0011 #include <string_view>
0012 
0013 #include "corecel/Config.hh"
0014 
0015 #include "corecel/Macros.hh"
0016 
0017 #include "CsgTypes.hh"
0018 
0019 namespace celeritas
0020 {
0021 struct JsonPimpl;
0022 
0023 namespace orangeinp
0024 {
0025 //---------------------------------------------------------------------------//
0026 namespace detail
0027 {
0028 class VolumeBuilder;
0029 }
0030 
0031 //---------------------------------------------------------------------------//
0032 /*!
0033  * Base class for constructing high-level CSG objects in ORANGE.
0034  */
0035 class ObjectInterface
0036 {
0037   public:
0038     //!@{
0039     //! \name Type aliases
0040     using SPConstObject = std::shared_ptr<ObjectInterface const>;
0041     using VolumeBuilder = detail::VolumeBuilder;
0042     //!@}
0043 
0044   public:
0045     // Anchored default destructor
0046     virtual ~ObjectInterface() = 0;
0047 
0048     //! Short unique name of this object
0049     virtual std::string_view label() const = 0;
0050 
0051     //! Construct a volume from this object
0052     virtual NodeId build(VolumeBuilder&) const = 0;
0053 
0054     //! Write the region to a JSON object
0055     virtual void output(JsonPimpl*) const = 0;
0056 
0057   protected:
0058     //!@{
0059     //! Allow construction and assignment only through daughter classes
0060     ObjectInterface() = default;
0061     CELER_DEFAULT_COPY_MOVE(ObjectInterface);
0062     //!@}
0063 };
0064 
0065 //---------------------------------------------------------------------------//
0066 // Get a JSON string representing an object
0067 std::string to_string(ObjectInterface const&);
0068 
0069 //---------------------------------------------------------------------------//
0070 }  // namespace orangeinp
0071 }  // namespace celeritas