OmniPvdWriter

Defined in pvdruntime/include/OmniPvdWriter.h

class OmniPvdWriter

Used to write debug information to an OmniPvdWriteStream.

Allows the registration of OmniPVD classes and attributes, in a similar fashion to an object oriented language. A registration returns a unique identifier or handle.

Once classes and attributes have been registered, one can create for example object instances of a class and set the values of the attributes of a specific object.

Objects can be grouped by context using the context handle. The context handle is a user-specified handle which is passed to the set functions and object creation and destruction functions.

Each context can have its own notion of time. The current time of a context can be exported with calls to the startFrame and stopFrame functions.

Public Functions

inline virtual ~OmniPvdWriter()
virtual void setLogFunction(OmniPvdLogFunction logFunction) = 0

Sets the log function to print the internal debug messages of the OmniPVD API.

Parameters

logFunction – The function pointer to receive the log messages

virtual void setWriteStream(const OmniPvdWriteStream *writeStream) = 0

Sets the write stream to receive the API command stream.

Parameters

writeStream – The OmniPvdWriteStream to receive the stream of API calls/notifications

virtual OmniPvdWriteStream *getWriteStream() = 0

Gets the pointer to the write stream.

Returns

A pointer to the write stream

virtual OmniPvdClassHandle registerClass(const char *className, OmniPvdClassHandle baseClassHandle = 0) = 0

Registers an OmniPVD class.

Returns a unique handle to a class, which can be used to register class attributes and express object lifetimes with the createObject and destroyObject functions. Class inheritance can be described by calling registerClass with a base class handle. Derived classes inherit the attributes of the parent classes.

Parameters
  • className – The class name

  • baseClassHandle – The handle to the base class. This handle is obtained by pre-registering the base class. Defaults to 0 which means the class has no parent class

Returns

A unique class handle for the registered class

virtual OmniPvdAttributeHandle registerEnumValue(const OmniPvdClassHandle classHandle, const char *attributeName, const uint32_t value) = 0

Registers an enum name and corresponding value for a pre-registered class.

Registering enums happens in two steps. First, registerClass() is called with the name of the enum. This returns a class handle, which is used in a second step for the enum value registration with registerEnumValue(). If an enum has multiple values, registerEnumValue() has to be called with the different values.

Note that enums differ from usual classes because their attributes, the enum values, do not change over time and there is no need to call setAttribute().

Parameters
  • classHandle – The handle from the registerClass() call

  • attributeName – The name of the enum value

  • value – The value of the enum value

Returns

A unique attribute handle for the registered enum value

virtual OmniPvdAttributeHandle registerAttribute(const OmniPvdClassHandle classHandle, const char *attributeName, const OmniPvdAttributeDataType attributeDataType, const uint32_t nbrFields) = 0

Registers an attribute.

The class handle is obtained from a previous call to registerClass(). After registering an attribute, one gets an attribute handle which can be used to set data values of an attribute with setAttribute(). All attributes are treated as arrays, even if the attribute has only a single data item. Set nbrFields to 0 to indicate that the array has a variable length.

Parameters
  • classHandle – The handle from the registerClass() call

  • attributeName – The attribute name

  • attributeDataType – The attribute data type // TODO: Change to type OmniPvdDataTypeEnum

  • nbrFields – The number of fields. Set this to 0 to indicate a variable length array

Returns

A unique attribute handle for the registered attribute

virtual OmniPvdAttributeHandle registerFlagsAttribute(const OmniPvdClassHandle classHandle, const OmniPvdClassHandle enumClassHandle, const char *attributeName) = 0

Registers an attribute which is a flag.

Use this function to indicate that a pre-registered class has a flag attribute, i.e., the attribute is a pre-registered enum.

The returned attribute handle can be used in setAttribute() to set an object’s flags.

Parameters
  • classHandle – The handle from the registerClass() call of the class

  • enumClassHandle – The handle from the registerClass() call of the enum

  • attributeName – The attribute name

Returns

A unique attribute handle for the registered flags attribute

virtual OmniPvdAttributeHandle registerClassAttribute(const OmniPvdClassHandle classHandle, const char *attributeName, const OmniPvdClassHandle classAttributeHandle) = 0

Registers an attribute which is a class.

Use this function to indicate that a pre-registered class has an attribute which is a pre-registered class.

The returned attribute handle can be used in setAttribute() to set an object’s class attribute.

Parameters
  • classHandle – The handle from the registerClass() call of the class

  • attributeName – The attribute name

  • classAttributeHandle – The handle from the registerClass() call of the class attribute

