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 static shared_ptr Create( unique_ptr heap)

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

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

CreateWithSize

public static shared_ptr CreateWithSize(size_t size)

Defined at line 258 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 268 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 270 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 275 of file ../../zircon/system/ulib/inspect/vmo/state.cc

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

FrozenVmoCopy

public optional FrozenVmoCopy()

Defined at line 281 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 301 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 320 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 338 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 355 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 372 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 389 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 405 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 420 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 410 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 415 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 454 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 476 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 483 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 541 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 1224 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 512 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 531 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 536 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 555 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 566 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetDoubleProperty

public void SetDoubleProperty(DoubleProperty * property, double value)

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

SetBoolProperty

public void SetBoolProperty(BoolProperty * property, bool value)

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

SetIntArray

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

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

SetUintArray

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

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

SetDoubleArray

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

Defined at line 609 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 613 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SetStringProperty

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

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

SetByteVectorProperty

public void SetByteVectorProperty(ByteVectorProperty * property, span value)

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

AddIntProperty

public void AddIntProperty(IntProperty * property, int64_t value)

Defined at line 619 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 631 of file ../../zircon/system/ulib/inspect/vmo/state.cc

AddDoubleProperty

public void AddDoubleProperty(DoubleProperty * property, double value)

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

AddIntArray

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

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

AddUintArray

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

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

AddDoubleArray

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

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

SubtractIntProperty

public void SubtractIntProperty(IntProperty * property, int64_t value)

Defined at line 655 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 667 of file ../../zircon/system/ulib/inspect/vmo/state.cc

SubtractDoubleProperty

public void SubtractDoubleProperty(DoubleProperty * property, double value)

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

SubtractIntArray

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

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

SubtractUintArray

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

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

SubtractDoubleArray

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

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

FreeIntProperty

public void FreeIntProperty(IntProperty * property)

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

Free various entities

FreeUintProperty

public void FreeUintProperty(UintProperty * property)

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

FreeDoubleProperty

public void FreeDoubleProperty(DoubleProperty * property)

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

FreeBoolProperty

public void FreeBoolProperty(BoolProperty * property)

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

FreeIntArray

public void FreeIntArray(IntArray * array)

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

FreeUintArray

public void FreeUintArray(UintArray * array)

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

FreeDoubleArray

public void FreeDoubleArray(DoubleArray * array)

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

FreeStringArray

public void FreeStringArray(StringArray * array)

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

FreeStringProperty

public void FreeStringProperty(StringProperty * property)

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

FreeByteVectorProperty

public void FreeByteVectorProperty(ByteVectorProperty * property)

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

FreeLink

public void FreeLink(Link * link)

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

FreeNode

public void FreeNode(Node * node)

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

FreeLazyNode

public void FreeLazyNode(LazyNode * lazy_node)

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

ReleaseStringReference

public void ReleaseStringReference(BlockIndex index)

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

BeginTransaction

public void BeginTransaction()

Defined at line 1070 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 1078 of file ../../zircon/system/ulib/inspect/vmo/state.cc

GetLinkNames

public vector GetLinkNames()

Defined at line 1086 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 1095 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 1322 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 1335 of file ../../zircon/system/ulib/inspect/vmo/state.cc

Return stats about this state.