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(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.

See also

OmniPvdWriter::registerAttribute()

See also

OmniPvdWriter::registerEnumValue()

See also

OmniPvdWriter::registerFlagsAttribute()

See also

OmniPvdWriter::registerClassAttribute()

See also

OmniPvdWriter::registerUniqueListAttribute()

See also

OmniPvdWriter::createObject()

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(OmniPvdClassHandle classHandle, const char *attributeName, OmniPvdEnumValueType 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().

See also

OmniPvdWriter::registerClass()

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(OmniPvdClassHandle classHandle, const char *attributeName, OmniPvdDataType::Enum attributeDataType, uint32_t nbElements) = 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 nbElements to 0 to indicate that the array has a variable length.

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::setAttribute()

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

  • attributeName – The attribute name

  • attributeDataType – The attribute data type

  • nbElements – The number of elements in the array. Set this to 0 to indicate a variable length array

Returns

A unique attribute handle for the registered attribute

virtual OmniPvdAttributeHandle registerFlagsAttribute(OmniPvdClassHandle classHandle, const char *attributeName, OmniPvdClassHandle enumClassHandle) = 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.

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::setAttribute()

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

  • attributeName – The attribute name

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

Returns

A unique attribute handle for the registered flags attribute

virtual OmniPvdAttributeHandle registerClassAttribute(OmniPvdClassHandle classHandle, const char *attributeName, 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.

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::setAttribute()

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 registerUniqueListAttribute(OmniPvdClassHandle classHandle, const char *attributeName, OmniPvdDataType::Enum attributeDataType) = 0

Registers an attribute which can hold a list of unique items.

The returned attribute handle can be used in calls to addToUniqueListAttribute() and removeFromUniqueListAttribute(), to add an item to and remove it from the list, respectively.

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::addToUniqueListAttribute()

See also

OmniPvdWriter::removeFromUniqueListAttribute()

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

  • attributeName – The attribute name

  • attributeDataType – The data type of the items which will get added to the list attribute

Returns

A unique handle for the registered list attribute

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

Sets an attribute value.

Since an attribute can be part of a nested construct of class attributes, the method expects an array of attribute handles as input to uniquely identify the attribute.

See also

OmniPvdWriter::registerAttribute()

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

  • attributeHandles – The attribute handles containing all class attribute handles of a nested class construct. The last one has to be the handle from the registerUniqueListAttribute() call.

  • nbAttributeHandles – The number of attribute handles provided in attributeHandles

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

  • nbrBytes – The number of bytes to be written

inline void setAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t *data, uint32_t nbrBytes)

Sets an attribute value.

See other setAttribute method for details. This special version covers the case where the attribute is not part of a class attribute construct.

See also

OmniPvdWriter::registerAttribute()

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 addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle *attributeHandles, uint8_t nbAttributeHandles, const uint8_t *data, uint32_t nbrBytes) = 0

Adds an item to a unique list attribute.

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

Since an attribute can be part of a nested construct of class attributes, the method expects an array of attribute handles as input to uniquely identify the attribute.

See also

OmniPvdWriter::registerUniqueListAttribute()

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

  • attributeHandles – The attribute handles containing all class attribute handles of a nested class construct. The last one has to be the handle from the registerUniqueListAttribute() call.

  • nbAttributeHandles – The number of attribute handles provided in attributeHandles

  • data – The pointer to the data of the item to add to the list

  • nbrBytes – The number of bytes to be written

inline void addToUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t *data, uint32_t nbrBytes)

Adds an item to a unique list attribute.

See other addToUniqueListAttribute method for details. This special version covers the case where the attribute is not part of a class attribute construct.

See also

OmniPvdWriter::registerUniqueListAttribute()

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 registerUniqueListAttribute() call

  • data – The pointer to the data of the item to add to the list

  • nbrBytes – The number of bytes to be written

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

Removes an item from a uniqe list attribute.

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

Since an attribute can be part of a nested construct of class attributes, the method expects an array of attribute handles as input to uniquely identify the attribute.

See also

OmniPvdWriter::registerUniqueListAttribute()

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

  • attributeHandles – The attribute handles containing all class attribute handles of a nested class construct. The last one has to be the handle from the registerUniqueListAttribute() call.

  • nbAttributeHandles – The number of attribute handles provided in attributeHandles

  • data – The pointer to the data of the item to remove from the list

  • nbrBytes – The number of bytes to be written

inline void removeFromUniqueListAttribute(OmniPvdContextHandle contextHandle, OmniPvdObjectHandle objectHandle, OmniPvdAttributeHandle attributeHandle, const uint8_t *data, uint32_t nbrBytes)

Removes an item from a uniqe list attribute.

See other removeFromUniqueListAttribute method for details. This special version covers the case where the attribute is not part of a class attribute construct.

See also

OmniPvdWriter::registerUniqueListAttribute()

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 registerUniqueListAttribute() call

  • data – The pointer to the data of the item to remove from the list

  • nbrBytes – The number of bytes to be written

virtual void createObject(OmniPvdContextHandle contextHandle, OmniPvdClassHandle classHandle, 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().

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::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(OmniPvdContextHandle contextHandle, 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.

See also

OmniPvdWriter::registerClass()

See also

OmniPvdWriter::createObject()

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(OmniPvdContextHandle contextHandle, 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(OmniPvdContextHandle contextHandle, 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

virtual void recordMessage(OmniPvdContextHandle contextHandle, const char *message, const char *file, uint32_t line, uint32_t type, OmniPvdClassHandle handle = 0) = 0

Record a message.

Record a message in the OVD stream. The file, line and type parameters can help locate the source of the message when debugging.

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

  • message – A character string text message.

  • file – A character string containing the name of the source file where the message originated from. NULL is a valid value if a file name is not needed.

  • line – The line number in the source file where the message originated from.

  • type – An enumerated type describing the message type. If unneeded, any value can be set.

  • handle – A handle to an Omni PVD enumerated type that contains all values for the previous type parameter. Setting OMNI_PVD_INVALID_HANDLE will cause this parameter to be ignored. See registerEnumValue()

virtual uint32_t getStatus() = 0

Gets the status of the writer.

See also

OmniPvdWriterStatusFlag

Returns

The current status flags of the writer, held in a 32 bit unsigned integer with the flag bits defined by OmniPvdWriterStatusFlag

virtual void clearStatus() = 0

Clears or resets the status of the writer.