/*************************************************************************** * * Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved * **************************************************************************/ /** * @file BDSSDKMessage.hpp * @author Vaino(lappivaeinoe@baidu.com) * @date 2016/10/26 17:51:32 * @brief Message container to pass commands to SDK and receive events/callbacks from the SDK * **/ #ifndef _BDS_SDK_MESSAGE_HPP_ #define _BDS_SDK_MESSAGE_HPP_ #include #include #include namespace bds { extern const std::string DATA_CHUNK; class BDSSDKMessageImpl; class BDSSDKMessage{ public: BDSSDKMessage(const std::string &p_name); BDSSDKMessage(); BDSSDKMessage(const BDSSDKMessage &m); virtual BDSSDKMessage& operator=(const BDSSDKMessage &m); std::string name; /* char* data; unsigned int length; */ virtual ~BDSSDKMessage(); /* Set parameters to message */ void set_parameter(const std::string &key, const std::string &value); void set_parameter(const std::string &key, int value); void set_parameter(const std::string &key, float value); void set_parameter(const std::string &key, const char* value, int valueLen); void set_parameter(const std::string &key, const std::vector &value); /* Get keys for parameters set to message */ std::vector string_param_keys(); std::vector int_param_keys(); std::vector float_param_keys(); std::vector char_param_keys(); std::vector vector_param_keys(); /* Get parameters from message */ bool get_parameter(const std::string &key, std::string &outValue); bool get_parameter(const std::string &key, int &outValue); bool get_parameter(const std::string &key, float &outValue); bool get_parameter(const std::string &key, const char* &outValue, int &outValueLen); bool get_parameter(const std::string &key, std::vector &outValue); private: BDSSDKMessageImpl* _impl; friend class BDSSDKMessageImpl; }; } #endif