class State

Defined at line 42 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/state.h

|State| wraps a |Heap| and implements the Inspect VMO API on top of that heap. This class contains the low-level operations necessary to deal with the various Inspect types and wrappers to denote ownership of those values.

This class should not be used directly, prefer to use |Inspector|. |State| writes version 2 of the Inspect Format.

Functions

State

public void State(const State & )

Defined at line 56 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/state.h

Disallow copy and assign.

State

public void State(State && )

Defined at line 57 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/state.h

operator=

public State & operator=(const State & )

Defined at line 58 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/state.h

operator=

public State & operator=(State && )

Defined at line 59 of file ../../zircon/system/ulib/inspect/include/lib/inspect/cpp/vmo/state.h

Create

public shared_ptr Create( unique_ptr heap)

Defined at line 230 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new State wrapping the given Heap. On failure, returns nullptr.

CreateWithSize

public shared_ptr CreateWithSize(size_t size)

Defined at line 255 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new State wrapping a new heap of the given size. On failure, returns an empty shared_ptr.

~State

public void ~State()

Defined at line 265 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Destructor for State, which performs necessary cleanup.

GetVmo

public const zx::vmo & GetVmo()

Defined at line 267 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Obtain a reference to the wrapped VMO. This may be duplicated read-only to pass to a reader process.

DuplicateVmo

public bool DuplicateVmo(zx::vmo * vmo)

Defined at line 272 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Obtain a read-only duplicate of the VMO backing this State.

FrozenVmoCopy

public cpp17::optional<zx::vmo> FrozenVmoCopy()

Defined at line 278 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Obtain a copy-on-write copy of the backing VMO. Generation count will be `kVmoFrozen`.

Copy

public bool Copy(zx::vmo * vmo)

Defined at line 298 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Obtain a copy of the VMO backing this state.

Returns true on success, false otherwise.

CopyBytes

public bool CopyBytes(std::vector<uint8_t> * out)

Defined at line 317 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Obtain a copy of the bytes in the VMO backing this state.

Returns true on success, false otherwise.

CreateIntProperty

public NumericProperty CreateIntProperty( basic_string_view name, BlockIndex parent, int64_t value)

Defined at line 335 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |IntProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateUintProperty

public NumericProperty CreateUintProperty( basic_string_view name, BlockIndex parent, uint64_t value)

Defined at line 352 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |UintProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateDoubleProperty

public NumericProperty CreateDoubleProperty( basic_string_view name, BlockIndex parent, double value)

Defined at line 369 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |DoubleProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateBoolProperty

public Property CreateBoolProperty( basic_string_view name, BlockIndex parent, bool value)

Defined at line 386 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |BoolProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateIntArray

public IntArray CreateIntArray( basic_string_view name, BlockIndex parent, size_t slots, ArrayBlockFormat format)

Defined at line 402 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |IntArray| in the Inspect VMO. The returned value releases the array when destroyed.

CreateStringArray

public StringArray CreateStringArray( basic_string_view name, BlockIndex parent, size_t slots, ArrayBlockFormat format)

Defined at line 417 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |StringArray| in the Inspect VMO. The returned value releases the array when destroyed.

CreateUintArray

public UintArray CreateUintArray( basic_string_view name, BlockIndex parent, size_t slots, ArrayBlockFormat format)

Defined at line 407 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |UintArray| in the Inspect VMO. The returned value releases the array when destroyed.

CreateDoubleArray

public DoubleArray CreateDoubleArray( basic_string_view name, BlockIndex parent, size_t slots, ArrayBlockFormat format)

Defined at line 412 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |DoubleArray| in the Inspect VMO. The returned value releases the array when destroyed.

CreateStringProperty

public Property CreateStringProperty( basic_string_view name, BlockIndex parent, const std::string & value)

Defined at line 451 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |StringProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateByteVectorProperty

public Property CreateByteVectorProperty( basic_string_view name, BlockIndex parent, span value)

Defined at line 457 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |ByteVectorProperty| in the Inspect VMO. The returned value releases the property when destroyed.

CreateLink

public Link CreateLink( basic_string_view name, BlockIndex parent, basic_string_view content, LinkBlockDisposition disposition)

Defined at line 464 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new [Link] in the Inspect VMO. The returned node releases the link when destroyed.

A Link is a low-level reference to a new Inspector linked off of the one managed by this state. A Link alone is not sufficient to populate the linked tree, see CreateLazyNode and CreateLazyValues.

CreateNode

public Node CreateNode( basic_string_view name, BlockIndex parent)

Defined at line 522 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |Node| in the Inspect VMO. Nodes are refcounted such that values nested under the node remain valid until all such values values are destroyed.

CreateAndIncrementStringReference

public zx_status_t CreateAndIncrementStringReference( basic_string_view value, BlockIndex * out)

Defined at line 1174 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create and allocate, if necessary, a StringReference block. The reference count will be 1 if the block is new, and incremented if it already existed.

CreateRootNode

public Node CreateRootNode()

Defined at line 493 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a special root |Node| in the Inspect VMO. This node is not backed by any storage, rather it allows clients to use the |Node| interface to add properties and children directly to the root of the VMO.

CreateLazyNode

