UCXPublishClockNodeBase#
-
template<typename DatabaseT>
class UCXPublishClockNodeBase : public isaacsim::ucx::nodes::UcxNode# Templated base class for UCX clock publishing nodes.
This template provides common functionality for publishing clock data over UCX. Derived classes implement data extraction logic via extractData(). The base class handles message serialization via generateMessage().
- Template Parameters:
DatabaseT – The OGN database type for the node
Public Functions
-
inline virtual void reset() override#
Resets the node state.
Cleans up the listener reference. Derived classes should call this method after cleaning up their own resources.
Note
This is a virtual method that can be overridden by derived classes.
Public Static Functions
- static inline void initInstance(
- NodeObj const &nodeObj,
- GraphInstanceID instanceId,
Initialize the node instance.
Default implementation - can be overridden by derived classes if needed.
- Parameters:
nodeObj – [in] The node object
instanceId – [in] The instance ID
Protected Functions
- inline bool computeImpl(
- DatabaseT &db,
- uint16_t port,
- uint64_t tag,
- uint32_t timeoutMs,
Common compute logic for clock publishing nodes.
Handles listener initialization, connection checking, and message publishing with timeout. Extracts data using the derived class’s extractData() and serializes using generateMessage().
- Parameters:
db – [in] Database accessor for node inputs/outputs
port – [in] Port number for UCX listener
tag – [in] UCX tag for message identification
timeoutMs – [in] Timeout in milliseconds for send request (0 = infinite)
- Returns:
bool True if execution succeeded, false otherwise
- inline virtual isaacsim::ucx::nodes::ClockData extractData(
- DatabaseT &db,
Extract clock data from node inputs.
Reads the timestamp from the database inputs. Can be overridden by derived classes if different extraction logic is needed.
- Parameters:
db – [in] Database accessor for node inputs
- Returns:
ClockData Extracted clock data
- virtual std::vector<uint8_t> generateMessage( ) = 0#
Generate message from clock data.
Pure virtual function that derived classes must implement to serialize clock data into the appropriate message format.
- Parameters:
data – [in] Clock data to serialize
- Returns:
std::vector<uint8_t> Serialized message data
-
inline bool initializeListener(uint16_t port)#
Gets or creates a listener for the specified port.
Returns an existing listener if one is already registered for the port, otherwise creates a new listener on the specified port.
The port is validated before attempting to create a listener. Invalid ports (0-1023) are rejected.
- Parameters:
port – [in] Port number for the listener (must be >= 1024)
- Returns:
bool True if listener was successfully obtained or created, false otherwise.
-
inline bool isInitialized() const#
Checks if the node has a valid listener.
Verifies if the listener has been properly created and initialized.
- Returns:
bool True if the listener exists, false otherwise.
-
template<typename DatabaseT>
inline bool ensureListenerReady( - DatabaseT &db,
- uint16_t port,
Ensures the listener is initialized and started.
Initializes the listener if not already done or if the port has changed, and starts the progress thread. Validates the port number before initialization.
- Template Parameters:
DatabaseT – The database type for logging
- Parameters:
db – [in] Database accessor for logging
port – [in] Port number for the listener (must be >= 1024)
- Returns:
bool True if listener is ready, false on error
-
inline bool waitForConnection()#
Waits for a client connection.
Checks if a connection exists, and if not, performs a non-blocking wait. Returns true if connected and ready to communicate, false if not yet connected.
- Returns:
bool True if connected, false if no connection available
-
template<typename DatabaseT>
inline bool publishMessage( - DatabaseT &db,
- const std::vector<uint8_t> &messageData,
- uint64_t tag,
- uint32_t timeoutMs,
Publishes a message over UCX with validation and timeout.
Validates that message data is not empty, then sends using UCX tagged send. Wrapper for UCXListener::tagSend() that adds logging for OmniGraph nodes.
- Template Parameters:
DatabaseT – The database type for logging
- Parameters:
db – [in] Database accessor for logging
messageData – [in] Serialized message data to send
tag – [in] UCX tag for message identification
timeoutMs – [in] Timeout in milliseconds for send request (0 = infinite)
- Returns:
bool True if send completed successfully, false on error or timeout
Protected Attributes
-
std::shared_ptr<isaacsim::ucx::core::UCXListener> m_listener = nullptr#
UCX listener instance.
Protected Static Functions
-
static inline bool isValidPort(uint16_t port)#
Validates port number is in acceptable range for OmniGraph nodes.
Ports 0-1023 are system reserved and should not be used by OmniGraph nodes. Port 0 (auto-assign) is also not allowed to ensure deterministic behavior.
- Parameters:
port – [in] Port number to validate
- Returns:
bool True if port is valid (>= 1024), false otherwise
-
static inline bool isValidTag(uint64_t tag)#
Validates UCX tag value.
UCX uses the full 64-bit tag space. This function can be extended to restrict tag ranges if needed for application-specific protocols.
- Parameters:
tag – [in] Tag value to validate
- Returns:
bool True if tag is valid, false otherwise