Also udated copyright dates where applicable.
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionPtr
Option::clone() const {
- OptionPtr option(new Option(*this));
- return (option);
+ return (cloneInternal<Option>());
}
void
local_options.insert(std::make_pair(it->second->getType(),
copy));
}
+ // All options copied successfully, so assign them to the output
+ // parameter.
options_copy.swap(local_options);
}
Option(Universe u, uint16_t type, OptionBufferConstIter first,
OptionBufferConstIter last);
- Option(const Option& option);
+ /// @brief Copy constructor.
+ ///
+ /// This constructor makes a deep copy of the option and all of the
+ /// suboptions. It calls @ref getOptionsCopy to deep copy suboptions.
+ ///
+ /// @param source Option to be copied.
+ Option(const Option& source);
+ /// @brief Assignment operator.
+ ///
+ /// The assignment operator performs a deep copy of the option and
+ /// its suboptions. It calls @ref getOptionsCopy to deep copy
+ /// suboptions.
+ ///
+ /// @param rhs Option to be assigned.
Option& operator=(const Option& rhs);
+ /// @brief Copies this option and returns a pointer to the copy.
+ ///
+ /// This function must be overriden in the derived classes to make
+ /// a copy of the derived type. The simplest way to do it is by
+ /// calling @ref copyInternal function with an appropriate template
+ /// parmater.
+ ///
+ /// @return Pointer to the copy of the option.
virtual OptionPtr clone() const;
/// @brief returns option universe (V4 or V6)
return (options_);
}
+ /// @brief Performs deep copy of suboptions.
+ ///
+ /// This method calls @ref clone method to deep copy each option.
+ ///
+ /// @param [out] options_copy Container where copied options are stored.
void getOptionsCopy(OptionCollection& options_copy) const;
/// Attempts to delete first suboption of requested type
protected:
+ /// @brief Copies this option and returns a pointer to the copy.
+ ///
+ /// The deep copy of the option is performed by calling copy
+ /// constructor of the option of a given type. Derived classes call
+ /// this method in the implementations of @ref clone methods to
+ /// create a copy of the option of their type.
+ ///
+ /// @tparam OptionType Type of the option of which a clone should
+ /// be created.
template<typename OptionType>
OptionPtr cloneInternal() const {
boost::shared_ptr<OptionType>
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Option4AddrLst(uint8_t type, OptionBufferConstIter first,
OptionBufferConstIter last);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Writes option in a wire-format to a buffer.
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @brief Copy constructor
Option4ClientFqdn(const Option4ClientFqdn& source);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Destructor
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @brief Copy constructor
Option6ClientFqdn(const Option6ClientFqdn& source);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Destructor
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Option6IA(uint16_t type, OptionBuffer::const_iterator begin,
OptionBuffer::const_iterator end);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// Writes option in wire-format to buf, returns pointer to first unused
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Option6IAAddr(uint32_t type, OptionBuffer::const_iterator begin,
OptionBuffer::const_iterator end);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Writes option in wire-format.
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Option6IAPrefix(uint32_t type, OptionBuffer::const_iterator begin,
OptionBuffer::const_iterator end);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Writes option in wire-format.
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2015-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// @param end Iterator to end of option data (first byte after option end).
Option6StatusCode(OptionBufferConstIter begin, OptionBufferConstIter end);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Writes option in wire-format.
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionCustom(const OptionDefinition& def, Universe u,
OptionBufferConstIter first, OptionBufferConstIter last);
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const;
/// @brief Create new buffer and set its value as an IP address.
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
class OptionInt: public Option {
private:
+ /// @brief Pointer to the option object for a specified type T.
typedef boost::shared_ptr<OptionInt<T> > OptionIntTypePtr;
public:
unpack(begin, end);
}
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const {
return (cloneInternal<OptionInt<T> >());
}
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
class OptionIntArray: public Option {
private:
+ /// @brief Pointer to the option type for the specified T.
typedef boost::shared_ptr<OptionIntArray<T> > OptionIntArrayTypePtr;
public:
unpack(begin, end);
}
+ /// @brief Copies this option and returns a pointer to the copy.
virtual OptionPtr clone() const {
return (cloneInternal<OptionIntArray<T> >());
}
OptionBufferConstIter begin,
OptionBufferConstIter end);
+ /// @brief Copies this option and returns a pointer to the copy.
OptionPtr clone() const;
/// @brief Renders option into the buffer in the wire format.
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionString(const Option::Universe u, const uint16_t type,
OptionBufferConstIter begin, OptionBufferConstIter end);
+ /// @brief Copies this option and returns a pointer to the copy.
OptionPtr clone() const;
/// @brief Returns length of the whole option, including header.
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionVendor(Option::Universe u, OptionBufferConstIter begin,
OptionBufferConstIter end);
+ /// @brief Copies this option and returns a pointer to the copy.
OptionPtr clone() const;
/// @brief Writes option in wire-format to buf, returns pointer to first
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
OptionVendorClass(Option::Universe u, OptionBufferConstIter begin,
OptionBufferConstIter end);
+ /// @brief Copies this option and returns a pointer to the copy.
OptionPtr clone() const;
/// @brief Renders option into the buffer in the wire format.