public LazyNode CreateLazyNode( basic_string_view name, BlockIndex parent, function_impl callback)

Defined at line 512 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |LazyNode| with a new named |Link| that calls the given callback with child disposition.

CreateLazyValues

public LazyNode CreateLazyValues( basic_string_view name, BlockIndex parent, function_impl callback)

Defined at line 517 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a new |LazyNode| with a new named |Link| that calls the given callback with inline disposition.

SetIntProperty

public void SetIntProperty(IntProperty * property, int64_t value)

Defined at line 536 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Setters for various property types

SetUintProperty

public void SetUintProperty(UintProperty * property, uint64_t value)

Defined at line 547 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetDoubleProperty

public void SetDoubleProperty(DoubleProperty * property, double value)

Defined at line 559 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetBoolProperty

public void SetBoolProperty(BoolProperty * property, bool value)

Defined at line 571 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetIntArray

public void SetIntArray(IntArray * array, size_t index, int64_t value)

Defined at line 582 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetUintArray

public void SetUintArray(UintArray * array, size_t index, uint64_t value)

Defined at line 586 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetDoubleArray

public void SetDoubleArray(DoubleArray * array, size_t index, double value)

Defined at line 590 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetStringArray

public void SetStringArray(StringArray * array, size_t index, basic_string_view value)

Defined at line 594 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetStringProperty

public void SetStringProperty(StringProperty * property, const std::string & value)

Defined at line 724 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetByteVectorProperty

public void SetByteVectorProperty(ByteVectorProperty * property, span value)

Defined at line 728 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddIntProperty

public void AddIntProperty(IntProperty * property, int64_t value)

Defined at line 600 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Adders for various property types

AddUintProperty

public void AddUintProperty(UintProperty * property, uint64_t value)

Defined at line 612 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddDoubleProperty

public void AddDoubleProperty(DoubleProperty * property, double value)

Defined at line 624 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddIntArray

public void AddIntArray(IntArray * array, size_t index, int64_t value)

Defined at line 672 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddUintArray

public void AddUintArray(UintArray * array, size_t index, uint64_t value)

Defined at line 682 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddDoubleArray

public void AddDoubleArray(DoubleArray * array, size_t index, double value)

Defined at line 692 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractIntProperty

public void SubtractIntProperty(IntProperty * property, int64_t value)

Defined at line 636 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Subtractors for various property types

SubtractUintProperty

public void SubtractUintProperty(UintProperty * property, uint64_t value)

Defined at line 648 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractDoubleProperty

public void SubtractDoubleProperty(DoubleProperty * property, double value)

Defined at line 660 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractIntArray

public void SubtractIntArray(IntArray * array, size_t index, int64_t value)

Defined at line 677 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractUintArray

public void SubtractUintArray(UintArray * array, size_t index, uint64_t value)

Defined at line 687 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractDoubleArray

public void SubtractDoubleArray(DoubleArray * array, size_t index, double value)

Defined at line 697 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeIntProperty

public void FreeIntProperty(IntProperty * property)

Defined at line 784 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Free various entities

FreeUintProperty

public void FreeUintProperty(UintProperty * property)

Defined at line 800 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeDoubleProperty

public void FreeDoubleProperty(DoubleProperty * property)

Defined at line 816 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeBoolProperty

public void FreeBoolProperty(BoolProperty * property)

Defined at line 832 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeIntArray

public void FreeIntArray(IntArray * array)

Defined at line 848 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeUintArray

public void FreeUintArray(UintArray * array)

Defined at line 850 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeDoubleArray

public void FreeDoubleArray(DoubleArray * array)

Defined at line 852 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeStringArray

public void FreeStringArray(StringArray * array)

Defined at line 854 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeStringProperty

public void FreeStringProperty(StringProperty * property)

Defined at line 876 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeByteVectorProperty

public void FreeByteVectorProperty(ByteVectorProperty * property)

Defined at line 878 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeLink

public void FreeLink(Link * link)

Defined at line 882 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeNode

public void FreeNode(Node * node)

Defined at line 899 of file ../../zircon/system/ulib/inspect/vmo/state.cc

FreeLazyNode

public void FreeLazyNode(LazyNode * lazy_node)

Defined at line 929 of file ../../zircon/system/ulib/inspect/vmo/state.cc

ReleaseStringReference

public void ReleaseStringReference(BlockIndex index)

Defined at line 961 of file ../../zircon/system/ulib/inspect/vmo/state.cc

BeginTransaction

public void BeginTransaction()

Defined at line 1020 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Use transactions to ensure that all operations appear in the same generation.

EndTransaction

public void EndTransaction()

Defined at line 1028 of file ../../zircon/system/ulib/inspect/vmo/state.cc

GetLinkNames

public vector GetLinkNames()

Defined at line 1036 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Get the names of all links in this state.

CallLinkCallback

public promise_impl CallLinkCallback(const std::string & name)

Defined at line 1045 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Call a specific link by name, return a promise for the Inspector it produces.

UniqueName

public basic_string UniqueName(const std::string & prefix)

Defined at line 1270 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Create a unique name for children in this State.

Returned strings are guaranteed to be unique and will start with the given prefix.

GetStats

public InspectStats GetStats()

Defined at line 1283 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Return stats about this state.