Returns

A unique handle for the registered class attribute

virtual OmniPvdAttributeHandle registerSetAttribute(const OmniPvdClassHandle classHandle, const char *attributeName, const OmniPvdAttributeDataType attributeDataType) = 0

Registers an attribute which is a set.

A set is a collection of unique items and has a variable size.

The returned attribute handle can be used in calls to addToSetAttribute() and removeFromSetAttribute(), to add an item to and remove it from a set, respectively.

Parameters
  • classHandle – The handle from the registerClass() call of the class

  • attributeName – The attribute name

  • attributeDataType – The data type of items in the set attribute

Returns

A unique handle for the registered set attribute

virtual void setAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle *attributeHandles, const uint8_t *data, const uint32_t nbrBytes) = 0

Sets an attribute value.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • handleDepth – The number of nested attribute handles requiref to identify the attribute

  • attributeHandles – The nested attribute handles needed to identify the attribute

  • data – The pointer to the data of the element(s) to remove from the set

  • nbrBytes – The number of bytes to be written

virtual void setAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes) = 0

Sets an attribute value.

Use the attribute handle from the registerAttribute() call to set the value of an attribute of an existing object.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • attributeHandle – The handle from the registerAttribute() call

  • data – The pointer to the data

  • nbrBytes – The number of bytes to be written

virtual void addToSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle *attributeHandles, const uint8_t *data, const uint32_t nbrBytes) = 0

Adds an item to a set attribute.

Use the attribute handle(s) from the registerSetAttribute() call to add an item to a set attribute.

An array of nested attribute handles is required to uniquely identify the attribute.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • handleDepth – The number of nested attribute handles requiref to identify the attribute

  • attributeHandles – The nested attribute handles needed to identify the attribute

  • data – The pointer to the data of the element(s) to remove from the set

  • nbrBytes – The number of bytes to be written

virtual void addToSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes) = 0

Adds an item to a set attribute.

Use the attribute handle from the registerSetAttribute() call to add an item to a set attribute.

A set attribute is defined like a set in mathematics, where each element must be unique.

The Shallow part of the function indicates that an array of nested attribute handles is not required to uniquely identify the attribute.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • attributeHandle – The handle from the registerSetAttribute() call

  • data – The pointer to the data of the added set item

  • nbrBytes – The number of bytes to be written

virtual void removeFromSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle *attributeHandles, const uint8_t *data, const uint32_t nbrBytes) = 0

Removes an item from a set attribute, where the attribute is allowed to be nested.

A set attribute is defined like a set in mathematics, where each element must be unique.

An array of nested attribute handles is required to uniquely identify the attribute.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • handleDepth – The number of nested attribute handles require to identify the attribute

  • attributeHandles – The attribute handles needed to identify the attribute

  • data – The pointer to the data of the element(s) to remove from the set

  • nbrBytes – The number of bytes to be written

virtual void removeFromSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes) = 0

Removes an item from a set attribute.

A set attribute is defined like a set in mathematics, where each element must be unique.

The Shallow part of the function indicates that an array of nested attribute handles is not required to uniquely identify the attribute.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • attributeHandle – The handle from the registerSetAttribute() call

  • data – The pointer to the data of the removed set element(s)

  • nbrBytes – The number of bytes to be written

virtual void createObject(const OmniPvdContextHandle contextHandle, const OmniPvdClassHandle classHandle, const OmniPvdObjectHandle objectHandle, const char *objectName) = 0

Creates an object creation event.

Indicates that an object is created. One can freely choose a context handle for grouping objects.

The class handle is obtained from a registerClass() call. The object handle should be unique, but as it’s not tracked by the OmniPVD API, it’s important this is set to a valid handle such as the object’s physical memory address.

The object name can be freely choosen or not set.

Create about object destruction event by calling destroyObject().

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • classHandle – The handle from the registerClass() call

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

  • objectName – The user-defined name of the object. Can be the empty string

virtual void destroyObject(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle) = 0

Creates an object destruction event.

Use this to indicate that an object is destroyed. Use the same user-defined context and object handles as were used in the create object calls.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • objectHandle – The user-defined unique handle of the object. E.g. its physical memory address

virtual void startFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) = 0

Creates a frame start event.

Time or frames are counted separatly per user-defined context.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • timeStamp – The timestamp of the frame start event

virtual void stopFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) = 0

Creates a stop frame event.

Time is counted separately per user-defined context.

Parameters
  • contextHandle – The user-defined context handle for grouping objects

  • timeStamp – The timestamp of the frame stop event