Skip to content
Snippets Groups Projects
Select Git revision
  • b4770039e39a2df14cb93bee30bda335282c61a8
  • develop default protected
  • feature/gmsh-reader
  • origin/stage/bouguettaia
  • feature/kinetic-schemes
  • feature/reconstruction
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/variational-hydro
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • feature/escobar-smoother
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

ValuePerItem.hpp

Blame
  • ASTCheckpointsInfo.hpp 1.29 KiB
    #ifndef AST_CHECKPOINTS_INFO_HPP
    #define AST_CHECKPOINTS_INFO_HPP
    
    #include <language/utils/ASTCheckpoint.hpp>
    #include <utils/Exceptions.hpp>
    #include <utils/PugsAssert.hpp>
    
    #include <string>
    #include <vector>
    
    class ASTNode;
    
    class ASTCheckpointsInfo
    {
     private:
      static const ASTCheckpointsInfo* m_checkpoints_info_instance;
    
      std::vector<ASTCheckpoint> m_ast_checkpoint_list;
    
      void _findASTCheckpoint(std::vector<size_t>& location, const ASTNode& node);
    
      // The only place where the ASTCheckpointsInfo can be built
      friend void parser(const std::string& filename);
    
      // to allow special manipulations in tests
      friend class ASTCheckpointsInfoTester;
    
      ASTCheckpointsInfo(const ASTNode& root_node);
    
     public:
      size_t
      getCheckpointId(const ASTNode& node) const
      {
        for (size_t i = 0; i < m_ast_checkpoint_list.size(); ++i) {
          if (&m_ast_checkpoint_list[i].node() == &node) {
            return i;
          }
        }
        throw UnexpectedError("Could not find node");
      }
    
      const ASTCheckpoint&
      getASTCheckpoint(size_t checkpoint_id) const
      {
        Assert(checkpoint_id < m_ast_checkpoint_list.size());
        return m_ast_checkpoint_list[checkpoint_id];
      }
    
      static const ASTCheckpointsInfo& getInstance();
    
      ASTCheckpointsInfo() = delete;
    
      ~ASTCheckpointsInfo();
    };
    
    #endif   // AST_CHECKPOINTS_INFO_HPP