From 643378b8167dd3ba20c8bda7fd46ba8906c70d9a Mon Sep 17 00:00:00 2001 From: Jared Dulmage Date: Sun, 1 Sep 2019 19:43:33 -0600 Subject: [PATCH] Removed extended-attribute-helper.h This file should be part of another merge request. --- src/core/model/extended-attribute-helper.h | 346 --------------------- src/core/wscript | 45 +-- 2 files changed, 8 insertions(+), 383 deletions(-) delete mode 100644 src/core/model/extended-attribute-helper.h diff --git a/src/core/model/extended-attribute-helper.h b/src/core/model/extended-attribute-helper.h deleted file mode 100644 index cd0ed0461..000000000 --- a/src/core/model/extended-attribute-helper.h +++ /dev/null @@ -1,346 +0,0 @@ -/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/* - * Copyright (c) 2018 WPL, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Jared Dulmage - */ - -#ifndef EXTENDED_ATTRIBUTE_HELPER_H -#define EXTENDED_ATTRIBUTE_HELPER_H - -#include "ns3/attribute-accessor-helper.h" - -namespace ns3 { -/** - * \ingroup attributeimpl - * - * MakeAccessorHelper implementation for a plain ole get functor. - * - * \tparam V \explicit The specific AttributeValue type to use to represent - * the Attribute. - * \tparam T \deduced The class whose object pointer will be passed to the get functor. - * \tparam U \deduced The return type of the get functor. - * \param [in] getter The address of the get functor. - * \returns The AttributeAccessor. - */ -template -inline -Ptr -DoMakeAccessorHelperOne (U (*getter)(const T*)) -{ - /* AttributeAccessor implementation with a plain ole functor method. */ - class POFunction : public AccessorHelper - { - public: - /* - * Construct from a class get functor method. - * \param [in] getter The class get functor method pointer. - */ - POFunction (U (*getter)(const T*)) - : AccessorHelper (), - m_getter (getter) - {} - private: - virtual bool DoSet (T *object, const V *v) const { - return false; - } - virtual bool DoGet (const T *object, V *v) const { - v->Set ((*m_getter)(object)); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return false; - } - U (*m_getter)(const T*); // The class get functor method pointer. - }; - return Ptr (new POFunction (getter), false); -} - -/** - * \ingroup attributeimpl - * - * MakeAccessorHelper implementation for a plain ole function returning void. - * - * \tparam V \explicit The specific AttributeValue type to use to represent - * the Attribute. - * \tparam T \deduced The class whose object pointer will be passed to the set functor. - * \tparam U \deduced The argument type of the set functor. - * \param [in] setter The address of the set functor, returning void. - * \returns The AttributeAccessor. - */ -template -inline -Ptr -DoMakeAccessorHelperOne (void (*setter)(T*, U)) -{ - /* AttributeAccessor implementation with a plain ole function returning void. */ - class POFunction : public AccessorHelper - { -public: - /* - * Construct from a class set method. - * \param [in] setter The class set method pointer. - */ - POFunction (void (*setter)(T*, U)) - : AccessorHelper (), - m_setter (setter) - {} -private: - virtual bool DoSet (T *object, const V *v) const { - typename AccessorTrait::Result tmp; - bool ok = v->GetAccessor (tmp); - if (!ok) - { - return false; - } - (*m_setter)(object, tmp); - return true; - } - virtual bool DoGet (const T *object, V *v) const { - return false; - } - virtual bool HasGetter (void) const { - return false; - } - virtual bool HasSetter (void) const { - return true; - } - void (*m_setter)(T*, U); // The class set method pointer, returning void. - }; - return Ptr (new POFunction (setter), false); -} - -/** - * \ingroup attributeimpl - * - * MakeAccessorHelper implementation for a ns3::Callback argument - * - * Using ns3::Callback functors gives the option of binding arguments - * \tparam V \explicit The specific AttributeValue type to use to represent - * the Attribute. - * \tparam T \deduced The class whose object pointer will be passed to the set functor. - * \tparam U \deduced The argument type of the set functor. - * \param [in] setter The set functor (type ns3::Callback), returning void. - * \returns The AttributeAccessor. - */ -template -inline -Ptr -DoMakeAccessorHelperOne (Callback setter) -{ - /* AttributeAccessor implementation with a plain ole function returning void. */ - class POFunction : public AccessorHelper - { -public: - /* - * Construct from a class set method. - * \param [in] setter The class set method pointer. - */ - POFunction (Callback setter) - : AccessorHelper (), - m_setter (setter) - {} -private: - virtual bool DoSet (T *object, const V *v) const { - typename AccessorTrait::Result tmp; - bool ok = v->GetAccessor (tmp); - if (!ok) - { - return false; - } - m_setter(object, tmp); - return true; - } - virtual bool DoGet (const T *object, V *v) const { - return false; - } - virtual bool HasGetter (void) const { - return false; - } - virtual bool HasSetter (void) const { - return true; - } - Callback m_setter; // The class set method pointer, returning void. - }; - return Ptr (new POFunction (setter), false); -} - -/** - * \ingroup attributeimpl - * - * MakeAccessorHelper implementation with a get functor - * and a set functor returning void. - * - * The two versions of this function differ only in argument order. - * - * \tparam W \explicit The specific AttributeValue type to use to represent - * the Attribute. - * \tparam T \deduced The class whose object pointer is passed to the functors. - * \tparam U \deduced The argument type of the set method. - * \tparam V \deduced The return type of the get functor method. - * \param [in] setter The address of the set functor, returning void. - * \param [in] getter The address of the get functor. - * \returns The AttributeAccessor. - */ -template -inline -Ptr -DoMakeAccessorHelperTwo (void (*setter)(T*, U), V (*getter)(T*)) -{ - /* - * AttributeAccessor implementation with plain ole get functor and set functor, - * returning void. - */ - class POFunction : public AccessorHelper - { -public: - /* - * Construct from get and set functors. - * \param [in] setter The set functor pointer, returning void. - * \param [in] getter The get functor pointer. - */ - POFunction (void (*setter)(T*, U), V (*getter)(T*)) - : AccessorHelper (), - m_setter (setter), - m_getter (getter) - {} -private: - virtual bool DoSet (T *object, const W *v) const { - typename AccessorTrait::Result tmp; - bool ok = v->GetAccessor (tmp); - if (!ok) - { - return false; - } - (*m_setter)(object, tmp); - return true; - } - virtual bool DoGet (const T *object, W *v) const { - v->Set ((*m_getter)(object)); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return true; - } - void (*m_setter)(T*, U); // The class set method pointer, returning void. - V (*m_getter)(T*); // The class get functor method pointer. - }; - return Ptr (new POFunction (setter, getter), false); -} - - -/** - * \ingroup attributeimpl - * \copydoc DoMakeAccessorHelperTwo(void(*)(T*, U),V(*)(T*)) - */ -template -inline -Ptr -DoMakeAccessorHelperTwo (V (*getter)(T*), void (*setter)(T*, U)) -{ - return DoMakeAccessorHelperTwo (setter, getter); -} - - -/** - * \ingroup attributeimpl - * - * MakeAccessorHelper implementation with a get functor - * and a set functor returning \p bool. - * - * The two versions of this function differ only in argument order. - * - * \tparam W \explicit The specific AttributeValue type to use to represent - * the Attribute. - * \tparam T \deduced The class whose object pointer is passed to the functors. - * \tparam U \deduced The argument type of the set method. - * \tparam V \deduced The return type of the get functor method. - * \param [in] setter The address of the set functor, returning bool. - * \param [in] getter The address of the get functor. - * \returns The AttributeAccessor. - */ -template -inline -Ptr -DoMakeAccessorHelperTwo (bool (*setter)(T*, U), V (*getter)(T*)) -{ - /* - * AttributeAccessor implementation with plain ole get functor and - * set functor, returning bool. - */ - class POFunction : public AccessorHelper - { -public: - /* - * Construct from class get functor and set method, returning bool. - * \param [in] setter The class set method pointer, returning bool. - * \param [in] getter The class get functor method pointer. - */ - POFunction (bool (*setter)(T*, U), V (*getter)(T**)) - : AccessorHelper (), - m_setter (setter), - m_getter (getter) - {} -private: - virtual bool DoSet (T *object, const W *v) const { - typename AccessorTrait::Result tmp; - bool ok = v->GetAccessor (tmp); - if (!ok) - { - return false; - } - ok = (*m_setter)(object, tmp); - return ok; - } - virtual bool DoGet (const T *object, W *v) const { - v->Set ((*m_getter)(object)); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return true; - } - bool (*m_setter)(T*, U); // The set method pointer, returning bool. - V (*m_getter)(T*); // The get functor method pointer. - }; - return Ptr (new POFunction (setter, getter), false); -} - - -/** - * \ingroup attributeimpl - * \copydoc ns3::DoMakeAccessorHelperTwo(bool(*)(T*, U),V(*)(T*)) - */ -template -inline -Ptr -DoMakeAccessorHelperTwo (V (*getter)(T*), bool (*setter)(T*, U)) -{ - return DoMakeAccessorHelperTwo (setter, getter); -} - -} // namespace ns3 - - -#endif // EXTENDED_ATTRIBUTE_HELPER_H \ No newline at end of file diff --git a/src/core/wscript b/src/core/wscript index fda2e117f..3d9cbe747 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -36,7 +36,7 @@ def options(opt): % ", ".join([repr(p) for p in list(int64x64.keys())])), choices=list(int64x64.keys()), dest='int64x64_impl') - + opt.add_option('--disable-pthread', help=('Whether to enable the use of POSIX threads'), action="store_true", default=False, @@ -239,6 +239,8 @@ def build(bld): 'model/hash.cc', 'model/des-metrics.cc', 'model/ascii-file.cc', + 'model/attribute-container.cc', + 'model/pair.cc', 'model/node-printer.cc', 'model/time-printer.cc', 'model/show-progress.cc', @@ -275,6 +277,8 @@ def build(bld): 'test/watchdog-test-suite.cc', 'test/hash-test-suite.cc', 'test/type-id-test-suite.cc', + 'test/pair-value-test-suite.cc', + 'test/attribute-container-test-suite.cc', ] headers = bld(features='ns3header') @@ -372,6 +376,9 @@ def build(bld): 'model/attribute-container-accessor-helper.h', 'model/attribute-container.h', 'model/extended-attribute-helper.h', + 'model/node-printer.h', + 'model/time-printer.h', + 'model/show-progress.h', ] if (bld.env['ENABLE_EXAMPLES']): @@ -445,39 +452,3 @@ def build(bld): pymod = bld.ns3_python_bindings() if pymod is not None: pymod.source += ['bindings/module_helpers.cc'] - -def print_version(bld, tg): - tg.post() - - for task in tg.tasks: - if task.__class__.__name__ == 'git_ns3_version_info': - #manually run task - task.run() - break - - handlers = { - 'VERSION_TAG': lambda s: s.strip('"'), - 'CLOSEST_TAG': lambda s: s.strip('"'), - 'VERSION_TAG_DISTANCE': lambda s: '' if s == '0' else "+" + s, - 'VERSION_COMMIT_HASH': lambda s: "@" + s.strip('"'), - 'VERSION_DIRTY_FLAG': lambda s: '' if s == '0' else '-dirty', - 'BUILD_PROFILE': lambda s: "-" + s - } - - fields=('VERSION_TAG', 'CLOSEST_TAG', 'VERSION_TAG_DISTANCE', - 'VERSION_COMMIT_HASH', 'VERSION_DIRTY_FLAG', 'BUILD_PROFILE') - - parts = dict() - - for field in fields: - if field in bld.env: - parts[field] = handlers[field](bld.env[field]) - else: - parts[field] = '' - - if parts['CLOSEST_TAG'] != parts['VERSION_TAG']: - parts['CLOSEST_TAG'] = "+" + parts['CLOSEST_TAG'] - else: - parts['CLOSEST_TAG'] = "" - - print(''.join([parts[f] for f in fields]))