Class RequestParameters¶
Defined in File predict_api.hpp
Inheritance Relationships¶
Base Type¶
public amdinfer::Serializable
(Class Serializable)
Class Documentation¶
-
class RequestParameters : public amdinfer::Serializable¶
Holds any parameters from JSON (defined by KServe spec as one of bool, number or string). We further restrict numbers to be doubles or int32.
Public Functions
-
void put(const std::string &key, bool value)¶
Puts in a key-value pair.
- Parameters
key – key used to store and retrieve the value
value – value to store
-
void put(const std::string &key, double value)¶
Puts in a key-value pair.
- Parameters
key – key used to store and retrieve the value
value – value to store
-
void put(const std::string &key, int32_t value)¶
Puts in a key-value pair.
- Parameters
key – key used to store and retrieve the value
value – value to store
-
void put(const std::string &key, const std::string &value)¶
Puts in a key-value pair.
- Parameters
key – key used to store and retrieve the value
value – value to store
-
void put(const std::string &key, const char *value)¶
Puts in a key-value pair.
- Parameters
key – key used to store and retrieve the value
value – value to store
-
template<typename T>
inline T get(const std::string &key)¶ Gets a pointer to the named parameter. Returns nullptr if not found or if a bad type is used.
- Template Parameters
T – type of parameter. Must be (bool|double|int32_t|std::string)
- Parameters
key – parameter to get
- Returns
T*
-
bool has(const std::string &key)¶
Checks if a particular parameter exists.
- Parameters
key – name of the parameter to check
- Returns
bool
-
void erase(const std::string &key)¶
Removes a parameter.
- Parameters
key – name of the parameter to remove
-
size_t size() const¶
Gets the number of parameters.
-
bool empty() const¶
Checks if the parameters are empty.
-
std::map<std::string, Parameter, std::less<>> data() const¶
Gets the underlying data structure holding the parameters.
-
inline auto begin()¶
Returns a read/write iterator to the first parameter in the object.
-
inline auto cbegin() const¶
Returns a read iterator to the first parameter in the object.
-
inline auto end()¶
Returns a read/write iterator to one past the last parameter in the object.
-
inline auto cend() const¶
Returns a read iterator to one past the last parameter in the object.
-
virtual size_t serializeSize() const override¶
Returns the size of the serialized data.
- Returns
size_t
-
virtual void serialize(std::byte *data_out) const override¶
Serializes the object to the provided memory address. There should be sufficient space to store the serialized object.
- Parameters
data_out –
-
virtual void deserialize(const std::byte *data_in) override¶
Deserializes the data at the provided memory address to initialize this object. If the memory cannot be deserialized, an exception is thrown.
- Parameters
data_in – a pointer to the serialized data for this object type
Friends
-
inline friend std::ostream &operator<<(std::ostream &os, RequestParameters const &self)¶
Provides an implementation to print the class with std::cout to an ostream.
-
void put(const std::string &key, bool value)¶