namespace protobuf_ops

Overview

namespace protobuf_ops {

// classes

template <class ... MSG_TYPES>
class NRPProtobufOps;

class NRPProtobufOpsIface;

// global functions

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
std::unique_ptr<gpb::Message> unpackProtoAnySubset(const gpb::Any& from);

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setDataPackMessageDataSubset(
    const gpb::Message& from,
    EngineGrpc::DataPackMessage* to
);

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
DataPackInterfaceConstSharedPtr getDataPackInterfaceFromMessageSubset(
    const std::string& engineName,
    const EngineGrpc::DataPackMessage& from
);

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setDataPackMessageFromInterfaceSubset(
    const DataPackInterface& from,
    EngineGrpc::DataPackMessage* to
);

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setTrajectoryMessageFromInterfaceSubset(
    const DataPackInterface& from,
    NrpCore::TrajectoryMessage* to
);

} // namespace protobuf_ops

Detailed Documentation

Global Functions

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
std::unique_ptr<gpb::Message> unpackProtoAnySubset(const gpb::Any& from)

Attempts to unpack an Any protobuf msg to any of the template parameter classes.

Parameters:

MSG_TYPE

template param containing the list of protobuf types that will be check in the conversion

REMAINING_MSG_TYPES

from

Any protobuf msg

Returns:

protobuf msg unpacked from ‘from’

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setDataPackMessageDataSubset(
    const gpb::Message& from,
    EngineGrpc::DataPackMessage* to
)

Set a protobuf datapack msg data field from a protobuf message.

Parameters:

MSG_TYPE

template param containing the list of protobuf types that will be check in the conversion

REMAINING_MSG_TYPES

from

Protobuf message

to

Protobuf datapack message which data will be set

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
DataPackInterfaceConstSharedPtr getDataPackInterfaceFromMessageSubset(
    const std::string& engineName,
    const EngineGrpc::DataPackMessage& from
)

Finds the type of protobuf msg contained in ‘from’ data field and creates a datapack from it.

Parameters:

MSG_TYPE

template param containing the list of protobuf types that will be check in the conversion

REMAINING_MSG_TYPES

engineName

owner of ‘from’

from

datapack protobuf msg

Returns:

the instantiated datapack

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setDataPackMessageFromInterfaceSubset(
    const DataPackInterface& from,
    EngineGrpc::DataPackMessage* to
)

Sets the data field of a datapack protobuf message from a datapack interface.

Parameters:

MSG_TYPE

template param containing the list of protobuf types that will be check in the conversion

REMAINING_MSG_TYPES

from

input datapack containing data

to

protobuf msg pointer which data field will be set to ‘from’

template <class MSG_TYPE, class ... REMAINING_MSG_TYPES>
void setTrajectoryMessageFromInterfaceSubset(
    const DataPackInterface& from,
    NrpCore::TrajectoryMessage* to
)

Sets the data field of a datapack protobuf message from a datapack interface.

Parameters:

MSG_TYPE

template param containing the list of protobuf types that will be check in the conversion

REMAINING_MSG_TYPES

from

input datapack containing data

to

protobuf msg pointer which data field will be set to ‘from’