Kagome
Polkadot Runtime Engine in C++17
compartment_wrapper.cpp
Go to the documentation of this file.
1 
7 
8 #include <WAVM/Runtime/Runtime.h>
9 #include <boost/assert.hpp>
10 #include <stdexcept>
11 
13 
14  struct CompartmentWrapperImpl final {
16  WAVM::Runtime::GCPointer<WAVM::Runtime::Compartment> compartment)
17  : compartment_{std::move(compartment)} {}
18 
19  WAVM::Runtime::GCPointer<WAVM::Runtime::Compartment> compartment_;
20  };
21 
23  : impl_{std::make_unique<CompartmentWrapperImpl>(WAVM::Runtime::GCPointer{
24  WAVM::Runtime::createCompartment(std::move(name))})} {}
25 
27  BOOST_VERIFY(
28  WAVM::Runtime::tryCollectCompartment(std::move(impl_->compartment_)));
29  }
30 
31  WAVM::Runtime::Compartment *CompartmentWrapper::getCompartment() const {
32  return impl_->compartment_;
33  }
34 
35 } // namespace kagome::runtime::wavm
WAVM::Runtime::GCPointer< WAVM::Runtime::Compartment > compartment_
CompartmentWrapperImpl(WAVM::Runtime::GCPointer< WAVM::Runtime::Compartment > compartment)
WAVM::Runtime::Compartment * getCompartment() const
std::shared_ptr< CompartmentWrapperImpl > impl_