CommonLibVR
Object.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/B/BSTSmartPointer.h"
5 #include "RE/M/MemoryManager.h"
6 #include "RE/V/Variable.h"
7 
8 namespace RE
9 {
10  namespace BSScript
11  {
12  class ObjectTypeInfo;
13 
14  class Object
15  {
16  public:
18 
19  [[nodiscard]] VMHandle GetHandle() const;
21  [[nodiscard]] const ObjectTypeInfo* GetTypeInfo() const;
22  [[nodiscard]] constexpr bool IsConstructed() const noexcept { return static_cast<bool>(constructed); }
23  [[nodiscard]] constexpr bool IsInitialized() const noexcept { return static_cast<bool>(initialized); }
24  [[nodiscard]] constexpr bool IsValid() const noexcept { return static_cast<bool>(valid); }
25 
26  [[nodiscard]] void* Resolve(VMTypeID a_typeID) const;
27 
28  void IncRef();
29  std::uint32_t DecRef();
30 
32  [[nodiscard]] const Variable* GetProperty(const BSFixedString& a_name) const;
34  [[nodiscard]] const Variable* GetVariable(const BSFixedString& a_name) const;
35 
37 
38  // members
39  std::uint32_t constructed: 1; // 00 - 0
40  std::uint32_t initialized: 1; // 00 - 1
41  std::uint32_t valid: 1; // 00 - 2
42  std::uint32_t remainingPropsToInit: 29; // 00 - 3
45  void* lockStructure; // 18 - first bit used as flag
46  volatile VMHandle handle; // 20
47  volatile std::int32_t refCountAndHandleLock; // 28
48  std::uint32_t pad2C; // 2C
49  Variable variables[0]; // 30 - size == classPtr->GetTotalNumVariables() + 3
50 
51  private:
52  void Dtor();
53  };
54  static_assert(sizeof(Object) == 0x30);
55  }
56 }
Definition: ObjectTypeInfo.h:17
Definition: Object.h:15
VMHandle GetHandle() const
Variable * GetVariable(const BSFixedString &a_name)
std::uint32_t valid
Definition: Object.h:41
BSFixedString currentState
Definition: Object.h:44
constexpr bool IsConstructed() const noexcept
Definition: Object.h:22
const Variable * GetVariable(const BSFixedString &a_name) const
const ObjectTypeInfo * GetTypeInfo() const
std::uint32_t initialized
Definition: Object.h:40
std::uint32_t remainingPropsToInit
Definition: Object.h:42
void * lockStructure
Definition: Object.h:45
const Variable * GetProperty(const BSFixedString &a_name) const
void * Resolve(VMTypeID a_typeID) const
ObjectTypeInfo * GetTypeInfo()
BSTSmartPointer< ObjectTypeInfo > type
Definition: Object.h:43
std::uint32_t pad2C
Definition: Object.h:48
volatile VMHandle handle
Definition: Object.h:46
constexpr bool IsInitialized() const noexcept
Definition: Object.h:23
constexpr bool IsValid() const noexcept
Definition: Object.h:24
std::uint32_t constructed
Definition: Object.h:39
std::uint32_t DecRef()
Variable * GetProperty(const BSFixedString &a_name)
volatile std::int32_t refCountAndHandleLock
Definition: Object.h:47
Variable variables[0]
Definition: Object.h:49
Definition: Variable.h:15
Definition: BSTSmartPointer.h:37
Definition: AbsorbEffect.h:6
std::uint32_t VMTypeID
Definition: BSCoreTypes.h:9
std::uint64_t VMHandle
Definition: BSCoreTypes.h:7