1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This file contains the declaration of classes and its members related to
28 #ifndef __OCHEADEROPTION_H
29 #define __OCHEADEROPTION_H
31 #include <OCException.h>
32 #include <StringConstants.h>
35 namespace HeaderOption
38 * @brief OCHeaderOption class allows to create instances which comprises optionID
39 * and optionData as members. These are used in setting Header options.
40 * After creating instances of OCHeaderOptions, use setHeaderOptions API
41 * (in OCResource.h) to set header Options.
42 * NOTE: HeaderOptionID is an unsigned integer value which MUST be within
43 * range of 2048 to 3000 inclusive of lower and upper bound.
44 * HeaderOptions instance creation fails if above condition is not satisfied.
46 const uint16_t MIN_HEADER_OPTIONID = 2048;
47 const uint16_t MAX_HEADER_OPTIONID = 3000;
53 std::string m_optionData;
57 * OCHeaderOption constructor
59 OCHeaderOption(uint16_t optionID, std::string optionData):
61 m_optionData(optionData)
63 if(!(optionID >= MIN_HEADER_OPTIONID && optionID <= MAX_HEADER_OPTIONID))
65 throw OCException(OC::Exception::OPTION_ID_RANGE_INVALID);
69 virtual ~OCHeaderOption(){}
71 OCHeaderOption(const OCHeaderOption&) = default;
73 OCHeaderOption(OCHeaderOption&&) = default;
75 OCHeaderOption& operator=(const OCHeaderOption&) = default;
77 OCHeaderOption& operator=(OCHeaderOption&&) = default;
80 * API to get Option ID
81 * @return unsigned integer option ID
83 uint16_t getOptionID() const
89 * API to get Option data
90 * @return std::string of option data
92 std::string getOptionData() const
97 } // namespace HeaderOption
100 #endif //__OCHEADEROPTION_H