Addressed comments for nsnam/ns-3-dev MR 91
- Removed unnecessary files src/core/model/{attribute-container,pair}.cc
- Removed 'explicit' modifier to PairChecker
- Modified output stream operator for PairValue; update PairValueTestCase
- Updated src/core/wscript to latest master
- Added Pair and AttributeContainer to utils/print-introspected-doxygen.cc
This commit is contained in:
committed by
Tom Henderson
parent
9392a452d8
commit
c8f2bf250e
@@ -1,27 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2018 Caliola Engineering, LLC.
|
||||
*
|
||||
* 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 <jared.dulmage@caliola.com>
|
||||
* Note: Need this file for library to be built
|
||||
*/
|
||||
|
||||
#include "attribute-container.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,27 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2018 Caliola Engineering, LLC.
|
||||
*
|
||||
* 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 <jared.dulmage@caliola.com>
|
||||
* Note: Need this file for library to be built
|
||||
*/
|
||||
|
||||
#include "pair.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ns3/string.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <typeinfo>
|
||||
#include <typeinfo> // typeid
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
@@ -34,13 +34,12 @@ namespace ns3 {
|
||||
|
||||
class AttributeChecker;
|
||||
|
||||
// TODO(jared): useful to maybe define global to be the pair separator
|
||||
// for serialization / deserialization?
|
||||
// TODO: useful to maybe define some kind of configurable formatter?
|
||||
template <class A, class B>
|
||||
std::ostream &
|
||||
operator << (std::ostream &os, const std::pair<A, B> &p)
|
||||
{
|
||||
os << p.first << " " << p.second;
|
||||
os << "(" << p.first << "," << p.second << ")";
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -112,7 +111,7 @@ class PairChecker : public ns3::PairChecker<A, B>
|
||||
{
|
||||
public:
|
||||
PairChecker (void);
|
||||
explicit PairChecker (Ptr<const AttributeChecker> firstchecker, Ptr<const AttributeChecker> secondchecker);
|
||||
PairChecker (Ptr<const AttributeChecker> firstchecker, Ptr<const AttributeChecker> secondchecker);
|
||||
void SetCheckers (Ptr<const AttributeChecker> firstchecker, Ptr<const AttributeChecker> secondchecker);
|
||||
typename ns3::PairChecker<A, B>::checker_pair_type GetCheckers (void) const;
|
||||
|
||||
@@ -123,19 +122,15 @@ private:
|
||||
|
||||
template <class A, class B>
|
||||
PairChecker<A, B>::PairChecker (void)
|
||||
: m_firstchecker (0)
|
||||
, m_secondchecker (0)
|
||||
{
|
||||
|
||||
}
|
||||
: m_firstchecker (0),
|
||||
m_secondchecker (0)
|
||||
{}
|
||||
|
||||
template <class A, class B>
|
||||
PairChecker<A, B>::PairChecker (Ptr<const AttributeChecker> firstchecker, Ptr<const AttributeChecker> secondchecker)
|
||||
: m_firstchecker (firstchecker)
|
||||
, m_secondchecker (secondchecker)
|
||||
{
|
||||
|
||||
}
|
||||
: m_firstchecker (firstchecker),
|
||||
m_secondchecker (secondchecker)
|
||||
{}
|
||||
|
||||
template <class A, class B>
|
||||
void
|
||||
@@ -174,14 +169,14 @@ template <class A, class B>
|
||||
Ptr<PairChecker<A, B> >
|
||||
MakePairChecker (void)
|
||||
{
|
||||
std::string typeName, underlyingType;
|
||||
std::string pairName, underlyingType;
|
||||
typedef PairValue<A, B> T;
|
||||
std::string first_type_name = typeid (typename T::value_type::first_type).name ();
|
||||
std::string second_type_name = typeid (typename T::value_type::second_type).name ();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "ns3::PairValue<" << first_type_name << ", " << second_type_name << ">";
|
||||
typeName = oss.str ();
|
||||
pairName = oss.str ();
|
||||
}
|
||||
|
||||
{
|
||||
@@ -191,16 +186,14 @@ MakePairChecker (void)
|
||||
}
|
||||
|
||||
return DynamicCast<PairChecker<A, B> > (
|
||||
MakeSimpleAttributeChecker<T, internal::PairChecker<A, B> > (typeName, underlyingType)
|
||||
);
|
||||
MakeSimpleAttributeChecker<T, internal::PairChecker<A, B> > (pairName, underlyingType)
|
||||
);
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
PairValue<A, B>::PairValue ()
|
||||
: m_value (std::make_pair (Create <A> (), Create <B> ()))
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
template <class A, class B>
|
||||
PairValue<A, B>::PairValue (const typename PairValue<A, B>::result_type &value)
|
||||
|
||||
@@ -158,7 +158,7 @@ PairValueSettingsTestCase::DoRun ()
|
||||
std::ostringstream oss, ref;
|
||||
oss << *p;
|
||||
|
||||
ref << "StringPair = { hello world } AddressPair = { " << addr << " 31 }";
|
||||
ref << "StringPair = { (hello,world) } AddressPair = { (" << addr << ",31) }";
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ ((oss.str ()), (ref.str ()), "Pairs not correctly set");
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -101,10 +101,6 @@ def configure(conf):
|
||||
conf.check_nonfatal(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H')
|
||||
conf.check_nonfatal(header_name='dirent.h', define_name='HAVE_DIRENT_H')
|
||||
|
||||
if conf.check_nonfatal(header_name='stdlib.h'):
|
||||
conf.define('HAVE_STDLIB_H', 1)
|
||||
conf.define('HAVE_GETENV', 1)
|
||||
|
||||
conf.check_nonfatal(header_name='signal.h', define_name='HAVE_SIGNAL_H')
|
||||
|
||||
# Check for POSIX threads
|
||||
@@ -239,15 +235,11 @@ 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',
|
||||
'model/system-wall-clock-timestamp.cc',
|
||||
'model/version.cc',
|
||||
'model/attribute-container.cc',
|
||||
'model/pair.cc',
|
||||
]
|
||||
|
||||
if (bld.env['ENABLE_EXAMPLES']):
|
||||
@@ -256,6 +248,7 @@ def build(bld):
|
||||
core_test = bld.create_ns3_module_test_library('core')
|
||||
core_test.source = [
|
||||
'test/attribute-test-suite.cc',
|
||||
'test/attribute-container-test-suite.cc',
|
||||
'test/build-profile-test-suite.cc',
|
||||
'test/callback-test-suite.cc',
|
||||
'test/command-line-test-suite.cc',
|
||||
@@ -268,6 +261,7 @@ def build(bld):
|
||||
'test/event-garbage-collector-test-suite.cc',
|
||||
'test/many-uniform-random-variables-one-get-value-call-test-suite.cc',
|
||||
'test/one-uniform-random-variable-many-get-value-calls-test-suite.cc',
|
||||
'test/pair-value-test-suite.cc',
|
||||
'test/sample-test-suite.cc',
|
||||
'test/simulator-test-suite.cc',
|
||||
'test/time-test-suite.cc',
|
||||
@@ -277,10 +271,13 @@ 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',
|
||||
]
|
||||
|
||||
if (bld.env['ENABLE_EXAMPLES']):
|
||||
core_test.source.extend([
|
||||
'test/examples-as-tests-test-suite.cc',
|
||||
])
|
||||
|
||||
headers = bld(features='ns3header')
|
||||
headers.module = 'core'
|
||||
headers.source = [
|
||||
@@ -295,6 +292,7 @@ def build(bld):
|
||||
'model/map-scheduler.h',
|
||||
'model/heap-scheduler.h',
|
||||
'model/calendar-scheduler.h',
|
||||
'model/priority-queue-scheduler.h',
|
||||
'model/simulation-singleton.h',
|
||||
'model/singleton.h',
|
||||
'model/timer.h',
|
||||
@@ -303,6 +301,7 @@ def build(bld):
|
||||
'model/synchronizer.h',
|
||||
'model/make-event.h',
|
||||
'model/system-wall-clock-ms.h',
|
||||
'model/system-wall-clock-timestamp.h',
|
||||
'model/empty.h',
|
||||
'model/callback.h',
|
||||
'model/object-base.h',
|
||||
@@ -339,6 +338,7 @@ def build(bld):
|
||||
'model/pointer.h',
|
||||
'model/object-factory.h',
|
||||
'model/attribute-helper.h',
|
||||
'model/attribute-container.h',
|
||||
'model/global-value.h',
|
||||
'model/traced-callback.h',
|
||||
'model/traced-value.h',
|
||||
@@ -347,6 +347,7 @@ def build(bld):
|
||||
'model/object-ptr-container.h',
|
||||
'model/object-vector.h',
|
||||
'model/object-map.h',
|
||||
'model/pair.h',
|
||||
'model/deprecated.h',
|
||||
'model/abort.h',
|
||||
'model/names.h',
|
||||
@@ -372,13 +373,6 @@ def build(bld):
|
||||
'model/time-printer.h',
|
||||
'model/show-progress.h',
|
||||
'model/version.h',
|
||||
'model/pair.h',
|
||||
'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']):
|
||||
@@ -452,3 +446,39 @@ 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]))
|
||||
|
||||
@@ -1570,7 +1570,14 @@ PrintAttributeImplementations (std::ostream & os)
|
||||
PrintAttributeValueSection (os, "ObjectMap", false);
|
||||
PrintMakeAccessors (os, "ObjectMap");
|
||||
PrintMakeChecker (os, "ObjectMap", "object-map.h");
|
||||
|
||||
PrintAttributeValueSection (os, "Pair", false);
|
||||
PrintAttributeValueWithName (os, "Pair", "Pair", "pair.h");
|
||||
PrintMakeChecker (os, "Pair", "pair.h");
|
||||
|
||||
PrintAttributeValueSection (os, "AttributeContainer", false);
|
||||
PrintAttributeValueWithName (os, "AttributeContainer", "AttributeContainer", "attribute-container.h");
|
||||
PrintMakeChecker (os, "AttributeContainer", "attribute-container.h");
|
||||
} // PrintAttributeImplementations ()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user