From 86379fa5b5c5884b4cb116a0ad0bbcbcc5b3bee1 Mon Sep 17 00:00:00 2001 From: Josh Pelkey Date: Fri, 13 May 2011 14:52:27 -0400 Subject: [PATCH] core coding style changes --- src/core/bindings/module_helpers.cc | 444 +++++++++---------- src/core/bindings/scan-header.h | 42 +- src/core/examples/main-callback.cc | 6 +- src/core/examples/main-test-sync.cc | 12 +- src/core/examples/sample-random-variable.cc | 4 +- src/core/examples/sample-simulator.cc | 2 +- src/core/model/abort.h | 34 +- src/core/model/assert.h | 4 +- src/core/model/attribute-accessor-helper.h | 316 ++++++------- src/core/model/attribute-helper.h | 124 +++--- src/core/model/attribute-list.cc | 8 +- src/core/model/attribute-list.h | 2 +- src/core/model/attribute.cc | 27 +- src/core/model/boolean.cc | 12 +- src/core/model/boolean.h | 2 +- src/core/model/breakpoint.cc | 2 +- src/core/model/breakpoint.h | 10 +- src/core/model/cairo-wideint-private.h | 342 +++++++------- src/core/model/calendar-scheduler.cc | 4 +- src/core/model/callback.cc | 63 +-- src/core/model/callback.h | 128 +++--- src/core/model/command-line.cc | 86 ++-- src/core/model/command-line.h | 16 +- src/core/model/config.cc | 144 +++--- src/core/model/config.h | 2 +- src/core/model/default-simulator-impl.cc | 11 +- src/core/model/double.cc | 6 +- src/core/model/enum.cc | 65 +-- src/core/model/enum.h | 22 +- src/core/model/event-id.cc | 14 +- src/core/model/event-impl.cc | 14 +- src/core/model/fatal-error.h | 2 +- src/core/model/fatal-impl.cc | 54 +-- src/core/model/global-value.cc | 36 +- src/core/model/global-value.h | 4 +- src/core/model/heap-scheduler.cc | 2 +- src/core/model/int-to-type.h | 2 +- src/core/model/int64x64-128.cc | 24 +- src/core/model/int64x64-128.h | 26 +- src/core/model/int64x64-cairo.cc | 24 +- src/core/model/int64x64-cairo.h | 22 +- src/core/model/int64x64-double.h | 10 +- src/core/model/int64x64.cc | 16 +- src/core/model/int64x64.h | 92 ++-- src/core/model/integer.cc | 6 +- src/core/model/log.cc | 29 +- src/core/model/log.h | 12 +- src/core/model/names.cc | 10 +- src/core/model/names.h | 2 +- src/core/model/nstime.h | 26 +- src/core/model/object-base.cc | 189 ++++---- src/core/model/object-base.h | 6 +- src/core/model/object-factory.cc | 11 +- src/core/model/object-factory.h | 4 +- src/core/model/object-vector.cc | 17 +- src/core/model/object-vector.h | 54 +-- src/core/model/object.cc | 24 +- src/core/model/object.h | 76 ++-- src/core/model/pointer.cc | 14 +- src/core/model/pointer.h | 6 +- src/core/model/ptr.h | 21 +- src/core/model/realtime-simulator-impl.cc | 31 +- src/core/model/ref-count-base.cc | 3 +- src/core/model/rng-stream.cc | 344 +++++++------- src/core/model/rng-stream.h | 2 +- src/core/model/simple-ref-count.h | 2 +- src/core/model/simulation-singleton.h | 2 +- src/core/model/simulator-impl.cc | 2 +- src/core/model/simulator.cc | 22 +- src/core/model/simulator.h | 98 ++-- src/core/model/synchronizer.cc | 30 +- src/core/model/system-condition.h | 4 +- src/core/model/system-mutex.h | 2 +- src/core/model/system-thread.h | 2 +- src/core/model/test.cc | 14 +- src/core/model/test.h | 426 +++++++++--------- src/core/model/time.cc | 42 +- src/core/model/trace-source-accessor.cc | 6 +- src/core/model/trace-source-accessor.h | 28 +- src/core/model/traced-callback.h | 45 +- src/core/model/traced-value.h | 4 +- src/core/model/type-id.cc | 62 +-- src/core/model/type-id.h | 11 +- src/core/model/type-name.cc | 14 +- src/core/model/type-name.h | 10 +- src/core/model/type-traits.h | 132 +++--- src/core/model/uinteger.cc | 6 +- src/core/model/unix-fd-reader.cc | 6 +- src/core/model/unix-fd-reader.h | 2 +- src/core/model/unix-system-condition.cc | 36 +- src/core/model/unix-system-mutex.cc | 22 +- src/core/model/unix-system-thread.cc | 36 +- src/core/model/unix-system-wall-clock-ms.cc | 5 +- src/core/model/vector.cc | 16 +- src/core/model/wall-clock-synchronizer.cc | 36 +- src/core/model/wall-clock-synchronizer.h | 2 +- src/core/model/watchdog.cc | 5 +- src/core/model/win32-system-wall-clock-ms.cc | 5 +- src/core/test/attribute-test-suite.cc | 160 +++---- src/core/test/callback-test-suite.cc | 28 +- src/core/test/config-test-suite.cc | 46 +- src/core/test/global-value-test-suite.cc | 8 +- src/core/test/int64x64-test-suite.cc | 43 +- src/core/test/names-test-suite.cc | 8 +- src/core/test/ptr-test-suite.cc | 24 +- src/core/test/rng-test-suite.cc | 10 +- src/core/test/sample-test-suite.cc | 2 +- src/core/test/simulator-test-suite.cc | 8 +- src/core/test/time-test-suite.cc | 3 +- src/core/test/type-traits-test-suite.cc | 12 +- src/core/test/watchdog-test-suite.cc | 3 +- 111 files changed, 2361 insertions(+), 2298 deletions(-) diff --git a/src/core/bindings/module_helpers.cc b/src/core/bindings/module_helpers.cc index f73972730..17a389885 100644 --- a/src/core/bindings/module_helpers.cc +++ b/src/core/bindings/module_helpers.cc @@ -2,7 +2,7 @@ #include "ns3/ref-count-base.h" -namespace ns3{ +namespace ns3 { void PythonCompleteConstruct (Ptr object, TypeId typeId, const AttributeList &attributes) { @@ -17,46 +17,46 @@ void PythonCompleteConstruct (Ptr object, TypeId typeId, const Attribute class PythonEventImpl : public ns3::EventImpl { private: - PyObject *m_callback; - PyObject *m_args; + PyObject *m_callback; + PyObject *m_args; public: - PythonEventImpl (PyObject *callback, PyObject *args) - { - m_callback = callback; - Py_INCREF(m_callback); - m_args = args; - Py_INCREF(m_args); - } - virtual ~PythonEventImpl () - { - PyGILState_STATE __py_gil_state; - __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); + PythonEventImpl (PyObject *callback, PyObject *args) + { + m_callback = callback; + Py_INCREF(m_callback); + m_args = args; + Py_INCREF(m_args); + } + virtual ~PythonEventImpl () + { + PyGILState_STATE __py_gil_state; + __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); - Py_DECREF(m_callback); - Py_DECREF(m_args); + Py_DECREF(m_callback); + Py_DECREF(m_args); - if (PyEval_ThreadsInitialized()) - PyGILState_Release(__py_gil_state); - } - virtual void Notify () - { - PyGILState_STATE __py_gil_state; - __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); - - PyObject *retval = PyObject_CallObject(m_callback, m_args); - if (retval) { - if (retval != Py_None) { - PyErr_SetString(PyExc_TypeError, "event callback should return None"); - PyErr_Print(); - } - Py_DECREF(retval); - } else { - PyErr_Print(); - } + if (PyEval_ThreadsInitialized()) + PyGILState_Release(__py_gil_state); + } + virtual void Notify () + { + PyGILState_STATE __py_gil_state; + __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0); - if (PyEval_ThreadsInitialized()) - PyGILState_Release(__py_gil_state); - } + PyObject *retval = PyObject_CallObject(m_callback, m_args); + if (retval) { + if (retval != Py_None) { + PyErr_SetString(PyExc_TypeError, "event callback should return None"); + PyErr_Print(); + } + Py_DECREF(retval); + } else { + PyErr_Print(); + } + + if (PyEval_ThreadsInitialized()) + PyGILState_Release(__py_gil_state); + } }; @@ -64,48 +64,48 @@ PyObject * _wrap_Simulator_Schedule(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception) { - PyObject *exc_type, *traceback; - PyObject *py_time; - PyObject *py_callback; - PyObject *user_args; - ns3::Ptr py_event_impl; - PyNs3EventId *py_EventId; + PyObject *exc_type, *traceback; + PyObject *py_time; + PyObject *py_callback; + PyObject *user_args; + ns3::Ptr py_event_impl; + PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); - goto error; + if (kwargs && PyObject_Length(kwargs) > 0) { + PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + goto error; } - if (PyTuple_GET_SIZE(args) < 2) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments"); - goto error; + if (PyTuple_GET_SIZE(args) < 2) { + PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments"); + goto error; } - py_time = PyTuple_GET_ITEM(args, 0); - py_callback = PyTuple_GET_ITEM(args, 1); + py_time = PyTuple_GET_ITEM(args, 0); + py_callback = PyTuple_GET_ITEM(args, 1); - if (!PyObject_IsInstance(py_time, (PyObject*) &PyNs3Time_Type)) { - PyErr_SetString(PyExc_TypeError, "Parameter 1 should be a ns3.Time instance"); - goto error; + if (!PyObject_IsInstance(py_time, (PyObject*) &PyNs3Time_Type)) { + PyErr_SetString(PyExc_TypeError, "Parameter 1 should be a ns3.Time instance"); + goto error; } - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); - goto error; + if (!PyCallable_Check(py_callback)) { + PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + goto error; } - user_args = PyTuple_GetSlice(args, 2, PyTuple_GET_SIZE(args)); - py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + user_args = PyTuple_GetSlice(args, 2, PyTuple_GET_SIZE(args)); + py_event_impl = ns3::Create(py_callback, user_args); + Py_DECREF(user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId( - ns3::Simulator::Schedule(*((PyNs3Time *) py_time)->obj, py_event_impl)); - py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; - return (PyObject *) py_EventId; + py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId( + ns3::Simulator::Schedule(*((PyNs3Time *) py_time)->obj, py_event_impl)); + py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; + return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; } @@ -113,41 +113,41 @@ PyObject * _wrap_Simulator_ScheduleNow(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception) { - PyObject *exc_type, *traceback; - PyObject *py_callback; - PyObject *user_args; - ns3::Ptr py_event_impl; - PyNs3EventId *py_EventId; + PyObject *exc_type, *traceback; + PyObject *py_callback; + PyObject *user_args; + ns3::Ptr py_event_impl; + PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); - goto error; + if (kwargs && PyObject_Length(kwargs) > 0) { + PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + goto error; } - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); - goto error; + if (PyTuple_GET_SIZE(args) < 1) { + PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); + goto error; } - py_callback = PyTuple_GET_ITEM(args, 0); + py_callback = PyTuple_GET_ITEM(args, 0); - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); - goto error; + if (!PyCallable_Check(py_callback)) { + PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + goto error; } - user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); - py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); + py_event_impl = ns3::Create(py_callback, user_args); + Py_DECREF(user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleNow(py_event_impl)); - py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; - return (PyObject *) py_EventId; + py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleNow(py_event_impl)); + py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; + return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; } @@ -155,41 +155,41 @@ PyObject * _wrap_Simulator_ScheduleDestroy(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception) { - PyObject *exc_type, *traceback; - PyObject *py_callback; - PyObject *user_args; - ns3::Ptr py_event_impl; - PyNs3EventId *py_EventId; + PyObject *exc_type, *traceback; + PyObject *py_callback; + PyObject *user_args; + ns3::Ptr py_event_impl; + PyNs3EventId *py_EventId; - if (kwargs && PyObject_Length(kwargs) > 0) { - PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); - goto error; + if (kwargs && PyObject_Length(kwargs) > 0) { + PyErr_SetString(PyExc_TypeError, "keyword arguments not supported"); + goto error; } - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); - goto error; + if (PyTuple_GET_SIZE(args) < 1) { + PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument"); + goto error; } - py_callback = PyTuple_GET_ITEM(args, 0); + py_callback = PyTuple_GET_ITEM(args, 0); - if (!PyCallable_Check(py_callback)) { - PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); - goto error; + if (!PyCallable_Check(py_callback)) { + PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable"); + goto error; } - user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); - py_event_impl = ns3::Create(py_callback, user_args); - Py_DECREF(user_args); + user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); + py_event_impl = ns3::Create(py_callback, user_args); + Py_DECREF(user_args); - py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); - py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleDestroy(py_event_impl)); - py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; - return (PyObject *) py_EventId; + py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type); + py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleDestroy(py_event_impl)); + py_EventId->flags = PYBINDGEN_WRAPPER_FLAG_NONE; + return (PyObject *) py_EventId; error: - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; } @@ -197,89 +197,89 @@ PyObject * _wrap_TypeId_LookupByNameFailSafe(PyNs3TypeId *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception) { - bool ok; - const char *name; - Py_ssize_t name_len; - ns3::TypeId tid; - PyNs3TypeId *py_tid; - const char *keywords[] = {"name", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) { - PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; + bool ok; + const char *name; + Py_ssize_t name_len; + ns3::TypeId tid; + PyNs3TypeId *py_tid; + const char *keywords[] = { "name", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) { + PyObject *exc_type, *traceback; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; } - ok = ns3::TypeId::LookupByNameFailSafe(std::string(name, name_len), &tid); - if (!ok) + ok = ns3::TypeId::LookupByNameFailSafe(std::string(name, name_len), &tid); + if (!ok) { - PyErr_Format(PyExc_KeyError, "The ns3 type with name `%s' is not registered", name); - return NULL; + PyErr_Format(PyExc_KeyError, "The ns3 type with name `%s' is not registered", name); + return NULL; } - py_tid = PyObject_New(PyNs3TypeId, &PyNs3TypeId_Type); - py_tid->obj = new ns3::TypeId (tid); - PyNs3TypeId_wrapper_registry[(void *) py_tid->obj] = (PyObject *) py_tid; - - return (PyObject *) py_tid; + py_tid = PyObject_New(PyNs3TypeId, &PyNs3TypeId_Type); + py_tid->obj = new ns3::TypeId (tid); + PyNs3TypeId_wrapper_registry[(void *) py_tid->obj] = (PyObject *) py_tid; + + return (PyObject *) py_tid; } class CommandLinePythonValueSetter : public ns3::RefCountBase { - PyObject *m_namespace; - std::string m_variable; + PyObject *m_namespace; + std::string m_variable; public: - CommandLinePythonValueSetter (PyObject *ns, std::string const &variable) { - Py_INCREF(ns); - m_namespace = ns; - m_variable = variable; - } - bool Parse (std::string value) { - PyObject *pyvalue = PyString_FromStringAndSize (value.data(), value.size()); - PyObject_SetAttrString (m_namespace, (char *) m_variable.c_str(), pyvalue); - if (PyErr_Occurred()) { - PyErr_Print(); - return false; - } - return true; - } - virtual ~CommandLinePythonValueSetter () { - Py_DECREF (m_namespace); - m_namespace = NULL; - } - + CommandLinePythonValueSetter (PyObject *ns, std::string const &variable) { + Py_INCREF(ns); + m_namespace = ns; + m_variable = variable; + } + bool Parse (std::string value) { + PyObject *pyvalue = PyString_FromStringAndSize (value.data(), value.size()); + PyObject_SetAttrString (m_namespace, (char *) m_variable.c_str(), pyvalue); + if (PyErr_Occurred()) { + PyErr_Print(); + return false; + } + return true; + } + virtual ~CommandLinePythonValueSetter () { + Py_DECREF (m_namespace); + m_namespace = NULL; + } + }; PyObject * _wrap_CommandLine_AddValue(PyNs3CommandLine *self, PyObject *args, PyObject *kwargs, PyObject **return_exception) { - const char *name, *help, *variable = NULL; - PyObject *py_namespace = NULL; - const char *keywords[] = {"name", "help", "variable", "namespace", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "ss|sO", (char **) keywords, &name, &help, &variable, &py_namespace)) { - PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; - } - - if (variable == NULL) { - variable = name; - } - if (py_namespace == NULL) { - py_namespace = (PyObject *) self; + const char *name, *help, *variable = NULL; + PyObject *py_namespace = NULL; + const char *keywords[] = { "name", "help", "variable", "namespace", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "ss|sO", (char **) keywords, &name, &help, &variable, &py_namespace)) { + PyObject *exc_type, *traceback; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; } - ns3::Ptr setter = ns3::Create (py_namespace, variable); - self->obj->AddValue (name, help, ns3::MakeCallback (&CommandLinePythonValueSetter::Parse, setter)); + if (variable == NULL) { + variable = name; + } + if (py_namespace == NULL) { + py_namespace = (PyObject *) self; + } - Py_INCREF(Py_None); - return Py_None; + ns3::Ptr setter = ns3::Create (py_namespace, variable); + self->obj->AddValue (name, help, ns3::MakeCallback (&CommandLinePythonValueSetter::Parse, setter)); + + Py_INCREF(Py_None); + return Py_None; } @@ -287,53 +287,53 @@ PyObject * _wrap_Simulator_Run(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception) { - const char *keywords[] = {"signal_check_frequency", NULL}; - int signal_check_frequency; + const char *keywords[] = { "signal_check_frequency", NULL}; + int signal_check_frequency; - ns3::Ptr defaultSim = - ns3::DynamicCast (ns3::Simulator::GetImplementation ()); - if (defaultSim) { - signal_check_frequency = 100; + ns3::Ptr defaultSim = + ns3::DynamicCast (ns3::Simulator::GetImplementation ()); + if (defaultSim) { + signal_check_frequency = 100; } else { - signal_check_frequency = -1; - } - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) { - PyObject *exc_type, *traceback; - PyErr_Fetch(&exc_type, return_exception, &traceback); - Py_XDECREF(exc_type); - Py_XDECREF(traceback); - return NULL; + signal_check_frequency = -1; } - PyThreadState *py_thread_state = NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|i", (char **) keywords, &signal_check_frequency)) { + PyObject *exc_type, *traceback; + PyErr_Fetch(&exc_type, return_exception, &traceback); + Py_XDECREF(exc_type); + Py_XDECREF(traceback); + return NULL; + } - if (signal_check_frequency == -1) + PyThreadState *py_thread_state = NULL; + + if (signal_check_frequency == -1) { - if (PyEval_ThreadsInitialized ()) - py_thread_state = PyEval_SaveThread(); - ns3::Simulator::Run(); - if (py_thread_state) - PyEval_RestoreThread(py_thread_state); + if (PyEval_ThreadsInitialized ()) + py_thread_state = PyEval_SaveThread(); + ns3::Simulator::Run(); + if (py_thread_state) + PyEval_RestoreThread(py_thread_state); } else { - while (!ns3::Simulator::IsFinished()) - { - if (PyEval_ThreadsInitialized()) - py_thread_state = PyEval_SaveThread(); + while (!ns3::Simulator::IsFinished()) + { + if (PyEval_ThreadsInitialized()) + py_thread_state = PyEval_SaveThread(); - for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished(); --n) - { - ns3::Simulator::RunOneEvent(); + for (int n = signal_check_frequency; n > 0 && !ns3::Simulator::IsFinished(); --n) + { + ns3::Simulator::RunOneEvent(); } - - if (py_thread_state) - PyEval_RestoreThread(py_thread_state); - PyErr_CheckSignals(); - if (PyErr_Occurred()) - return NULL; + + if (py_thread_state) + PyEval_RestoreThread(py_thread_state); + PyErr_CheckSignals(); + if (PyErr_Occurred()) + return NULL; } } - Py_INCREF(Py_None); - return Py_None; + Py_INCREF(Py_None); + return Py_None; } diff --git a/src/core/bindings/scan-header.h b/src/core/bindings/scan-header.h index af0937136..f8295599c 100644 --- a/src/core/bindings/scan-header.h +++ b/src/core/bindings/scan-header.h @@ -7,26 +7,26 @@ using namespace ns3; namespace { - static inline Ptr - __dummy_function_to_force_template_instantiation (Ptr obj, TypeId typeId) - { - return obj->GetObject (typeId); - } - - - static inline void - __dummy_function_to_force_template_instantiation_v2 () - { - Time t1, t2, t3; - t1 = t2 + t3; - t1 = t2 - t3; - t1 < t2; - t1 <= t2; - t1 == t2; - t1 != t2; - t1 >= t2; - t1 > t2; - } - +static inline Ptr +__dummy_function_to_force_template_instantiation (Ptr obj, TypeId typeId) +{ + return obj->GetObject (typeId); +} + + +static inline void +__dummy_function_to_force_template_instantiation_v2 () +{ + Time t1, t2, t3; + t1 = t2 + t3; + t1 = t2 - t3; + t1 < t2; + t1 <= t2; + t1 == t2; + t1 != t2; + t1 >= t2; + t1 > t2; +} + } diff --git a/src/core/examples/main-callback.cc b/src/core/examples/main-callback.cc index 8e9dd8966..3c1edfb05 100644 --- a/src/core/examples/main-callback.cc +++ b/src/core/examples/main-callback.cc @@ -15,8 +15,8 @@ CbOne (double a, double b) class MyCb { public: int CbTwo (double a) { - std::cout << "invoke cbTwo a=" << a << std::endl; - return -5; + std::cout << "invoke cbTwo a=" << a << std::endl; + return -5; } }; @@ -45,7 +45,7 @@ int main (int argc, char *argv[]) NS_ASSERT (!two.IsNull ()); // invoke MyCb::cbTwo through callback instance int retTwo; - retTwo = two (10.0); + retTwo = two (10.0); two = MakeNullCallback (); // invoking a null callback is just like diff --git a/src/core/examples/main-test-sync.cc b/src/core/examples/main-test-sync.cc index b1e8fcc07..dac2c8418 100644 --- a/src/core/examples/main-test-sync.cc +++ b/src/core/examples/main-test-sync.cc @@ -24,7 +24,7 @@ inserted_function (void) { NS_ASSERT (gFirstRun); NS_LOG_UNCOND ("inserted_function() called at " << - Simulator::Now ().GetSeconds () << " s"); + Simulator::Now ().GetSeconds () << " s"); } void @@ -32,14 +32,14 @@ background_function (void) { NS_ASSERT (gFirstRun); NS_LOG_UNCOND ("background_function() called at " << - Simulator::Now ().GetSeconds () << " s"); + Simulator::Now ().GetSeconds () << " s"); } void first_function (void) { NS_LOG_UNCOND ("first_function() called at " << - Simulator::Now ().GetSeconds () << " s"); + Simulator::Now ().GetSeconds () << " s"); gFirstRun = true; } @@ -90,7 +90,7 @@ void test (void) { GlobalValue::Bind ("SimulatorImplementationType", - StringValue ("ns3::RealtimeSimulatorImpl")); + StringValue ("ns3::RealtimeSimulatorImpl")); FakeNetDevice fnd; @@ -108,11 +108,11 @@ test (void) } Ptr st3 = Create ( - MakeCallback (&FakeNetDevice::Doit3, &fnd)); + MakeCallback (&FakeNetDevice::Doit3, &fnd)); st3->Start (); Ptr st4 = Create ( - MakeCallback (&FakeNetDevice::Doit4, &fnd)); + MakeCallback (&FakeNetDevice::Doit4, &fnd)); st4->Start (); Simulator::Stop (Seconds (15.0)); diff --git a/src/core/examples/sample-random-variable.cc b/src/core/examples/sample-random-variable.cc index f388e5dfd..a213e0e5a 100644 --- a/src/core/examples/sample-random-variable.cc +++ b/src/core/examples/sample-random-variable.cc @@ -31,7 +31,7 @@ using namespace std; * pseudo-random number generator, this program should always output the * same number. Likewise, ns-3 simulations using random variables will * behave deterministically unless the user changes the RunNumber or the - * Seed. + * Seed. * * There are three primary mechanisms to change the seed or run numbers * from their default integer value of 1 @@ -59,5 +59,5 @@ int main (int argc, char *argv[]) UniformVariable uv; cout << uv.GetValue () << endl; - + } diff --git a/src/core/examples/sample-simulator.cc b/src/core/examples/sample-simulator.cc index c46755679..ed2e3fd93 100644 --- a/src/core/examples/sample-simulator.cc +++ b/src/core/examples/sample-simulator.cc @@ -84,7 +84,7 @@ int main (int argc, char *argv[]) EventId id = Simulator::Schedule (Seconds (30.0), &CancelledEvent); Simulator::Cancel (id); - + Simulator::Run (); Simulator::Destroy (); diff --git a/src/core/model/abort.h b/src/core/model/abort.h index ab1d9acbd..7061ef971 100644 --- a/src/core/model/abort.h +++ b/src/core/model/abort.h @@ -42,9 +42,9 @@ */ #define NS_ABORT_MSG(msg) \ do { \ - std::cerr << "aborted. "; \ - NS_FATAL_ERROR (msg); \ - } while (false) + std::cerr << "aborted. "; \ + NS_FATAL_ERROR (msg); \ + } while (false) /** @@ -68,12 +68,12 @@ */ #define NS_ABORT_IF(cond) \ do { \ - if (cond) \ - { \ - std::cerr << "aborted. cond=\"" << #cond << ", "; \ - NS_FATAL_ERROR_NO_MSG (); \ - } \ - } while (false) + if (cond) \ + { \ + std::cerr << "aborted. cond=\"" << # cond << ", "; \ + NS_FATAL_ERROR_NO_MSG (); \ + } \ + } while (false) /** * \ingroup debugging @@ -97,12 +97,12 @@ */ #define NS_ABORT_MSG_IF(cond, msg) \ do { \ - if (cond) \ - { \ - std::cerr << "aborted. cond=\"" << #cond << "\", "; \ - NS_FATAL_ERROR (msg); \ - } \ - } while (false) + if (cond) \ + { \ + std::cerr << "aborted. cond=\"" << # cond << "\", "; \ + NS_FATAL_ERROR (msg); \ + } \ + } while (false) /** * \ingroup debugging @@ -114,7 +114,7 @@ * * \see NS_ABORT_IF */ -#define NS_ABORT_UNLESS(cond) \ +#define NS_ABORT_UNLESS(cond) \ NS_ABORT_IF(!(cond)) /** @@ -128,7 +128,7 @@ * * \see NS_ABORT_MSG_IF */ -#define NS_ABORT_MSG_UNLESS(cond, msg) \ +#define NS_ABORT_MSG_UNLESS(cond, msg) \ NS_ABORT_MSG_IF(!(cond),msg) #endif /* NS3_ABORT_H */ diff --git a/src/core/model/assert.h b/src/core/model/assert.h index d1252808a..55316a8f8 100644 --- a/src/core/model/assert.h +++ b/src/core/model/assert.h @@ -67,7 +67,7 @@ if (!(condition)) \ { \ std::cerr << "assert failed. cond=\"" << \ - #condition << "\", "; \ + # condition << "\", "; \ NS_FATAL_ERROR_NO_MSG(); \ } \ } \ @@ -89,7 +89,7 @@ if (!(condition)) \ { \ std::cerr << "assert failed. cond=\"" << \ - #condition << "\", "; \ + # condition << "\", "; \ NS_FATAL_ERROR (message); \ } \ } \ diff --git a/src/core/model/attribute-accessor-helper.h b/src/core/model/attribute-accessor-helper.h index cee4bae86..2f0d75b1c 100644 --- a/src/core/model/attribute-accessor-helper.h +++ b/src/core/model/attribute-accessor-helper.h @@ -64,12 +64,12 @@ public: const U *value = dynamic_cast (&val); if (value == 0) { - return false; + return false; } T *obj = dynamic_cast (object); if (obj == 0) { - return false; + return false; } return DoSet (obj, value); } @@ -78,12 +78,12 @@ public: U *value = dynamic_cast (&val); if (value == 0) { - return false; + return false; } const T *obj = dynamic_cast (object); if (obj == 0) { - return false; + return false; } return DoGet (obj, value); } @@ -98,200 +98,200 @@ Ptr DoMakeAccessorHelperOne (U T::*memberVariable) { class MemberVariable : public AccessorHelper - { - public: - MemberVariable (U T::*memberVariable) - : AccessorHelper (), - m_memberVariable (memberVariable) - {} - private: - virtual bool DoSet (T *object, const V *v) const { - typename AccessorTrait::Result tmp; - bool ok = v->GetAccessor (tmp); - if (!ok) - { - return false; - } - (object->*m_memberVariable) = tmp; - return true; - } - virtual bool DoGet (const T *object, V *v) const { - v->Set (object->*m_memberVariable); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return true; - } - - U T::*m_memberVariable; - }; + { +public: + MemberVariable (U T::*memberVariable) + : AccessorHelper (), + m_memberVariable (memberVariable) + {} +private: + virtual bool DoSet (T *object, const V *v) const { + typename AccessorTrait::Result tmp; + bool ok = v->GetAccessor (tmp); + if (!ok) + { + return false; + } + (object->*m_memberVariable) = tmp; + return true; + } + virtual bool DoGet (const T *object, V *v) const { + v->Set (object->*m_memberVariable); + return true; + } + virtual bool HasGetter (void) const { + return true; + } + virtual bool HasSetter (void) const { + return true; + } + + U T::*m_memberVariable; + }; return Ptr (new MemberVariable (memberVariable), false); } template Ptr -DoMakeAccessorHelperOne (U (T::*getter) (void) const) +DoMakeAccessorHelperOne (U (T::*getter)(void) const) { class MemberMethod : public AccessorHelper - { - public: - MemberMethod (U (T::*getter) (void) const) - : 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 ((object->*m_getter) ()); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return false; - } - U (T::*m_getter) (void) const; - }; + { +public: + MemberMethod (U (T::*getter)(void) const) + : 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 ((object->*m_getter)()); + return true; + } + virtual bool HasGetter (void) const { + return true; + } + virtual bool HasSetter (void) const { + return false; + } + U (T::*m_getter)(void) const; + }; return Ptr (new MemberMethod (getter), false); } template Ptr -DoMakeAccessorHelperOne (void (T::*setter) (U)) +DoMakeAccessorHelperOne (void (T::*setter)(U)) { class MemberMethod : public AccessorHelper - { - public: - MemberMethod (void (T::*setter) (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; - } - (object->*m_setter) (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 (T::*m_setter) (U); - }; + { +public: + MemberMethod (void (T::*setter)(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; + } + (object->*m_setter)(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 (T::*m_setter)(U); + }; return Ptr (new MemberMethod (setter), false); } template Ptr -DoMakeAccessorHelperTwo (void (T::*setter) (U), - V (T::*getter) (void) const) +DoMakeAccessorHelperTwo (void (T::*setter)(U), + V (T::*getter)(void) const) { class MemberMethod : public AccessorHelper - { - public: - MemberMethod (void (T::*setter) (U), - V (T::*getter) (void) const) - : 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; - } - (object->*m_setter) (tmp); - return true; - } - virtual bool DoGet (const T *object, W *v) const { - v->Set ((object->*m_getter) ()); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return true; - } - void (T::*m_setter) (U); - V (T::*m_getter) (void) const; - }; + { +public: + MemberMethod (void (T::*setter)(U), + V (T::*getter)(void) const) + : 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; + } + (object->*m_setter)(tmp); + return true; + } + virtual bool DoGet (const T *object, W *v) const { + v->Set ((object->*m_getter)()); + return true; + } + virtual bool HasGetter (void) const { + return true; + } + virtual bool HasSetter (void) const { + return true; + } + void (T::*m_setter)(U); + V (T::*m_getter)(void) const; + }; return Ptr (new MemberMethod (setter, getter), false); } template Ptr -DoMakeAccessorHelperTwo (V (T::*getter) (void) const, - void (T::*setter) (U)) +DoMakeAccessorHelperTwo (V (T::*getter)(void) const, + void (T::*setter)(U)) { return DoMakeAccessorHelperTwo (setter, getter); } template Ptr -DoMakeAccessorHelperTwo (bool (T::*setter) (U), - V (T::*getter) (void) const) +DoMakeAccessorHelperTwo (bool (T::*setter)(U), + V (T::*getter)(void) const) { class MemberMethod : public AccessorHelper - { - public: - MemberMethod (bool (T::*setter) (U), - V (T::*getter) (void) const) - : 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 = (object->*m_setter) (tmp); - return ok; - } - virtual bool DoGet (const T *object, W *v) const { - v->Set ((object->*m_getter) ()); - return true; - } - virtual bool HasGetter (void) const { - return true; - } - virtual bool HasSetter (void) const { - return true; - } - bool (T::*m_setter) (U); - V (T::*m_getter) (void) const; - }; + { +public: + MemberMethod (bool (T::*setter)(U), + V (T::*getter)(void) const) + : 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 = (object->*m_setter)(tmp); + return ok; + } + virtual bool DoGet (const T *object, W *v) const { + v->Set ((object->*m_getter)()); + return true; + } + virtual bool HasGetter (void) const { + return true; + } + virtual bool HasSetter (void) const { + return true; + } + bool (T::*m_setter)(U); + V (T::*m_getter)(void) const; + }; return Ptr (new MemberMethod (setter, getter), false); } template Ptr -DoMakeAccessorHelperTwo (bool (T::*getter) (void) const, - void (T::*setter) (U)) +DoMakeAccessorHelperTwo (bool (T::*getter)(void) const, + void (T::*setter)(U)) { return DoMakeAccessorHelperTwo (setter, getter); } diff --git a/src/core/model/attribute-helper.h b/src/core/model/attribute-helper.h index 8c3def036..1309f43b6 100644 --- a/src/core/model/attribute-helper.h +++ b/src/core/model/attribute-helper.h @@ -97,26 +97,26 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * use the template functions defined here. This macro is implemented * through the helper templates functions ns3::MakeAccessorHelper<>. */ -#define ATTRIBUTE_ACCESSOR_DEFINE(type) \ - template \ - Ptr Make##type##Accessor (T1 a1) \ - { \ - return MakeAccessorHelper (a1); \ - } \ - template \ - Ptr Make##type##Accessor (T1 a1, T2 a2) \ - { \ - return MakeAccessorHelper (a1, a2); \ +#define ATTRIBUTE_ACCESSOR_DEFINE(type) \ + template \ + Ptr Make ## type ## Accessor (T1 a1) \ + { \ + return MakeAccessorHelper (a1); \ + } \ + template \ + Ptr Make ## type ## Accessor (T1 a1, T2 a2) \ + { \ + return MakeAccessorHelper (a1, a2); \ } #define ATTRIBUTE_VALUE_DEFINE_WITH_NAME(type,name) \ - class name##Value : public AttributeValue \ - { \ - public: \ - name##Value (); \ - name##Value (const type &value); \ - void Set (const type &value); \ - type Get (void) const; \ + class name ## Value : public AttributeValue \ + { \ +public: \ + name ## Value (); \ + name ## Value (const type &value); \ + void Set (const type &value); \ + type Get (void) const; \ template \ bool GetAccessor (T &value) const { \ value = T (m_value); \ @@ -125,8 +125,8 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) virtual Ptr Copy (void) const; \ virtual std::string SerializeToString (Ptr checker) const; \ virtual bool DeserializeFromString (std::string value, Ptr checker); \ - private: \ - type m_value; \ +private: \ + type m_value; \ }; @@ -137,7 +137,7 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * This macro defines the class XXXValue associated to class XXX. * This macro is typically invoked in a class header. */ -#define ATTRIBUTE_VALUE_DEFINE(type) \ +#define ATTRIBUTE_VALUE_DEFINE(type) \ ATTRIBUTE_VALUE_DEFINE_WITH_NAME (type,type) @@ -159,38 +159,38 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * MakeXXXChecker function. * Typically invoked from xxx.h. */ -#define ATTRIBUTE_CHECKER_DEFINE(type) \ - class type##Checker : public AttributeChecker {}; \ - Ptr Make##type##Checker (void); \ +#define ATTRIBUTE_CHECKER_DEFINE(type) \ + class type ## Checker : public AttributeChecker {}; \ + Ptr Make ## type ## Checker (void); \ #define ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,name) \ - name##Value::name##Value () \ - : m_value () {} \ - name##Value::name##Value (const type &value) \ - : m_value (value) {} \ - void name##Value::Set (const type &v) { \ - m_value = v; \ - } \ - type name##Value::Get (void) const { \ - return m_value; \ - } \ - Ptr \ - name##Value::Copy (void) const { \ - return ns3::Create (*this); \ + name ## Value::name ## Value () \ + : m_value () {} \ + name ## Value::name ## Value (const type &value) \ + : m_value (value) {} \ + void name ## Value::Set (const type &v) { \ + m_value = v; \ } \ - std::string \ - name##Value::SerializeToString (Ptr checker) const { \ - std::ostringstream oss; \ - oss << m_value; \ - return oss.str (); \ - } \ - bool \ - name##Value::DeserializeFromString (std::string value, Ptr checker) { \ - std::istringstream iss; \ - iss.str (value); \ - iss >> m_value; \ - return !iss.bad () && !iss.fail (); \ + type name ## Value::Get (void) const { \ + return m_value; \ + } \ + Ptr \ + name ## Value::Copy (void) const { \ + return ns3::Create (*this); \ + } \ + std::string \ + name ## Value::SerializeToString (Ptr checker) const { \ + std::ostringstream oss; \ + oss << m_value; \ + return oss.str (); \ + } \ + bool \ + name ## Value::DeserializeFromString (std::string value, Ptr checker) { \ + std::istringstream iss; \ + iss.str (value); \ + iss >> m_value; \ + return !iss.bad () && !iss.fail (); \ } /** @@ -202,7 +202,7 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * methods). * Typically invoked from xxx.cc. */ -#define ATTRIBUTE_VALUE_IMPLEMENT(type) \ +#define ATTRIBUTE_VALUE_IMPLEMENT(type) \ ATTRIBUTE_VALUE_IMPLEMENT_WITH_NAME(type,type) @@ -213,17 +213,17 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * This macro implements the MakeXXXChecker function. * Typically invoked from xxx.cc. */ -#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \ - Ptr Make##type##Checker (void) \ - { \ - return MakeSimpleAttributeChecker (#type "Value", #type); \ - } \ +#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \ + Ptr Make ## type ## Checker (void) \ + { \ + return MakeSimpleAttributeChecker (# type "Value", # type); \ + } \ #define ATTRIBUTE_CHECKER_IMPLEMENT_WITH_NAME(type,name) \ - Ptr Make##type##Checker (void) \ - { \ - return MakeSimpleAttributeChecker (#type "Value", name); \ - } \ + Ptr Make ## type ## Checker (void) \ + { \ + return MakeSimpleAttributeChecker (# type "Value", name); \ + } \ /** * \ingroup AttributeHelper @@ -232,9 +232,9 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * This macro should be invoked outside of the class * declaration in its public header. */ -#define ATTRIBUTE_HELPER_HEADER(type) \ - ATTRIBUTE_VALUE_DEFINE (type); \ - ATTRIBUTE_ACCESSOR_DEFINE (type); \ +#define ATTRIBUTE_HELPER_HEADER(type) \ + ATTRIBUTE_VALUE_DEFINE (type); \ + ATTRIBUTE_ACCESSOR_DEFINE (type); \ ATTRIBUTE_CHECKER_DEFINE (type); /** @@ -244,7 +244,7 @@ MakeSimpleAttributeChecker (std::string name, std::string underlying) * This macro should be invoked from the class implementation file. */ #define ATTRIBUTE_HELPER_CPP(type) \ - ATTRIBUTE_CHECKER_IMPLEMENT (type); \ + ATTRIBUTE_CHECKER_IMPLEMENT (type); \ ATTRIBUTE_VALUE_IMPLEMENT (type); diff --git a/src/core/model/attribute-list.cc b/src/core/model/attribute-list.cc index b9db658a1..251ccdba8 100644 --- a/src/core/model/attribute-list.cc +++ b/src/core/model/attribute-list.cc @@ -28,7 +28,8 @@ namespace ns3 { *********************************************************************/ AttributeList::AttributeList () -{} +{ +} AttributeList::AttributeList (const AttributeList &o) { @@ -198,7 +199,7 @@ AttributeList::SerializeToString (void) const { oss << "|"; } - } + } return oss.str (); } bool @@ -258,7 +259,8 @@ AttributeList::DeserializeFromString (std::string str) } UnsafeAttributeList::UnsafeAttributeList () -{} +{ +} UnsafeAttributeList::UnsafeAttributeList (const UnsafeAttributeList &o) { for (uint32_t i = 0; i < o.m_attributes.size (); ++i) diff --git a/src/core/model/attribute-list.h b/src/core/model/attribute-list.h index a346a57be..00ee0b3e0 100644 --- a/src/core/model/attribute-list.h +++ b/src/core/model/attribute-list.h @@ -115,7 +115,7 @@ public: UnsafeAttributeList (const UnsafeAttributeList &o); UnsafeAttributeList &operator = (const UnsafeAttributeList &o); ~UnsafeAttributeList (); - + void Set (std::string name, const AttributeValue ¶m); AttributeList GetSafe (std::string name) const; diff --git a/src/core/model/attribute.cc b/src/core/model/attribute.cc index ac0590c95..f5626fee8 100644 --- a/src/core/model/attribute.cc +++ b/src/core/model/attribute.cc @@ -27,34 +27,41 @@ NS_LOG_COMPONENT_DEFINE ("AttributeValue"); namespace ns3 { AttributeValue::AttributeValue () -{} +{ +} AttributeValue::~AttributeValue () -{} +{ +} AttributeAccessor::AttributeAccessor () -{} +{ +} AttributeAccessor::~AttributeAccessor () -{} +{ +} AttributeChecker::AttributeChecker () -{} +{ +} AttributeChecker::~AttributeChecker () -{} +{ +} EmptyAttributeValue::EmptyAttributeValue () -{} -Ptr +{ +} +Ptr EmptyAttributeValue::Copy (void) const { return Create (); } -std::string +std::string EmptyAttributeValue::SerializeToString (Ptr checker) const { return ""; } -bool +bool EmptyAttributeValue::DeserializeFromString (std::string value, Ptr checker) { return true; diff --git a/src/core/model/boolean.cc b/src/core/model/boolean.cc index 1f2a8848f..c603a8dba 100644 --- a/src/core/model/boolean.cc +++ b/src/core/model/boolean.cc @@ -24,16 +24,18 @@ namespace ns3 { BooleanValue::BooleanValue () : m_value (false) -{} +{ +} BooleanValue::BooleanValue (bool value) : m_value (value) -{} -void +{ +} +void BooleanValue::Set (bool value) { m_value = value; } -bool +bool BooleanValue::Get (void) const { return m_value; @@ -93,7 +95,7 @@ BooleanValue::DeserializeFromString (std::string value, Ptr bool GetAccessor (T &v) const; - + operator bool () const; virtual Ptr Copy (void) const; diff --git a/src/core/model/breakpoint.cc b/src/core/model/breakpoint.cc index 521628cab..511526710 100644 --- a/src/core/model/breakpoint.cc +++ b/src/core/model/breakpoint.cc @@ -54,4 +54,4 @@ BreakpointFallback (void) #endif // HAVE_SIGNAL_H -}//namespace ns3 +} //namespace ns3 diff --git a/src/core/model/breakpoint.h b/src/core/model/breakpoint.h index 32b343d98..8354a9040 100644 --- a/src/core/model/breakpoint.h +++ b/src/core/model/breakpoint.h @@ -45,14 +45,14 @@ namespace ns3 { */ #if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2 # define NS_BREAKPOINT() \ - do{ __asm__ __volatile__ ("int $03"); }while(false) + do { __asm__ __volatile__ ("int $03"); }while(false) #elif defined (_MSC_VER) && defined (_M_IX86) # define NS_BREAKPOINT() \ - do{ __asm int 3h }while(false) + do { __asm int 3h }while(false) #elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2 # define NS_BREAKPOINT() \ - do{ __asm__ __volatile__ ("bpt"); }while(false) -#else /* !__i386__ && !__alpha__ */ + do { __asm__ __volatile__ ("bpt"); }while(false) +#else /* !__i386__ && !__alpha__ */ # define NS_BREAKPOINT() ns3::BreakpointFallback () #endif @@ -69,7 +69,7 @@ namespace ns3 { void BreakpointFallback (void); -}//namespace ns3 +} //namespace ns3 #endif /* BREAKPOINT_H */ diff --git a/src/core/model/cairo-wideint-private.h b/src/core/model/cairo-wideint-private.h index 5b407ef14..ccb8e85de 100644 --- a/src/core/model/cairo-wideint-private.h +++ b/src/core/model/cairo-wideint-private.h @@ -52,25 +52,25 @@ #elif HAVE_SYS_INT_TYPES_H # include #elif defined(_MSC_VER) - typedef __int8 int8_t; - typedef unsigned __int8 uint8_t; - typedef __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; +typedef __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; # ifndef HAVE_UINT64_T # define HAVE_UINT64_T 1 # endif # ifndef INT16_MIN -# define INT16_MIN (-32767-1) +# define INT16_MIN (-32767-1) # endif # ifndef INT16_MAX -# define INT16_MAX (32767) +# define INT16_MAX (32767) # endif # ifndef UINT16_MAX -# define UINT16_MAX (65535) +# define UINT16_MAX (65535) # endif #else #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) @@ -91,94 +91,94 @@ extern "C" { #if !HAVE_UINT64_T typedef struct _cairo_uint64 { - uint32_t lo, hi; + uint32_t lo, hi; } cairo_uint64_t, cairo_int64_t; -cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i); -#define _cairo_uint64_to_uint32(a) ((a).lo) -cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_sub (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); -cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); -cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); -cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); -int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); -int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); -#define _cairo_uint64_negative(a) (((int32_t) ((a).hi)) < 0) -cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); +cairo_uint64_t I _cairo_uint32_to_uint64 (uint32_t i); +#define _cairo_uint64_to_uint32(a) ((a).lo) +cairo_uint64_t I _cairo_uint64_add (cairo_uint64_t a, cairo_uint64_t b); +cairo_uint64_t I _cairo_uint64_sub (cairo_uint64_t a, cairo_uint64_t b); +cairo_uint64_t I _cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b); +cairo_uint64_t I _cairo_uint32x32_64_mul (uint32_t a, uint32_t b); +cairo_uint64_t I _cairo_uint64_lsl (cairo_uint64_t a, int shift); +cairo_uint64_t I _cairo_uint64_rsl (cairo_uint64_t a, int shift); +cairo_uint64_t I _cairo_uint64_rsa (cairo_uint64_t a, int shift); +int I _cairo_uint64_lt (cairo_uint64_t a, cairo_uint64_t b); +int I _cairo_uint64_eq (cairo_uint64_t a, cairo_uint64_t b); +cairo_uint64_t I _cairo_uint64_negate (cairo_uint64_t a); +#define _cairo_uint64_negative(a) (((int32_t)((a).hi)) < 0) +cairo_uint64_t I _cairo_uint64_not (cairo_uint64_t a); -#define _cairo_uint64_to_int64(i) (i) -#define _cairo_int64_to_uint64(i) (i) +#define _cairo_uint64_to_int64(i) (i) +#define _cairo_int64_to_uint64(i) (i) -cairo_int64_t I _cairo_int32_to_int64(int32_t i); -#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) -#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) -#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) -#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) -cairo_int64_t I _cairo_int32x32_64_mul (int32_t a, int32_t b); -int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); -#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) -#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) -#define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) -#define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b) -#define _cairo_int64_negate(a) _cairo_uint64_negate(a) -#define _cairo_int64_negative(a) (((int32_t) ((a).hi)) < 0) -#define _cairo_int64_not(a) _cairo_uint64_not(a) +cairo_int64_t I _cairo_int32_to_int64(int32_t i); +#define _cairo_int64_to_int32(a) ((int32_t) _cairo_uint64_to_uint32(a)) +#define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) +#define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) +#define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) +cairo_int64_t I _cairo_int32x32_64_mul (int32_t a, int32_t b); +int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); +#define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) +#define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) +#define _cairo_int64_rsl(a,b) _cairo_uint64_rsl (a,b) +#define _cairo_int64_rsa(a,b) _cairo_uint64_rsa (a,b) +#define _cairo_int64_negate(a) _cairo_uint64_negate(a) +#define _cairo_int64_negative(a) (((int32_t)((a).hi)) < 0) +#define _cairo_int64_not(a) _cairo_uint64_not(a) #else typedef uint64_t cairo_uint64_t; -typedef int64_t cairo_int64_t; +typedef int64_t cairo_int64_t; -#define _cairo_uint32_to_uint64(i) ((uint64_t) (i)) -#define _cairo_uint64_to_uint32(i) ((uint32_t) (i)) -#define _cairo_uint64_add(a,b) ((a) + (b)) -#define _cairo_uint64_sub(a,b) ((a) - (b)) -#define _cairo_uint64_mul(a,b) ((a) * (b)) -#define _cairo_uint32x32_64_mul(a,b) ((uint64_t) (a) * (b)) -#define _cairo_uint64_lsl(a,b) ((a) << (b)) -#define _cairo_uint64_rsl(a,b) ((uint64_t) (a) >> (b)) -#define _cairo_uint64_rsa(a,b) ((uint64_t) ((int64_t) (a) >> (b))) -#define _cairo_uint64_lt(a,b) ((a) < (b)) -#define _cairo_uint64_eq(a,b) ((a) == (b)) -#define _cairo_uint64_negate(a) ((uint64_t) -((int64_t) (a))) -#define _cairo_uint64_negative(a) ((int64_t) (a) < 0) -#define _cairo_uint64_not(a) (~(a)) +#define _cairo_uint32_to_uint64(i) ((uint64_t)(i)) +#define _cairo_uint64_to_uint32(i) ((uint32_t)(i)) +#define _cairo_uint64_add(a,b) ((a) + (b)) +#define _cairo_uint64_sub(a,b) ((a) - (b)) +#define _cairo_uint64_mul(a,b) ((a) * (b)) +#define _cairo_uint32x32_64_mul(a,b) ((uint64_t)(a) * (b)) +#define _cairo_uint64_lsl(a,b) ((a) << (b)) +#define _cairo_uint64_rsl(a,b) ((uint64_t)(a) >> (b)) +#define _cairo_uint64_rsa(a,b) ((uint64_t)((int64_t)(a) >> (b))) +#define _cairo_uint64_lt(a,b) ((a) < (b)) +#define _cairo_uint64_eq(a,b) ((a) == (b)) +#define _cairo_uint64_negate(a) ((uint64_t) -((int64_t)(a))) +#define _cairo_uint64_negative(a) ((int64_t)(a) < 0) +#define _cairo_uint64_not(a) (~(a)) -#define _cairo_uint64_to_int64(i) ((int64_t) (i)) -#define _cairo_int64_to_uint64(i) ((uint64_t) (i)) +#define _cairo_uint64_to_int64(i) ((int64_t)(i)) +#define _cairo_int64_to_uint64(i) ((uint64_t)(i)) -#define _cairo_int32_to_int64(i) ((int64_t) (i)) -#define _cairo_int64_to_int32(i) ((int32_t) (i)) -#define _cairo_int64_add(a,b) ((a) + (b)) -#define _cairo_int64_sub(a,b) ((a) - (b)) -#define _cairo_int64_mul(a,b) ((a) * (b)) -#define _cairo_int32x32_64_mul(a,b) ((int64_t) (a) * (b)) -#define _cairo_int64_lt(a,b) ((a) < (b)) -#define _cairo_int64_eq(a,b) ((a) == (b)) -#define _cairo_int64_lsl(a,b) ((a) << (b)) -#define _cairo_int64_rsl(a,b) ((int64_t) ((uint64_t) (a) >> (b))) -#define _cairo_int64_rsa(a,b) ((int64_t) (a) >> (b)) -#define _cairo_int64_negate(a) (-(a)) -#define _cairo_int64_negative(a) ((a) < 0) -#define _cairo_int64_not(a) (~(a)) +#define _cairo_int32_to_int64(i) ((int64_t)(i)) +#define _cairo_int64_to_int32(i) ((int32_t)(i)) +#define _cairo_int64_add(a,b) ((a) + (b)) +#define _cairo_int64_sub(a,b) ((a) - (b)) +#define _cairo_int64_mul(a,b) ((a) * (b)) +#define _cairo_int32x32_64_mul(a,b) ((int64_t)(a) * (b)) +#define _cairo_int64_lt(a,b) ((a) < (b)) +#define _cairo_int64_eq(a,b) ((a) == (b)) +#define _cairo_int64_lsl(a,b) ((a) << (b)) +#define _cairo_int64_rsl(a,b) ((int64_t)((uint64_t)(a) >> (b))) +#define _cairo_int64_rsa(a,b) ((int64_t)(a) >> (b)) +#define _cairo_int64_negate(a) (-(a)) +#define _cairo_int64_negative(a) ((a) < 0) +#define _cairo_int64_not(a) (~(a)) #endif /* * 64-bit comparisions derived from lt or eq */ -#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt(a,b)) -#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq(a,b)) -#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt(a,b)) -#define _cairo_uint64_gt(a,b) _cairo_uint64_lt(b,a) +#define _cairo_uint64_le(a,b) (!_cairo_uint64_gt(a,b)) +#define _cairo_uint64_ne(a,b) (!_cairo_uint64_eq(a,b)) +#define _cairo_uint64_ge(a,b) (!_cairo_uint64_lt(a,b)) +#define _cairo_uint64_gt(a,b) _cairo_uint64_lt(b,a) -#define _cairo_int64_le(a,b) (!_cairo_int64_gt(a,b)) -#define _cairo_int64_ne(a,b) (!_cairo_int64_eq(a,b)) -#define _cairo_int64_ge(a,b) (!_cairo_int64_lt(a,b)) -#define _cairo_int64_gt(a,b) _cairo_int64_lt(b,a) +#define _cairo_int64_le(a,b) (!_cairo_int64_gt(a,b)) +#define _cairo_int64_ne(a,b) (!_cairo_int64_eq(a,b)) +#define _cairo_int64_ge(a,b) (!_cairo_int64_lt(a,b)) +#define _cairo_int64_gt(a,b) _cairo_int64_lt(b,a) /* * As the C implementation always computes both, create @@ -186,13 +186,13 @@ typedef int64_t cairo_int64_t; */ typedef struct _cairo_uquorem64 { - cairo_uint64_t quo; - cairo_uint64_t rem; + cairo_uint64_t quo; + cairo_uint64_t rem; } cairo_uquorem64_t; typedef struct _cairo_quorem64 { - cairo_int64_t quo; - cairo_int64_t rem; + cairo_int64_t quo; + cairo_int64_t rem; } cairo_quorem64_t; cairo_uquorem64_t I @@ -210,98 +210,98 @@ _cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den); #if !HAVE_UINT128_T typedef struct cairo_uint128 { - cairo_uint64_t lo, hi; + cairo_uint64_t lo, hi; } cairo_uint128_t, cairo_int128_t; -cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i); -cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i); -#define _cairo_uint128_to_uint64(a) ((a).lo) -#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32(_cairo_uint128_to_uint64(a)) -cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b); -cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); -cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); -cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); -int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); -int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); -cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); -#define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) -cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); +cairo_uint128_t I _cairo_uint32_to_uint128 (uint32_t i); +cairo_uint128_t I _cairo_uint64_to_uint128 (cairo_uint64_t i); +#define _cairo_uint128_to_uint64(a) ((a).lo) +#define _cairo_uint128_to_uint32(a) _cairo_uint64_to_uint32(_cairo_uint128_to_uint64(a)) +cairo_uint128_t I _cairo_uint128_add (cairo_uint128_t a, cairo_uint128_t b); +cairo_uint128_t I _cairo_uint128_sub (cairo_uint128_t a, cairo_uint128_t b); +cairo_uint128_t I _cairo_uint128_mul (cairo_uint128_t a, cairo_uint128_t b); +cairo_uint128_t I _cairo_uint64x64_128_mul (cairo_uint64_t a, cairo_uint64_t b); +cairo_uint128_t I _cairo_uint128_lsl (cairo_uint128_t a, int shift); +cairo_uint128_t I _cairo_uint128_rsl (cairo_uint128_t a, int shift); +cairo_uint128_t I _cairo_uint128_rsa (cairo_uint128_t a, int shift); +int I _cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b); +int I _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b); +cairo_uint128_t I _cairo_uint128_negate (cairo_uint128_t a); +#define _cairo_uint128_negative(a) (_cairo_uint64_negative(a.hi)) +cairo_uint128_t I _cairo_uint128_not (cairo_uint128_t a); -#define _cairo_uint128_to_int128(i) (i) -#define _cairo_int128_to_uint128(i) (i) +#define _cairo_uint128_to_int128(i) (i) +#define _cairo_int128_to_uint128(i) (i) -cairo_int128_t I _cairo_int32_to_int128 (int32_t i); -cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); -#define _cairo_int128_to_int64(a) ((cairo_int64_t) (a).lo) -#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) -#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) -#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) -#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) +cairo_int128_t I _cairo_int32_to_int128 (int32_t i); +cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); +#define _cairo_int128_to_int64(a) ((cairo_int64_t)(a).lo) +#define _cairo_int128_to_int32(a) _cairo_int64_to_int32(_cairo_int128_to_int64(a)) +#define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) +#define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) +#define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) cairo_int128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); -#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) -#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) -#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) -int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); -#define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) -#define _cairo_int128_negate(a) _cairo_uint128_negate(a) -#define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) -#define _cairo_int128_not(a) _cairo_uint128_not(a) +#define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) +#define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) +#define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) +int I _cairo_int128_lt (cairo_int128_t a, cairo_int128_t b); +#define _cairo_int128_eq(a,b) _cairo_uint128_eq (a,b) +#define _cairo_int128_negate(a) _cairo_uint128_negate(a) +#define _cairo_int128_negative(a) (_cairo_uint128_negative(a)) +#define _cairo_int128_not(a) _cairo_uint128_not(a) -#else /* !HAVE_UINT128_T */ +#else /* !HAVE_UINT128_T */ -typedef uint128_t cairo_uint128_t; -typedef int128_t cairo_int128_t; +typedef uint128_t cairo_uint128_t; +typedef int128_t cairo_int128_t; -#define _cairo_uint32_to_uint128(i) ((uint128_t) (i)) -#define _cairo_uint64_to_uint128(i) ((uint128_t) (i)) -#define _cairo_uint128_to_uint64(i) ((uint64_t) (i)) -#define _cairo_uint128_to_uint32(i) ((uint32_t) (i)) -#define _cairo_uint128_add(a,b) ((a) + (b)) -#define _cairo_uint128_sub(a,b) ((a) - (b)) -#define _cairo_uint128_mul(a,b) ((a) * (b)) -#define _cairo_uint64x64_128_mul(a,b) ((uint128_t) (a) * (b)) -#define _cairo_uint128_lsl(a,b) ((a) << (b)) -#define _cairo_uint128_rsl(a,b) ((uint128_t) (a) >> (b)) -#define _cairo_uint128_rsa(a,b) ((uint128_t) ((int128_t) (a) >> (b))) -#define _cairo_uint128_lt(a,b) ((a) < (b)) -#define _cairo_uint128_eq(a,b) ((a) == (b)) -#define _cairo_uint128_negate(a) ((uint128_t) -((int128_t) (a))) -#define _cairo_uint128_negative(a) ((int128_t) (a) < 0) -#define _cairo_uint128_not(a) (~(a)) +#define _cairo_uint32_to_uint128(i) ((uint128_t)(i)) +#define _cairo_uint64_to_uint128(i) ((uint128_t)(i)) +#define _cairo_uint128_to_uint64(i) ((uint64_t)(i)) +#define _cairo_uint128_to_uint32(i) ((uint32_t)(i)) +#define _cairo_uint128_add(a,b) ((a) + (b)) +#define _cairo_uint128_sub(a,b) ((a) - (b)) +#define _cairo_uint128_mul(a,b) ((a) * (b)) +#define _cairo_uint64x64_128_mul(a,b) ((uint128_t)(a) * (b)) +#define _cairo_uint128_lsl(a,b) ((a) << (b)) +#define _cairo_uint128_rsl(a,b) ((uint128_t)(a) >> (b)) +#define _cairo_uint128_rsa(a,b) ((uint128_t)((int128_t)(a) >> (b))) +#define _cairo_uint128_lt(a,b) ((a) < (b)) +#define _cairo_uint128_eq(a,b) ((a) == (b)) +#define _cairo_uint128_negate(a) ((uint128_t) -((int128_t)(a))) +#define _cairo_uint128_negative(a) ((int128_t)(a) < 0) +#define _cairo_uint128_not(a) (~(a)) -#define _cairo_uint128_to_int128(i) ((int128_t) (i)) -#define _cairo_int128_to_uint128(i) ((uint128_t) (i)) +#define _cairo_uint128_to_int128(i) ((int128_t)(i)) +#define _cairo_int128_to_uint128(i) ((uint128_t)(i)) -#define _cairo_int32_to_int128(i) ((int128_t) (i)) -#define _cairo_int64_to_int128(i) ((int128_t) (i)) -#define _cairo_int128_to_int64(i) ((int64_t) (i)) -#define _cairo_int128_to_int32(i) ((int32_t) (i)) -#define _cairo_int128_add(a,b) ((a) + (b)) -#define _cairo_int128_sub(a,b) ((a) - (b)) -#define _cairo_int128_mul(a,b) ((a) * (b)) -#define _cairo_int64x64_128_mul(a,b) ((int128_t) (a) * (b)) -#define _cairo_int128_lt(a,b) ((a) < (b)) -#define _cairo_int128_eq(a,b) ((a) == (b)) -#define _cairo_int128_lsl(a,b) ((a) << (b)) -#define _cairo_int128_rsl(a,b) ((int128_t) ((uint128_t) (a) >> (b))) -#define _cairo_int128_rsa(a,b) ((int128_t) (a) >> (b)) -#define _cairo_int128_negate(a) (-(a)) -#define _cairo_int128_negative(a) ((a) < 0) -#define _cairo_int128_not(a) (~(a)) +#define _cairo_int32_to_int128(i) ((int128_t)(i)) +#define _cairo_int64_to_int128(i) ((int128_t)(i)) +#define _cairo_int128_to_int64(i) ((int64_t)(i)) +#define _cairo_int128_to_int32(i) ((int32_t)(i)) +#define _cairo_int128_add(a,b) ((a) + (b)) +#define _cairo_int128_sub(a,b) ((a) - (b)) +#define _cairo_int128_mul(a,b) ((a) * (b)) +#define _cairo_int64x64_128_mul(a,b) ((int128_t)(a) * (b)) +#define _cairo_int128_lt(a,b) ((a) < (b)) +#define _cairo_int128_eq(a,b) ((a) == (b)) +#define _cairo_int128_lsl(a,b) ((a) << (b)) +#define _cairo_int128_rsl(a,b) ((int128_t)((uint128_t)(a) >> (b))) +#define _cairo_int128_rsa(a,b) ((int128_t)(a) >> (b)) +#define _cairo_int128_negate(a) (-(a)) +#define _cairo_int128_negative(a) ((a) < 0) +#define _cairo_int128_not(a) (~(a)) -#endif /* HAVE_UINT128_T */ +#endif /* HAVE_UINT128_T */ typedef struct _cairo_uquorem128 { - cairo_uint128_t quo; - cairo_uint128_t rem; + cairo_uint128_t quo; + cairo_uint128_t rem; } cairo_uquorem128_t; typedef struct _cairo_quorem128 { - cairo_int128_t quo; - cairo_int128_t rem; + cairo_int128_t quo; + cairo_int128_t rem; } cairo_quorem128_t; cairo_uquorem128_t I @@ -312,21 +312,21 @@ _cairo_int128_divrem (cairo_int128_t num, cairo_int128_t den); cairo_uquorem64_t I _cairo_uint_96by64_32x64_divrem (cairo_uint128_t num, - cairo_uint64_t den); + cairo_uint64_t den); cairo_quorem64_t I _cairo_int_96by64_32x64_divrem (cairo_int128_t num, - cairo_int64_t den); + cairo_int64_t den); -#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt(a,b)) -#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq(a,b)) -#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt(a,b)) -#define _cairo_uint128_gt(a,b) _cairo_uint128_lt(b,a) +#define _cairo_uint128_le(a,b) (!_cairo_uint128_gt(a,b)) +#define _cairo_uint128_ne(a,b) (!_cairo_uint128_eq(a,b)) +#define _cairo_uint128_ge(a,b) (!_cairo_uint128_lt(a,b)) +#define _cairo_uint128_gt(a,b) _cairo_uint128_lt(b,a) -#define _cairo_int128_le(a,b) (!_cairo_int128_gt(a,b)) -#define _cairo_int128_ne(a,b) (!_cairo_int128_eq(a,b)) -#define _cairo_int128_ge(a,b) (!_cairo_int128_lt(a,b)) -#define _cairo_int128_gt(a,b) _cairo_int128_lt(b,a) +#define _cairo_int128_le(a,b) (!_cairo_int128_gt(a,b)) +#define _cairo_int128_ne(a,b) (!_cairo_int128_eq(a,b)) +#define _cairo_int128_ge(a,b) (!_cairo_int128_lt(a,b)) +#define _cairo_int128_gt(a,b) _cairo_int128_lt(b,a) #undef I diff --git a/src/core/model/calendar-scheduler.cc b/src/core/model/calendar-scheduler.cc index e304bf007..10977f9e6 100644 --- a/src/core/model/calendar-scheduler.cc +++ b/src/core/model/calendar-scheduler.cc @@ -125,7 +125,7 @@ CalendarScheduler::PeekNext (void) const NS_ASSERT (!IsEmpty ()); uint32_t i = m_lastBucket; uint64_t bucketTop = m_bucketTop; - Scheduler::Event minEvent = {0, {~0, ~0}}; + Scheduler::Event minEvent = { 0, { ~0, ~0}}; do { if (!m_buckets[i].empty ()) @@ -154,7 +154,7 @@ CalendarScheduler::DoRemoveNext (void) { uint32_t i = m_lastBucket; uint64_t bucketTop = m_bucketTop; - Scheduler::Event minEvent = {0, {~0, ~0}}; + Scheduler::Event minEvent = { 0, { ~0, ~0}}; do { if (!m_buckets[i].empty ()) diff --git a/src/core/model/callback.cc b/src/core/model/callback.cc index db358a223..30ed261c3 100644 --- a/src/core/model/callback.cc +++ b/src/core/model/callback.cc @@ -4,30 +4,33 @@ namespace ns3 { CallbackValue::CallbackValue () : m_value () -{} +{ +} CallbackValue::CallbackValue (const CallbackBase &base) : m_value (base) -{} +{ +} CallbackValue::~CallbackValue () -{} -void +{ +} +void CallbackValue::Set (CallbackBase base) { m_value = base; } -Ptr +Ptr CallbackValue::Copy (void) const { return Create (m_value); } -std::string +std::string CallbackValue::SerializeToString (Ptr checker) const { std::ostringstream oss; oss << PeekPointer (m_value.GetImpl ()); return oss.str (); } -bool +bool CallbackValue::DeserializeFromString (std::string value, Ptr checker) { return false; @@ -48,36 +51,36 @@ namespace ns3 { std::string CallbackBase::Demangle(const std::string& mangled) { - int status; - char* demangled = abi::__cxa_demangle(mangled.c_str(), - NULL, NULL, &status); + int status; + char* demangled = abi::__cxa_demangle(mangled.c_str(), + NULL, NULL, &status); - std::string ret; - if (status == 0) { - NS_ASSERT(demangled); - ret = demangled; + std::string ret; + if (status == 0) { + NS_ASSERT(demangled); + ret = demangled; } - else if (status == -1) { - NS_LOG_UNCOND("Callback demangling failed: Memory allocation failure occured."); - ret = mangled; + else if (status == -1) { + NS_LOG_UNCOND("Callback demangling failed: Memory allocation failure occured."); + ret = mangled; } - else if (status == -2) { - NS_LOG_UNCOND("Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."); - ret = mangled; + else if (status == -2) { + NS_LOG_UNCOND("Callback demangling failed: Mangled name is not a valid under the C++ ABI mangling rules."); + ret = mangled; } - else if (status == -3) { - NS_LOG_UNCOND("Callback demangling failed: One of the arguments is invalid."); - ret = mangled; + else if (status == -3) { + NS_LOG_UNCOND("Callback demangling failed: One of the arguments is invalid."); + ret = mangled; } - else { - NS_LOG_UNCOND("Callback demangling failed: status " << status); - ret = mangled; + else { + NS_LOG_UNCOND("Callback demangling failed: status " << status); + ret = mangled; } - if (demangled) { - free(demangled); + if (demangled) { + free(demangled); } - return ret; + return ret; } } // namespace ns3 @@ -87,7 +90,7 @@ CallbackBase::Demangle(const std::string& mangled) std::string ns3::CallbackBase::Demangle(const std::string& mangled) { - return mangled; + return mangled; } #endif diff --git a/src/core/model/callback.h b/src/core/model/callback.h index bebf4ae8f..1c339374b 100644 --- a/src/core/model/callback.h +++ b/src/core/model/callback.h @@ -217,34 +217,34 @@ public: : m_objPtr (objPtr), m_memPtr (mem_ptr) {} virtual ~MemPtrCallbackImpl () {} R operator() (void) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(); } R operator() (T1 a1) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1); } R operator() (T1 a1,T2 a2) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2); } R operator() (T1 a1,T2 a2,T3 a3) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6, a7); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6, a7, a8); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8); } R operator() (T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) { - return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr) (a1, a2, a3, a4, a5, a6, a7, a8, a9); + return ((CallbackTraits::GetReference (m_objPtr)).*m_memPtr)(a1, a2, a3, a4, a5, a6, a7, a8, a9); } virtual bool IsEqual (Ptr other) const { MemPtrCallbackImpl const *otherDerived = @@ -323,7 +323,7 @@ private: class CallbackBase { public: CallbackBase () : m_impl () {} - Ptr GetImpl (void) const {return m_impl;} + Ptr GetImpl (void) const { return m_impl;} protected: CallbackBase (Ptr impl) : m_impl (impl) {} Ptr m_impl; @@ -390,48 +390,48 @@ public: Callback Bind (T a) { Ptr > impl = Ptr > ( - new BoundFunctorCallbackImpl< - Callback, - R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a), false); + new BoundFunctorCallbackImpl< + Callback, + R,T1,T2,T3,T4,T5,T6,T7,T8,T9> (*this, a), false); return Callback (impl); } bool IsNull (void) const { - return (DoPeekImpl () == 0)?true:false; + return (DoPeekImpl () == 0) ? true : false; } void Nullify (void) { m_impl = 0; } R operator() (void) const { - return (*(DoPeekImpl ())) (); + return (*(DoPeekImpl ()))(); } R operator() (T1 a1) const { - return (*(DoPeekImpl ())) (a1); + return (*(DoPeekImpl ()))(a1); } R operator() (T1 a1, T2 a2) const { - return (*(DoPeekImpl ())) (a1,a2); + return (*(DoPeekImpl ()))(a1,a2); } R operator() (T1 a1, T2 a2, T3 a3) const { - return (*(DoPeekImpl ())) (a1,a2,a3); + return (*(DoPeekImpl ()))(a1,a2,a3); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4); + return (*(DoPeekImpl ()))(a1,a2,a3,a4); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4,a5); + return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4,a5,a6); + return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4,a5,a6,a7); + return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4,a5,a6,a7,a8); + return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8); } R operator() (T1 a1, T2 a2, T3 a3, T4 a4,T5 a5,T6 a6,T7 a7,T8 a8, T9 a9) const { - return (*(DoPeekImpl ())) (a1,a2,a3,a4,a5,a6,a7,a8,a9); + return (*(DoPeekImpl ()))(a1,a2,a3,a4,a5,a6,a7,a8,a9); } bool IsEqual (const CallbackBase &other) const { @@ -499,11 +499,11 @@ bool operator != (Callback a, Callback -Callback MakeCallback (R (T::*memPtr) (void), OBJ objPtr) { +Callback MakeCallback (R (T::*memPtr)(void), OBJ objPtr) { return Callback (objPtr, memPtr); } template -Callback MakeCallback (R (T::*mem_ptr) () const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)() const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -515,11 +515,11 @@ Callback MakeCallback (R (T::*mem_ptr) () const, OBJ objPtr) { * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -531,11 +531,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1) const, OBJ objPtr) { * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -547,11 +547,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2) const, OBJ objPtr) { * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -563,11 +563,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3) const, OBJ objPtr) * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -579,11 +579,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4) const, OBJ o * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } /** @@ -595,11 +595,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5) const, * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } @@ -612,11 +612,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6) * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } @@ -630,11 +630,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7,T8), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7,T8) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } @@ -647,11 +647,11 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T * and potentially return a value. */ template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7,T8,T9), OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8,T9), OBJ objPtr) { return Callback (objPtr, mem_ptr); } template -Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T4,T5,T6,T7,T8,T9) const, OBJ objPtr) { +Callback MakeCallback (R (T::*mem_ptr)(T1,T2,T3,T4,T5,T6,T7,T8,T9) const, OBJ objPtr) { return Callback (objPtr, mem_ptr); } @@ -663,7 +663,7 @@ Callback MakeCallback (R (T::*mem_ptr) (T1,T2,T3,T * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) ()) { +Callback MakeCallback (R (*fnPtr)()) { return Callback (fnPtr, true, true); } /** @@ -674,7 +674,7 @@ Callback MakeCallback (R (*fnPtr) ()) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1)) { +Callback MakeCallback (R (*fnPtr)(T1)) { return Callback (fnPtr, true, true); } /** @@ -685,7 +685,7 @@ Callback MakeCallback (R (*fnPtr) (T1)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2)) { +Callback MakeCallback (R (*fnPtr)(T1,T2)) { return Callback (fnPtr, true, true); } /** @@ -696,7 +696,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3)) { return Callback (fnPtr, true, true); } /** @@ -707,7 +707,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4)) { return Callback (fnPtr, true, true); } /** @@ -718,7 +718,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5)) { return Callback (fnPtr, true, true); } /** @@ -729,7 +729,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6)) { return Callback (fnPtr, true, true); } @@ -741,7 +741,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6)) { * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6,T7)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7)) { return Callback (fnPtr, true, true); } @@ -753,7 +753,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6,T7) * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6,T7,T8)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8)) { return Callback (fnPtr, true, true); } @@ -765,7 +765,7 @@ Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6, * and potentially return a value. */ template -Callback MakeCallback (R (*fnPtr) (T1,T2,T3,T4,T5,T6,T7,T8,T9)) { +Callback MakeCallback (R (*fnPtr)(T1,T2,T3,T4,T5,T6,T7,T8,T9)) { return Callback (fnPtr, true, true); } @@ -892,7 +892,7 @@ Callback MakeNullCallback (void) { */ template -Callback MakeBoundCallback (R (*fnPtr) (TX), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX), ARG a) { Ptr > impl = Create >(fnPtr, a); return Callback (impl); @@ -900,56 +900,56 @@ Callback MakeBoundCallback (R (*fnPtr) (TX), ARG a) { template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5,T6), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5,T6,T7), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); } template -Callback MakeBoundCallback (R (*fnPtr) (TX,T1,T2,T3,T4,T5,T6,T7,T8), ARG a) { +Callback MakeBoundCallback (R (*fnPtr)(TX,T1,T2,T3,T4,T5,T6,T7,T8), ARG a) { Ptr > impl = Create > (fnPtr, a); return Callback (impl); diff --git a/src/core/model/command-line.cc b/src/core/model/command-line.cc index e6fc00cb0..aab4966fe 100644 --- a/src/core/model/command-line.cc +++ b/src/core/model/command-line.cc @@ -31,7 +31,8 @@ NS_LOG_COMPONENT_DEFINE ("CommandLine"); namespace ns3 { CommandLine::CommandLine () -{} +{ +} CommandLine::CommandLine (const CommandLine &cmd) { Copy (cmd); @@ -67,9 +68,10 @@ CommandLine::Clear (void) } CommandLine::Item::~Item () -{} +{ +} -void +void CommandLine::Parse (int iargc, char *argv[]) const { int argc = iargc; @@ -79,28 +81,28 @@ CommandLine::Parse (int iargc, char *argv[]) const std::string param = *argv; std::string::size_type cur = param.find ("--"); if (cur == 0) - { - param = param.substr (2, param.size () - 2); - } + { + param = param.substr (2, param.size () - 2); + } else - { - cur = param.find ("-"); - if (cur == 0) - { - param = param.substr (1, param.size () - 1); - } - else - { - // invalid argument. ignore. - continue; - } - } + { + cur = param.find ("-"); + if (cur == 0) + { + param = param.substr (1, param.size () - 1); + } + else + { + // invalid argument. ignore. + continue; + } + } cur = param.find ("="); std::string name, value; if (cur == std::string::npos) { - name = param; - value = ""; + name = param; + value = ""; } else { @@ -116,7 +118,7 @@ CommandLine::PrintHelp (void) const { std::cout << "--PrintHelp: Print this help message." << std::endl; std::cout << "--PrintGroups: Print the list of groups." << std::endl; - std::cout << "--PrintTypeIds: Print all TypeIds." << std::endl; + std::cout << "--PrintTypeIds: Print all TypeIds." << std::endl; std::cout << "--PrintGroup=[group]: Print all TypeIds of group." << std::endl; std::cout << "--PrintAttributes=[typeid]: Print all attributes of typeid." << std::endl; std::cout << "--PrintGlobals: Print the list of globals." << std::endl; @@ -124,9 +126,9 @@ CommandLine::PrintHelp (void) const { std::cout << "User Arguments:" << std::endl; for (Items::const_iterator i = m_items.begin (); i != m_items.end (); ++i) - { - std::cout << " --" << (*i)->m_name << ": " << (*i)->m_help << std::endl; - } + { + std::cout << " --" << (*i)->m_name << ": " << (*i)->m_help << std::endl; + } } } @@ -140,7 +142,7 @@ CommandLine::PrintGlobals (void) const StringValue v; (*i)->GetValue (v); std::cout << v.Get () << "]: " - << (*i)->GetHelp () << std::endl; + << (*i)->GetHelp () << std::endl; } } @@ -158,7 +160,7 @@ CommandLine::PrintAttributes (std::string type) const Ptr checker = tid.GetAttributeChecker (i); Ptr initial = tid.GetAttributeInitialValue (i); std::cout << initial->SerializeToString (checker) << "]: " - << tid.GetAttributeHelp (i) << std::endl; + << tid.GetAttributeHelp (i) << std::endl; } } @@ -170,9 +172,9 @@ CommandLine::PrintGroup (std::string group) const { TypeId tid = TypeId::GetRegistered (i); if (tid.GetGroupName () == group) - { - std::cout << " --PrintAttributes=" <::const_iterator j = groups.begin (); j != groups.end (); ++j) - { - if (*j == group) - { - found = true; - break; - } - } + { + if (*j == group) + { + found = true; + break; + } + } if (!found) - { - groups.push_back (group); - } + { + groups.push_back (group); + } } for (std::list::const_iterator k = groups.begin (); k != groups.end (); ++k) { diff --git a/src/core/model/command-line.h b/src/core/model/command-line.h index aa371a3c2..012c4b272 100644 --- a/src/core/model/command-line.h +++ b/src/core/model/command-line.h @@ -58,8 +58,8 @@ public: */ template void AddValue (const std::string &name, - const std::string &help, - T &value); + const std::string &help, + T &value); /** @@ -69,7 +69,7 @@ public: * and collect the value. This normally used by language bindings. */ void AddValue (const std::string &name, - const std::string &help, + const std::string &help, Callback callback); /** @@ -85,7 +85,7 @@ public: private: class Item { - public: +public: std::string m_name; std::string m_help; virtual ~Item (); @@ -94,13 +94,13 @@ private: template class UserItem : public Item { - public: +public: virtual bool Parse (std::string value); T *m_valuePtr; }; class CallbackItem : public Item { - public: +public: virtual bool Parse (std::string value); Callback m_callback; }; @@ -126,8 +126,8 @@ namespace ns3 { template void CommandLine::AddValue (const std::string &name, - const std::string &help, - T &value) + const std::string &help, + T &value) { UserItem *item = new UserItem (); item->m_name = name; diff --git a/src/core/model/config.cc b/src/core/model/config.cc index 85a32f05c..0953f4d68 100644 --- a/src/core/model/config.cc +++ b/src/core/model/config.cc @@ -35,46 +35,48 @@ namespace ns3 { namespace Config { MatchContainer::MatchContainer () -{} -MatchContainer::MatchContainer (const std::vector > &objects, +{ +} +MatchContainer::MatchContainer (const std::vector > &objects, const std::vector &contexts, std::string path) : m_objects (objects), m_contexts (contexts), m_path (path) -{} -MatchContainer::Iterator +{ +} +MatchContainer::Iterator MatchContainer::Begin (void) const { return m_objects.begin (); } -MatchContainer::Iterator +MatchContainer::Iterator MatchContainer::End (void) const { return m_objects.end (); } -uint32_t +uint32_t MatchContainer::GetN (void) const { return m_objects.size (); } -Ptr +Ptr MatchContainer::Get (uint32_t i) const { return m_objects[i]; } -std::string +std::string MatchContainer::GetMatchedPath (uint32_t i) const { return m_contexts[i]; } -std::string +std::string MatchContainer::GetPath (void) const { return m_path; } -void +void MatchContainer::Set (std::string name, const AttributeValue &value) { for (Iterator tmp = Begin (); tmp != End (); ++tmp) @@ -139,8 +141,9 @@ private: ArrayMatcher::ArrayMatcher (std::string element) : m_element (element) -{} -bool +{ +} +bool ArrayMatcher::Matches (uint32_t i) const { if (m_element == "*") @@ -156,16 +159,16 @@ ArrayMatcher::Matches (uint32_t i) const std::string right = m_element.substr (tmp+1, m_element.size () - (tmp + 1)); ArrayMatcher matcher = ArrayMatcher (left); if (matcher.Matches (i)) - { - NS_LOG_DEBUG ("Array "<= min && i <= max) + StringToUint32 (upperBound, &max) && + i >= min && i <= max) { - NS_LOG_DEBUG ("Array "< root) TypeId tid = TypeId::LookupByName (tidString); Ptr object = root->GetObject (tid); if (object == 0) - { - NS_LOG_DEBUG ("GetObject ("< object = ptr.Get (); + if (object == 0) + { + NS_LOG_ERROR ("Requested object name=\""< (PeekPointer (info.checker)); if (vectorChecker != 0) - { - NS_LOG_DEBUG ("GetAttribute(vector)="< () .AddConstructor () - ; + ; return tid; } @@ -62,9 +62,10 @@ DefaultSimulatorImpl::DefaultSimulatorImpl () } DefaultSimulatorImpl::~DefaultSimulatorImpl () -{} +{ +} -void +void DefaultSimulatorImpl::DoDispose (void) { while (!m_events->IsEmpty ()) @@ -272,7 +273,7 @@ DefaultSimulatorImpl::Remove (const EventId &id) m_destroyEvents.erase (i); break; } - } + } return; } if (IsExpired (id)) @@ -318,7 +319,7 @@ DefaultSimulatorImpl::IsExpired (const EventId &ev) const { return false; } - } + } return true; } if (ev.PeekEventImpl () == 0 || diff --git a/src/core/model/double.cc b/src/core/model/double.cc index 5daf62718..d599f5ca0 100644 --- a/src/core/model/double.cc +++ b/src/core/model/double.cc @@ -38,9 +38,9 @@ Ptr MakeDoubleChecker (double min, double max, std::stri virtual bool Check (const AttributeValue &value) const { const DoubleValue *v = dynamic_cast (&value); if (v == 0) - { - return false; - } + { + return false; + } return v->Get () >= m_minValue && v->Get () <= m_maxValue; } virtual std::string GetValueTypeName (void) const { diff --git a/src/core/model/enum.cc b/src/core/model/enum.cc index 0d156dbf1..8012b95b3 100644 --- a/src/core/model/enum.cc +++ b/src/core/model/enum.cc @@ -25,16 +25,18 @@ namespace ns3 { EnumValue::EnumValue () : m_v () -{} +{ +} EnumValue::EnumValue (int v) : m_v (v) -{} -void +{ +} +void EnumValue::Set (int v) { m_v = v; } -int +int EnumValue::Get (void) const { return m_v; @@ -52,11 +54,11 @@ EnumValue::SerializeToString (Ptr checker) const for (EnumChecker::ValueSet::const_iterator i = p->m_valueSet.begin (); i != p->m_valueSet.end (); i++) { if (i->first == m_v) - { - return i->second; - } + { + return i->second; + } } - + NS_FATAL_ERROR ("The user has set an invalid C++ value in this Enum"); // quiet compiler. return ""; @@ -69,28 +71,29 @@ EnumValue::DeserializeFromString (std::string value, Ptr for (EnumChecker::ValueSet::const_iterator i = p->m_valueSet.begin (); i != p->m_valueSet.end (); i++) { if (i->second == value) - { - m_v = i->first; - return true; - } + { + m_v = i->first; + return true; + } } return false; } EnumChecker::EnumChecker () -{} +{ +} -void +void EnumChecker::AddDefault (int v, std::string name) { m_valueSet.push_front (std::make_pair (v, name)); } -void +void EnumChecker::Add (int v, std::string name) { m_valueSet.push_back (std::make_pair (v, name)); } -bool +bool EnumChecker::Check (const AttributeValue &value) const { const EnumValue *p = dynamic_cast (&value); @@ -101,9 +104,9 @@ EnumChecker::Check (const AttributeValue &value) const for (ValueSet::const_iterator i = m_valueSet.begin (); i != m_valueSet.end (); i++) { if (i->first == p->Get ()) - { - return true; - } + { + return true; + } } return false; } @@ -235,52 +238,52 @@ MakeEnumChecker (int v1, std::string n1, checker->Add (v12, n12); if (n13 == "") { - return checker; + return checker; } checker->Add (v13, n13); if (n14 == "") - { - return checker; - } + { + return checker; + } checker->Add (v14, n14); if (n15 == "") { - return checker; + return checker; } checker->Add (v15, n15); if (n16 == "") { - return checker; + return checker; } checker->Add (v16, n16); if (n17 == "") { - return checker; + return checker; } checker->Add (v17, n17); if (n18 == "") { - return checker; + return checker; } checker->Add (v18, n18); if (n19 == "") { - return checker; + return checker; } checker->Add (v19, n19); if (n20 == "") { - return checker; + return checker; } checker->Add (v20, n20); if (n21 == "") { - return checker; + return checker; } checker->Add (v21, n21); if (n22 == "") { - return checker; + return checker; } checker->Add (v22, n22); return checker; diff --git a/src/core/model/enum.h b/src/core/model/enum.h index e34693b43..d8e40c2f2 100644 --- a/src/core/model/enum.h +++ b/src/core/model/enum.h @@ -87,17 +87,17 @@ template Ptr MakeEnumAccessor (T1 a1, T2 a2); Ptr MakeEnumChecker (int v1, std::string n1, - int v2 = 0, std::string n2 = "", - int v3 = 0, std::string n3 = "", - int v4 = 0, std::string n4 = "", - int v5 = 0, std::string n5 = "", - int v6 = 0, std::string n6 = "", - int v7 = 0, std::string n7 = "", - int v8 = 0, std::string n8 = "", - int v9 = 0, std::string n9 = "", - int v10 = 0, std::string n10 = "", - int v11 = 0, std::string n11 = "", - int v12 = 0, std::string n12 = "", + int v2 = 0, std::string n2 = "", + int v3 = 0, std::string n3 = "", + int v4 = 0, std::string n4 = "", + int v5 = 0, std::string n5 = "", + int v6 = 0, std::string n6 = "", + int v7 = 0, std::string n7 = "", + int v8 = 0, std::string n8 = "", + int v9 = 0, std::string n9 = "", + int v10 = 0, std::string n10 = "", + int v11 = 0, std::string n11 = "", + int v12 = 0, std::string n12 = "", int v13 = 0, std::string n13 = "", int v14 = 0, std::string n14 = "", int v15 = 0, std::string n15 = "", diff --git a/src/core/model/event-id.cc b/src/core/model/event-id.cc index a8258cfd6..d0a8436f5 100644 --- a/src/core/model/event-id.cc +++ b/src/core/model/event-id.cc @@ -28,25 +28,27 @@ EventId::EventId () m_ts (0), m_context (0), m_uid (0) -{} - +{ +} + EventId::EventId (const Ptr &impl, uint64_t ts, uint32_t context, uint32_t uid) : m_eventImpl (impl), m_ts (ts), m_context (context), m_uid (uid) -{} -void +{ +} +void EventId::Cancel (void) { Simulator::Cancel (*this); } -bool +bool EventId::IsExpired (void) const { return Simulator::IsExpired (*this); } -bool +bool EventId::IsRunning (void) const { return !IsExpired (); diff --git a/src/core/model/event-impl.cc b/src/core/model/event-impl.cc index 42c6deb02..5f386d874 100644 --- a/src/core/model/event-impl.cc +++ b/src/core/model/event-impl.cc @@ -23,28 +23,30 @@ namespace ns3 { EventImpl::~EventImpl () -{} +{ +} EventImpl::EventImpl () : m_cancel (false) -{} +{ +} -void +void EventImpl::Invoke (void) { - if (!m_cancel) + if (!m_cancel) { Notify (); } } -void +void EventImpl::Cancel (void) { m_cancel = true; } -bool +bool EventImpl::IsCancelled (void) { return m_cancel; diff --git a/src/core/model/fatal-error.h b/src/core/model/fatal-error.h index 7e52ce009..296e12b34 100644 --- a/src/core/model/fatal-error.h +++ b/src/core/model/fatal-error.h @@ -45,7 +45,7 @@ do \ { \ std::cerr << "file=" << __FILE__ << ", line=" << \ - __LINE__ << std::endl; \ + __LINE__ << std::endl; \ ::ns3::FatalImpl::FlushStreams (); \ std::terminate (); \ } \ diff --git a/src/core/model/fatal-impl.cc b/src/core/model/fatal-impl.cc index 9ee654a57..40ea58f01 100644 --- a/src/core/model/fatal-impl.cc +++ b/src/core/model/fatal-impl.cc @@ -45,29 +45,29 @@ namespace FatalImpl { /* File-scope */ namespace { - std::list **PeekStreamList (void) - { - static std::list *streams = 0; - return &streams; - } - std::list *GetStreamList (void) +std::list **PeekStreamList (void) +{ + static std::list *streams = 0; + return &streams; +} +std::list *GetStreamList (void) +{ + std::list **pstreams = PeekStreamList (); + if (*pstreams == 0) + { + *pstreams = new std::list (); + } + return *pstreams; +} +struct destructor +{ + ~destructor () { std::list **pstreams = PeekStreamList (); - if (*pstreams == 0) - { - *pstreams = new std::list (); - } - return *pstreams; + delete *pstreams; + *pstreams = 0; } - struct destructor - { - ~destructor () - { - std::list **pstreams = PeekStreamList (); - delete *pstreams; - *pstreams = 0; - } - }; +}; } void @@ -94,13 +94,13 @@ UnregisterStream (std::ostream* stream) namespace { - /* Overrides normal SIGSEGV handler once the - * HandleTerminate function is run. */ - void sigHandler(int sig) - { - FlushStreams (); - std::abort (); - } +/* Overrides normal SIGSEGV handler once the + * HandleTerminate function is run. */ +void sigHandler(int sig) +{ + FlushStreams (); + std::abort (); +} } void diff --git a/src/core/model/global-value.cc b/src/core/model/global-value.cc index 3e17328c9..57ff88dee 100644 --- a/src/core/model/global-value.cc +++ b/src/core/model/global-value.cc @@ -31,8 +31,8 @@ namespace ns3 { GlobalValue::GlobalValue (std::string name, std::string help, - const AttributeValue &initialValue, - Ptr checker) + const AttributeValue &initialValue, + Ptr checker) : m_name (name), m_help (help), m_initialValue (initialValue.Copy ()), @@ -107,7 +107,7 @@ GlobalValue::GetChecker (void) const { return m_checker; } - + bool GlobalValue::SetValue (const AttributeValue &value) { @@ -144,13 +144,13 @@ GlobalValue::Bind (std::string name, const AttributeValue &value) for (Iterator i = Begin (); i != End (); i++) { if ((*i)->GetName () == name) - { - if (!(*i)->SetValue (value)) - { - NS_FATAL_ERROR ("Invalid new value for global value: "<SetValue (value)) + { + NS_FATAL_ERROR ("Invalid new value for global value: "<GetName () == name) - { - return (*i)->SetValue (value); - } + { + return (*i)->SetValue (value); + } } return false; } @@ -183,10 +183,10 @@ GlobalValue::GetValueByNameFailSafe (std::string name, AttributeValue &value) for (GlobalValue::Iterator gvit = GlobalValue::Begin (); gvit != GlobalValue::End (); ++gvit) { if ((*gvit)->GetName () == name) - { - (*gvit)->GetValue (value); - return true; - } + { + (*gvit)->GetValue (value); + return true; + } } return false; // not found } @@ -194,7 +194,7 @@ GlobalValue::GetValueByNameFailSafe (std::string name, AttributeValue &value) void GlobalValue::GetValueByName (std::string name, AttributeValue &value) { - if (! GetValueByNameFailSafe (name, value)) + if (!GetValueByNameFailSafe (name, value)) { NS_FATAL_ERROR ("Could not find GlobalValue named \"" << name << "\""); } diff --git a/src/core/model/global-value.h b/src/core/model/global-value.h index 942de8e56..359ed3251 100644 --- a/src/core/model/global-value.h +++ b/src/core/model/global-value.h @@ -95,7 +95,7 @@ public: * This method cannot fail. It will crash if the input is not valid. */ static void Bind (std::string name, const AttributeValue &value); - + /** * \param name the name of the global value * \param value the value to set in the requested global value. @@ -136,7 +136,7 @@ public: * */ static void GetValueByName (std::string name, AttributeValue &value); - + private: friend class GlobalValueTestCase; diff --git a/src/core/model/heap-scheduler.cc b/src/core/model/heap-scheduler.cc index 19d39872f..71e6e492c 100644 --- a/src/core/model/heap-scheduler.cc +++ b/src/core/model/heap-scheduler.cc @@ -46,7 +46,7 @@ HeapScheduler::HeapScheduler () // we purposedly waste an item at the start of // the array to make sure the indexes in the // array start at one. - Scheduler::Event empty = {0,{0,0}}; + Scheduler::Event empty = { 0,{ 0,0}}; m_heap.push_back (empty); } diff --git a/src/core/model/int-to-type.h b/src/core/model/int-to-type.h index 612820cf9..54343a86d 100644 --- a/src/core/model/int-to-type.h +++ b/src/core/model/int-to-type.h @@ -11,7 +11,7 @@ namespace ns3 { template struct IntToType { - enum v_e {value = v}; + enum v_e { value = v}; }; } // namespace ns3 diff --git a/src/core/model/int64x64-128.cc b/src/core/model/int64x64-128.cc index fe4194b76..75f33fca8 100644 --- a/src/core/model/int64x64-128.cc +++ b/src/core/model/int64x64-128.cc @@ -4,13 +4,13 @@ namespace ns3 { -#define OUTPUT_SIGN(sa,sb,ua,ub) \ - ({bool negA, negB; \ - negA = sa < 0; \ - negB = sb < 0; \ - ua = negA?-sa:sa; \ - ub = negB?-sb:sb; \ - (negA && !negB) || (!negA && negB);}) +#define OUTPUT_SIGN(sa,sb,ua,ub) \ + ({ bool negA, negB; \ + negA = sa < 0; \ + negB = sb < 0; \ + ua = negA ? -sa : sa; \ + ub = negB ? -sb : sb; \ + (negA && !negB) || (!negA && negB);}) #define MASK_LO ((((int128_t)1)<<64)-1) @@ -54,7 +54,7 @@ int64x64_t::Umul (uint128_t a, uint128_t b) result |= ((hiPart & MASK_LO) << 64) + (midPart & MASK_HI); // if the high part is not zero, put a warning NS_ABORT_MSG_IF ((hiPart & MASK_HI) != 0, - "High precision 128 bits multiplication error: multiplication overflow."); + "High precision 128 bits multiplication error: multiplication overflow."); return result; } void @@ -62,9 +62,9 @@ int64x64_t::Div (int64x64_t const &o) { bool negResult; uint128_t a, b; - negResult = OUTPUT_SIGN (_v, o._v, a, b); + negResult = OUTPUT_SIGN (_v, o._v, a, b); int128_t result = Divu (a, b); - result = negResult ? -result:result; + result = negResult ? -result : result; _v = result; } @@ -96,10 +96,10 @@ void int64x64_t::MulByInvert (const int64x64_t &o) { bool negResult = _v < 0; - uint128_t a = negResult?-_v:_v; + uint128_t a = negResult ? -_v : _v; uint128_t result = UmulByInvert (a, o._v); - _v = negResult?-result:result; + _v = negResult ? -result : result; } uint128_t int64x64_t::UmulByInvert (uint128_t a, uint128_t b) diff --git a/src/core/model/int64x64-128.h b/src/core/model/int64x64-128.h index cae689ef1..d1a60c605 100644 --- a/src/core/model/int64x64-128.h +++ b/src/core/model/int64x64-128.h @@ -6,7 +6,7 @@ #include #include -#if defined(HAVE___UINT128_T) and !defined(HAVE_UINT128_T) +#if defined(HAVE___UINT128_T)and !defined(HAVE_UINT128_T) typedef __uint128_t uint128_t; typedef __int128_t int128_t; #endif @@ -25,13 +25,13 @@ public: inline int64x64_t (double value) { bool is_negative = value < 0; - value = is_negative?-value:value; + value = is_negative ? -value : value; double hi = floor (value); double lo = (value - hi) * HP128_MAX_64; _v = (int128_t)hi; _v <<= 64; _v += (int128_t)lo; - _v = is_negative?-_v:_v; + _v = is_negative ? -_v : _v; } inline int64x64_t (int v) : _v (v) @@ -66,24 +66,24 @@ public: explicit inline int64x64_t (int64_t hi, uint64_t lo) { bool is_negative = hi<0; - _v = is_negative?-hi:hi; + _v = is_negative ? -hi : hi; _v <<= 64; _v += lo; - _v = is_negative?-_v:_v; + _v = is_negative ? -_v : _v; } inline int64x64_t (const int64x64_t &o) : _v (o._v) {} inline int64x64_t &operator = (const int64x64_t &o) - { - _v = o._v; - return *this; - } + { + _v = o._v; + return *this; + } inline double GetDouble (void) const { bool is_negative = _v < 0; - uint128_t value = is_negative ? -_v:_v; + uint128_t value = is_negative ? -_v : _v; uint64_t hi = value >> 64; uint64_t lo = value; double flo = lo; @@ -96,15 +96,15 @@ public: inline int64_t GetHigh (void) const { bool negative = _v < 0; - int128_t v = negative?-_v:_v; + int128_t v = negative ? -_v : _v; v >>= 64; int64_t retval = v; - return negative?-retval:retval; + return negative ? -retval : retval; } inline uint64_t GetLow (void) const { bool negative = _v < 0; - int128_t v = negative?-_v:_v; + int128_t v = negative ? -_v : _v; int128_t low = v & HP128_MASK_LO; uint64_t retval = low; return retval; diff --git a/src/core/model/int64x64-cairo.cc b/src/core/model/int64x64-cairo.cc index 9baaffe59..e45365d99 100644 --- a/src/core/model/int64x64-cairo.cc +++ b/src/core/model/int64x64-cairo.cc @@ -27,14 +27,14 @@ namespace ns3 { #define OUTPUT_SIGN(sa,sb,ua,ub) \ - ({bool negA, negB; \ - negA = _cairo_int128_negative (sa); \ - negB = _cairo_int128_negative (sb); \ - ua = _cairo_int128_to_uint128 (sa); \ - ub = _cairo_int128_to_uint128 (sb); \ - ua = negA ? _cairo_uint128_negate (ua) : ua; \ - ub = negB ? _cairo_uint128_negate (ub) : ub; \ - (negA && !negB) || (!negA && negB);}) + ({ bool negA, negB; \ + negA = _cairo_int128_negative (sa); \ + negB = _cairo_int128_negative (sb); \ + ua = _cairo_int128_to_uint128 (sa); \ + ub = _cairo_int128_to_uint128 (sb); \ + ua = negA ? _cairo_uint128_negate (ua) : ua; \ + ub = negB ? _cairo_uint128_negate (ub) : ub; \ + (negA && !negB) || (!negA && negB);}) void int64x64_t::Mul (int64x64_t const &o) @@ -114,10 +114,10 @@ void int64x64_t::MulByInvert (const int64x64_t &o) { bool negResult = _cairo_int128_negative (_v); - cairo_uint128_t a = negResult?_cairo_int128_negate(_v):_v; + cairo_uint128_t a = negResult ? _cairo_int128_negate(_v) : _v; cairo_uint128_t result = UmulByInvert (a, o._v); - _v = negResult?_cairo_int128_negate(result):result; + _v = negResult ? _cairo_int128_negate(result) : result; } cairo_uint128_t int64x64_t::UmulByInvert (cairo_uint128_t a, cairo_uint128_t b) @@ -126,7 +126,7 @@ int64x64_t::UmulByInvert (cairo_uint128_t a, cairo_uint128_t b) cairo_uint128_t hi, mid; hi = _cairo_uint64x64_128_mul (a.hi, b.hi); mid = _cairo_uint128_add (_cairo_uint64x64_128_mul (a.hi, b.lo), - _cairo_uint64x64_128_mul (a.lo, b.hi)); + _cairo_uint64x64_128_mul (a.lo, b.hi)); mid.lo = mid.hi; mid.hi = 0; result = _cairo_uint128_add (hi,mid); @@ -147,7 +147,7 @@ int64x64_t::Invert (uint64_t v) tmp.MulByInvert (result); if (tmp.GetHigh () != 1) { - cairo_uint128_t one = {1, 0}; + cairo_uint128_t one = { 1, 0}; result._v = _cairo_uint128_add (result._v, one); } return result; diff --git a/src/core/model/int64x64-cairo.h b/src/core/model/int64x64-cairo.h index 94ac692c8..4af474b2b 100644 --- a/src/core/model/int64x64-cairo.h +++ b/src/core/model/int64x64-cairo.h @@ -26,7 +26,7 @@ public: #define HPCAIRO_MAX_64 18446744073709551615.0 double fhi = floor (value); int64_t hi = lround(fhi); - uint64_t lo = (uint64_t) ((value - fhi) * HPCAIRO_MAX_64); + uint64_t lo = (uint64_t)((value - fhi) * HPCAIRO_MAX_64); _v.hi = hi; _v.lo = lo; #undef HPCAIRO_MAX_64 @@ -70,10 +70,10 @@ public: inline int64x64_t (const int64x64_t &o) : _v (o._v) {} inline int64x64_t &operator = (const int64x64_t &o) - { - _v = o._v; - return *this; - } + { + _v = o._v; + return *this; + } inline double GetDouble (void) const { @@ -84,7 +84,7 @@ public: flo /= HPCAIRO_MAX_64; double retval = value.hi; retval += flo; - retval = is_negative ? -retval: retval; + retval = is_negative ? -retval : retval; return retval; #undef HPCAIRO_MAX_64 } @@ -131,7 +131,7 @@ private: _v.hi = ~_v.hi; if (++_v.lo == 0) { - ++_v.hi; + ++_v.hi; } } inline int Compare (const int64x64_t &o) const @@ -139,8 +139,8 @@ private: int status; int64x64_t tmp = *this; tmp -= o; - status = (((int64_t)(tmp)._v.hi) < 0)?-1: - (((tmp)._v.hi == 0 && (tmp)._v.lo == 0))?0:1; + status = (((int64_t)(tmp)._v.hi) < 0) ? -1 : + (((tmp)._v.hi == 0 && (tmp)._v.lo == 0)) ? 0 : 1; return status; } cairo_int128_t _v; @@ -153,7 +153,7 @@ inline bool operator == (const int64x64_t &lhs, const int64x64_t &rhs) inline bool operator != (const int64x64_t &lhs, const int64x64_t &rhs) { - return ! (lhs == rhs); + return !(lhs == rhs); } inline bool operator < (const int64x64_t &lhs, const int64x64_t &rhs) @@ -246,7 +246,7 @@ inline int64x64_t operator - (const int64x64_t &lhs) inline int64x64_t operator ! (const int64x64_t &lhs) { - return (lhs._v.hi == 0 && lhs._v.lo == 0)?int64x64_t (1, 0):int64x64_t (); + return (lhs._v.hi == 0 && lhs._v.lo == 0) ? int64x64_t (1, 0) : int64x64_t (); } } // namespace ns3 diff --git a/src/core/model/int64x64-double.h b/src/core/model/int64x64-double.h index 678c982f1..82d26c7eb 100644 --- a/src/core/model/int64x64-double.h +++ b/src/core/model/int64x64-double.h @@ -27,15 +27,15 @@ public: inline int64x64_t (unsigned long long int v) : _v (v) {} inline int64x64_t (int64_t hi, uint64_t lo) - : _v (hi) {/* XXX */} + : _v (hi) { /* XXX */} inline int64x64_t (const int64x64_t &o) : _v (o._v) {} inline int64x64_t &operator = (const int64x64_t &o) - { - _v = o._v; - return *this; - } + { + _v = o._v; + return *this; + } inline double GetDouble (void) const { diff --git a/src/core/model/int64x64.cc b/src/core/model/int64x64.cc index bd7881533..b90becbc1 100644 --- a/src/core/model/int64x64.cc +++ b/src/core/model/int64x64.cc @@ -31,7 +31,7 @@ static uint64_t PowerOfTen (uint8_t n) std::ostream &operator << (std::ostream &os, const int64x64_t &value) { int64_t hi = value.GetHigh (); - os << ((hi<0)?"-":"+") << ((hi<0)?-hi:hi) << "."; + os << ((hi<0) ? "-" : "+") << ((hi<0) ? -hi : hi) << "."; uint64_t low = value.GetLow (); uint8_t msd = MostSignificantDigit (~((uint64_t)0)); do @@ -80,13 +80,13 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) { next = str.find ("+", cur); if (next != std::string::npos) - { - next++; - } + { + next++; + } else - { - next = cur; - } + { + next = cur; + } negative = false; } cur = next; @@ -103,7 +103,7 @@ std::istream &operator >> (std::istream &is, int64x64_t &value) hi = ReadDigits (str.substr (cur, str.size ()-cur)); lo = 0; } - hi = negative?-hi:hi; + hi = negative ? -hi : hi; value = int64x64_t (hi, lo); return is; } diff --git a/src/core/model/int64x64.h b/src/core/model/int64x64.h index 58cc46507..aecdfdcca 100644 --- a/src/core/model/int64x64.h +++ b/src/core/model/int64x64.h @@ -15,57 +15,57 @@ namespace ns3 { -#define INT64X64_OP_ARITH_TYPE(op,type) \ +#define INT64X64_OP_ARITH_TYPE(op,type) \ inline int64x64_t operator op (const int64x64_t &lhs, const type rhs) \ - { \ - int64x64_t tmp = lhs; \ - tmp op##= int64x64_t (rhs); \ - return tmp; \ - } \ + { \ + int64x64_t tmp = lhs; \ + tmp op ##= int64x64_t (rhs); \ + return tmp; \ + } \ inline int64x64_t operator op (const type lhs, const int64x64_t &rhs) \ - { \ - int64x64_t tmp = int64x64_t (lhs); \ - tmp op##= rhs; \ - return tmp; \ + { \ + int64x64_t tmp = int64x64_t (lhs); \ + tmp op ##= rhs; \ + return tmp; \ } -#define INT64X64_OP_ARITH(op) \ +#define INT64X64_OP_ARITH(op) \ inline int64x64_t operator op (const int64x64_t &lhs, const int64x64_t &rhs) \ - { \ - int64x64_t tmp = lhs; \ - tmp op##= rhs; \ - return tmp; \ - } \ - INT64X64_OP_ARITH_TYPE(op,double) \ - INT64X64_OP_ARITH_TYPE(op,signed char) \ - INT64X64_OP_ARITH_TYPE(op,signed short) \ - INT64X64_OP_ARITH_TYPE(op,signed int) \ - INT64X64_OP_ARITH_TYPE(op,signed long int) \ - INT64X64_OP_ARITH_TYPE(op,signed long long int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned char) \ - INT64X64_OP_ARITH_TYPE(op,unsigned short) \ - INT64X64_OP_ARITH_TYPE(op,unsigned int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned long int) \ - INT64X64_OP_ARITH_TYPE(op,unsigned long long int) + { \ + int64x64_t tmp = lhs; \ + tmp op ##= rhs; \ + return tmp; \ + } \ + INT64X64_OP_ARITH_TYPE(op,double) \ + INT64X64_OP_ARITH_TYPE(op,signed char) \ + INT64X64_OP_ARITH_TYPE(op,signed short) \ + INT64X64_OP_ARITH_TYPE(op,signed int) \ + INT64X64_OP_ARITH_TYPE(op,signed long int) \ + INT64X64_OP_ARITH_TYPE(op,signed long long int) \ + INT64X64_OP_ARITH_TYPE(op,unsigned char) \ + INT64X64_OP_ARITH_TYPE(op,unsigned short) \ + INT64X64_OP_ARITH_TYPE(op,unsigned int) \ + INT64X64_OP_ARITH_TYPE(op,unsigned long int) \ + INT64X64_OP_ARITH_TYPE(op,unsigned long long int) -#define INT64X64_OP_CMP_TYPE(op,type) \ - inline bool operator op (const int64x64_t &lhs, const type &rhs) \ - { \ - return lhs op int64x64_t (rhs); \ - } \ - inline bool operator op (const type &lhs, const int64x64_t &rhs) \ - { \ - return int64x64_t (lhs) op rhs; \ +#define INT64X64_OP_CMP_TYPE(op,type) \ + inline bool operator op (const int64x64_t &lhs, const type &rhs) \ + { \ + return lhs op int64x64_t (rhs); \ + } \ + inline bool operator op (const type &lhs, const int64x64_t &rhs) \ + { \ + return int64x64_t (lhs) op rhs; \ } -#define INT64X64_OP_CMP(op) \ - INT64X64_OP_CMP_TYPE(op,double) \ - INT64X64_OP_CMP_TYPE(op,signed int) \ - INT64X64_OP_CMP_TYPE(op,signed long int) \ - INT64X64_OP_CMP_TYPE(op,signed long long int) \ - INT64X64_OP_CMP_TYPE(op,unsigned int) \ - INT64X64_OP_CMP_TYPE(op,unsigned long int) \ - INT64X64_OP_CMP_TYPE(op,unsigned long long int) +#define INT64X64_OP_CMP(op) \ + INT64X64_OP_CMP_TYPE(op,double) \ + INT64X64_OP_CMP_TYPE(op,signed int) \ + INT64X64_OP_CMP_TYPE(op,signed long int) \ + INT64X64_OP_CMP_TYPE(op,signed long long int) \ + INT64X64_OP_CMP_TYPE(op,unsigned int) \ + INT64X64_OP_CMP_TYPE(op,unsigned long int) \ + INT64X64_OP_CMP_TYPE(op,unsigned long long int) INT64X64_OP_ARITH(+) @@ -84,17 +84,17 @@ std::istream &operator >> (std::istream &is, int64x64_t &val); inline int64x64_t Abs (const int64x64_t &value) { - return (value < 0)?-value:value; + return (value < 0) ? -value : value; } inline int64x64_t Min (const int64x64_t &a, const int64x64_t &b) { - return (a < b)?a:b; + return (a < b) ? a : b; } inline int64x64_t Max (const int64x64_t &a, const int64x64_t &b) { - return (a > b)?a:b; + return (a > b) ? a : b; } } // namespace ns3 diff --git a/src/core/model/integer.cc b/src/core/model/integer.cc index d78a9eda9..946563559 100644 --- a/src/core/model/integer.cc +++ b/src/core/model/integer.cc @@ -39,9 +39,9 @@ MakeIntegerChecker (int64_t min, int64_t max, std::string name) virtual bool Check (const AttributeValue &value) const { const IntegerValue *v = dynamic_cast (&value); if (v == 0) - { - return false; - } + { + return false; + } return v->Get () >= m_minValue && v->Get () <= m_maxValue; } virtual std::string GetValueTypeName (void) const { diff --git a/src/core/model/log.cc b/src/core/model/log.cc index 14ffbd883..828318396 100644 --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -76,7 +76,7 @@ PrintList::PrintList () } cur = next + 1; } -#endif +#endif } @@ -261,11 +261,11 @@ LogComponentEnable (char const *name, enum LogLevel level) i++) { if (i->first.compare (name) == 0) - { - i->second->Enable (level); - break; - } - } + { + i->second->Enable (level); + break; + } + } } void @@ -277,7 +277,7 @@ LogComponentEnableAll (enum LogLevel level) i++) { i->second->Enable (level); - } + } } void @@ -289,11 +289,11 @@ LogComponentDisable (char const *name, enum LogLevel level) i++) { if (i->first.compare (name) == 0) - { - i->second->Disable (level); - break; - } - } + { + i->second->Disable (level); + break; + } + } } void @@ -305,7 +305,7 @@ LogComponentDisableAll (enum LogLevel level) i++) { i->second->Disable (level); - } + } } void @@ -376,6 +376,7 @@ LogNodePrinter LogGetNodePrinter(void) ParameterLogger::ParameterLogger (std::ostream &os) : m_itemNumber (0), m_os (os) -{} +{ +} } // namespace ns3 diff --git a/src/core/model/log.h b/src/core/model/log.h index f544e86ab..fa381a49c 100644 --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -123,7 +123,7 @@ void LogComponentDisableAll (enum LogLevel level); * logging components to enable. For example (using bash syntax), * NS_LOG="OlsrAgent" would enable one component at all log levels. * NS_LOG="OlsrAgent:Ipv4L3Protocol" would enable two components, - * at all log levels, etc. + * at all log levels, etc. * NS_LOG="*" will enable all available log components at all levels. * * To control more selectively the log levels for each component, use @@ -156,7 +156,7 @@ void LogComponentDisableAll (enum LogLevel level); ns3::LogTimePrinter printer = ns3::LogGetTimePrinter (); \ if (printer != 0) \ { \ - (*printer) (std::clog); \ + (*printer)(std::clog); \ std::clog << " "; \ } \ } @@ -167,7 +167,7 @@ void LogComponentDisableAll (enum LogLevel level); ns3::LogNodePrinter printer = ns3::LogGetNodePrinter (); \ if (printer != 0) \ { \ - (*printer) (std::clog); \ + (*printer)(std::clog); \ std::clog << " "; \ } \ } @@ -176,7 +176,7 @@ void LogComponentDisableAll (enum LogLevel level); if (g_log.IsEnabled (ns3::LOG_PREFIX_FUNC)) \ { \ std::clog << g_log.Name () << ":" << \ - __FUNCTION__ << "(): "; \ + __FUNCTION__ << "(): "; \ } \ #ifndef NS_LOG_APPEND_CONTEXT @@ -349,8 +349,8 @@ namespace ns3 { */ void LogComponentPrintList (void); -typedef void (*LogTimePrinter) (std::ostream &os); -typedef void (*LogNodePrinter) (std::ostream &os); +typedef void (*LogTimePrinter)(std::ostream &os); +typedef void (*LogNodePrinter)(std::ostream &os); void LogSetTimePrinter (LogTimePrinter); LogTimePrinter LogGetTimePrinter(void); diff --git a/src/core/model/names.cc b/src/core/model/names.cc index 6fe99b6c9..ed901464c 100644 --- a/src/core/model/names.cc +++ b/src/core/model/names.cc @@ -35,7 +35,7 @@ public: NameNode (NameNode *parent, std::string name, Ptr object); NameNode &operator = (const NameNode &rhs); - ~NameNode (); + ~NameNode (); NameNode *m_parent; std::string m_name; @@ -178,7 +178,7 @@ NamesPriv::Add (std::string name, Ptr object) if (offset != 0) { // - // This must be a name that has the "/Names" namespace prefix omitted. + // This must be a name that has the "/Names" namespace prefix omitted. // Do some reasonableness checking on the rest of the name. // offset = name.find ("/"); @@ -190,7 +190,7 @@ NamesPriv::Add (std::string name, Ptr object) name = "/Names/" + name; } - + // // There must now be a fully qualified path in the string. All fully // qualified names begin with "/Names". We have to split off the final @@ -287,7 +287,7 @@ NamesPriv::Rename (std::string oldpath, std::string newname) if (offset != 0) { // - // This must be a name that has the "/Names" namespace prefix omitted. + // This must be a name that has the "/Names" namespace prefix omitted. // Do some reasonableness checking on the rest of the name. // offset = oldpath.find ("/"); @@ -299,7 +299,7 @@ NamesPriv::Rename (std::string oldpath, std::string newname) oldpath = "/Names/" + oldpath; } - + // // There must now be a fully qualified path in the oldpath string. All // fully qualified names begin with "/Names". We have to split off the final diff --git a/src/core/model/names.h b/src/core/model/names.h index 538d49eb4..ba7c153a1 100644 --- a/src/core/model/names.h +++ b/src/core/model/names.h @@ -456,6 +456,6 @@ Names::Find (Ptr context, std::string name) } } -}//namespace ns3 +} //namespace ns3 #endif /* OBJECT_NAMES_H */ diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h index 7beae058a..61125d6d1 100644 --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -153,15 +153,15 @@ public: * The unit to use to interpret a number representing time */ enum Unit - { - S = 0, - MS = 1, - US = 2, - NS = 3, - PS = 4, - FS = 5, - LAST = 6 - }; + { + S = 0, + MS = 1, + US = 2, + NS = 3, + PS = 4, + FS = 5, + LAST = 6 + }; inline Time &operator = (const Time &o) { @@ -252,7 +252,7 @@ public: inline int Compare (const Time &o) const { - return (m_data < o.m_data)?-1:(m_data == o.m_data)?0:1; + return (m_data < o.m_data) ? -1 : (m_data == o.m_data) ? 0 : 1; } /** @@ -544,7 +544,7 @@ inline Time &operator -= (Time &lhs, const Time &rhs) */ inline Time Abs (const Time &time) { - return Time ((time.m_data < 0)?-time.m_data:time.m_data); + return Time ((time.m_data < 0) ? -time.m_data : time.m_data); } /** * \anchor ns3-Time-Max @@ -555,7 +555,7 @@ inline Time Abs (const Time &time) */ inline Time Max (const Time &ta, const Time &tb) { - return Time ((ta.m_data < tb.m_data)?tb:ta); + return Time ((ta.m_data < tb.m_data) ? tb : ta); } /** * \anchor ns3-Time-Min @@ -566,7 +566,7 @@ inline Time Max (const Time &ta, const Time &tb) */ inline Time Min (const Time &ta, const Time &tb) { - return Time ((ta.m_data > tb.m_data)?tb:ta); + return Time ((ta.m_data > tb.m_data) ? tb : ta); } diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index c9f4ba8a8..a0ec39708 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -49,7 +49,8 @@ ObjectBase::GetTypeId (void) } ObjectBase::~ObjectBase () -{} +{ +} void ObjectBase::NotifyConstructionCompleted (void) @@ -61,106 +62,106 @@ ObjectBase::ConstructSelf (const AttributeList &attributes) // loop over the inheritance tree back to the Object base class. TypeId tid = GetInstanceTypeId (); do { - // loop over all attributes in object type - NS_LOG_DEBUG ("construct tid="<checker == checker) - { - // We have a matching attribute value. - if (DoSet (accessor, checker, *j->value)) - { - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - tid.GetAttributeName (i)<<"\""); - found = true; - break; - } - } - } - if (!found) - { - // is this attribute stored in the global instance ? - for (AttributeList::Attrs::const_iterator j = AttributeList::GetGlobal ()->m_attributes.begin (); - j != AttributeList::GetGlobal ()->m_attributes.end (); j++) - { - if (j->checker == checker) - { - // We have a matching attribute value. - if (DoSet (accessor, checker, *j->value)) - { - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - tid.GetAttributeName (i)<<"\" from global"); - found = true; - break; - } - } - } - } - if (!found) - { - // No matching attribute value so we try to look at the env var. + // loop over all attributes in object type + NS_LOG_DEBUG ("construct tid="<checker == checker) + { + // We have a matching attribute value. + if (DoSet (accessor, checker, *j->value)) + { + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + tid.GetAttributeName (i)<<"\""); + found = true; + break; + } + } + } + if (!found) + { + // is this attribute stored in the global instance ? + for (AttributeList::Attrs::const_iterator j = AttributeList::GetGlobal ()->m_attributes.begin (); + j != AttributeList::GetGlobal ()->m_attributes.end (); j++) + { + if (j->checker == checker) + { + // We have a matching attribute value. + if (DoSet (accessor, checker, *j->value)) + { + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + tid.GetAttributeName (i)<<"\" from global"); + found = true; + break; + } + } + } + } + if (!found) + { + // No matching attribute value so we try to look at the env var. #ifdef HAVE_GETENV - char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT"); - if (envVar != 0) - { - std::string env = std::string (envVar); - std::string::size_type cur = 0; - std::string::size_type next = 0; - while (next != std::string::npos) - { - next = env.find (";", cur); - std::string tmp = std::string (env, cur, next-cur); - std::string::size_type equal = tmp.find ("="); - if (equal != std::string::npos) - { - std::string name = tmp.substr (0, equal); - std::string value = tmp.substr (equal+1, tmp.size () - equal - 1); - if (name == tid.GetAttributeFullName (i)) - { - if (DoSet (accessor, checker, StringValue (value))) - { - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - tid.GetAttributeName (i)<<"\" from env var"); - found = true; - break; - } - } - } - cur = next + 1; - } - } + char *envVar = getenv ("NS_ATTRIBUTE_DEFAULT"); + if (envVar != 0) + { + std::string env = std::string (envVar); + std::string::size_type cur = 0; + std::string::size_type next = 0; + while (next != std::string::npos) + { + next = env.find (";", cur); + std::string tmp = std::string (env, cur, next-cur); + std::string::size_type equal = tmp.find ("="); + if (equal != std::string::npos) + { + std::string name = tmp.substr (0, equal); + std::string value = tmp.substr (equal+1, tmp.size () - equal - 1); + if (name == tid.GetAttributeFullName (i)) + { + if (DoSet (accessor, checker, StringValue (value))) + { + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + tid.GetAttributeName (i)<<"\" from env var"); + found = true; + break; + } + } + } + cur = next + 1; + } + } #endif /* HAVE_GETENV */ - } - if (!found) - { - // No matching attribute value so we try to set the default value. - DoSet (accessor, checker, *initial); - NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< - tid.GetAttributeName (i)<<"\" from initial value."); - } - } - tid = tid.GetParent (); - } while (tid != ObjectBase::GetTypeId ()); + } + if (!found) + { + // No matching attribute value so we try to set the default value. + DoSet (accessor, checker, *initial); + NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< + tid.GetAttributeName (i)<<"\" from initial value."); + } + } + tid = tid.GetParent (); + } while (tid != ObjectBase::GetTypeId ()); NotifyConstructionCompleted (); } bool ObjectBase::DoSet (Ptr spec, - Ptr checker, + Ptr checker, const AttributeValue &value) { bool ok = checker->Check (value); diff --git a/src/core/model/object-base.h b/src/core/model/object-base.h index fa8d5ed41..811c9510c 100644 --- a/src/core/model/object-base.h +++ b/src/core/model/object-base.h @@ -29,13 +29,13 @@ * defines a new GetTypeId method. */ #define NS_OBJECT_ENSURE_REGISTERED(type) \ - static struct X##type##RegistrationClass \ + static struct X## type ## RegistrationClass \ { \ - X##type##RegistrationClass () { \ + X ## type ## RegistrationClass () { \ ns3::TypeId tid = type::GetTypeId (); \ tid.GetParent (); \ } \ -} x_##type##RegistrationVariable + } x_ ## type ## RegistrationVariable namespace ns3 { diff --git a/src/core/model/object-factory.cc b/src/core/model/object-factory.cc index 8c7f6158d..4cff279ec 100644 --- a/src/core/model/object-factory.cc +++ b/src/core/model/object-factory.cc @@ -23,24 +23,25 @@ namespace ns3 { ObjectFactory::ObjectFactory () -{} +{ +} -void +void ObjectFactory::SetTypeId (TypeId tid) { m_tid = tid; } -void +void ObjectFactory::SetTypeId (std::string tid) { m_tid = TypeId::LookupByName (tid); } -void +void ObjectFactory::SetTypeId (const char *tid) { m_tid = TypeId::LookupByName (tid); } -void +void ObjectFactory::Set (std::string name, const AttributeValue &value) { if (name == "") diff --git a/src/core/model/object-factory.h b/src/core/model/object-factory.h index d08977fd2..f3ce24be7 100644 --- a/src/core/model/object-factory.h +++ b/src/core/model/object-factory.h @@ -47,11 +47,11 @@ public: void SetTypeId (TypeId tid); /** * \param tid the TypeId of the object to instantiate. - */ + */ void SetTypeId (const char *tid); /** * \param tid the TypeId of the object to instantiate. - */ + */ void SetTypeId (std::string tid); /** * \param name the name of the attribute to set during object construction diff --git a/src/core/model/object-vector.cc b/src/core/model/object-vector.cc index 663b34dc4..b2693ac44 100644 --- a/src/core/model/object-vector.cc +++ b/src/core/model/object-vector.cc @@ -3,24 +3,25 @@ namespace ns3 { ObjectVectorValue::ObjectVectorValue () -{} +{ +} -ObjectVectorValue::Iterator +ObjectVectorValue::Iterator ObjectVectorValue::Begin (void) const { return m_objects.begin (); } -ObjectVectorValue::Iterator +ObjectVectorValue::Iterator ObjectVectorValue::End (void) const { return m_objects.end (); } -uint32_t +uint32_t ObjectVectorValue::GetN (void) const { return m_objects.size (); } -Ptr +Ptr ObjectVectorValue::Get (uint32_t i) const { return m_objects[i]; @@ -39,9 +40,9 @@ ObjectVectorValue::SerializeToString (Ptr checker) const { oss << m_objects[i]; if (i != m_objects.size () - 1) - { - oss << " "; - } + { + oss << " "; + } } return oss.str (); } diff --git a/src/core/model/object-vector.h b/src/core/model/object-vector.h index edf80e9fb..c41a546da 100644 --- a/src/core/model/object-vector.h +++ b/src/core/model/object-vector.h @@ -56,13 +56,13 @@ MakeObjectVectorAccessor (U T::*memberVector); template Ptr -MakeObjectVectorAccessor (Ptr (T::*get) (INDEX) const, - INDEX (T::*getN) (void) const); +MakeObjectVectorAccessor (Ptr (T::*get)(INDEX) const, + INDEX (T::*getN)(void) const); template Ptr -MakeObjectVectorAccessor (INDEX (T::*getN) (void) const, - Ptr (T::*get) (INDEX) const); +MakeObjectVectorAccessor (INDEX (T::*getN)(void) const, + Ptr (T::*get)(INDEX) const); class ObjectVectorChecker : public AttributeChecker { @@ -106,10 +106,10 @@ public: ObjectVectorValue *dst = dynamic_cast (&destination); if (src == 0 || dst == 0) { - return false; + return false; } *dst = *src; - return true; + return true; } }; @@ -137,9 +137,9 @@ MakeObjectVectorAccessor (U T::*memberVector) virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const { const T *obj = dynamic_cast (object); if (obj == 0) - { - return false; - } + { + return false; + } *n = (obj->*m_memberVector).size (); return true; } @@ -149,13 +149,13 @@ MakeObjectVectorAccessor (U T::*memberVector) typename U::const_iterator end = (obj->*m_memberVector).end (); uint32_t k = 0; for (typename U::const_iterator j = begin; j != end; j++, k++) - { - if (k == i) - { - return *j; - break; - } - } + { + if (k == i) + { + return *j; + break; + } + } NS_ASSERT (false); // quiet compiler. return 0; @@ -168,26 +168,26 @@ MakeObjectVectorAccessor (U T::*memberVector) template Ptr -MakeObjectVectorAccessor (Ptr (T::*get) (INDEX) const, - INDEX (T::*getN) (void) const) +MakeObjectVectorAccessor (Ptr (T::*get)(INDEX) const, + INDEX (T::*getN)(void) const) { struct MemberGetters : public ObjectVectorAccessor { virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const { const T *obj = dynamic_cast (object); if (obj == 0) - { - return false; - } - *n = (obj->*m_getN) (); + { + return false; + } + *n = (obj->*m_getN)(); return true; } virtual Ptr DoGet (const ObjectBase *object, uint32_t i) const { const T *obj = static_cast (object); - return (obj->*m_get) (i); + return (obj->*m_get)(i); } - Ptr (T::*m_get) (INDEX) const; - INDEX (T::*m_getN) (void) const; + Ptr (T::*m_get)(INDEX) const; + INDEX (T::*m_getN)(void) const; } *spec = new MemberGetters (); spec->m_get = get; spec->m_getN = getN; @@ -196,8 +196,8 @@ MakeObjectVectorAccessor (Ptr (T::*get) (INDEX) const, template Ptr -MakeObjectVectorAccessor (INDEX (T::*getN) (void) const, - Ptr (T::*get) (INDEX) const) +MakeObjectVectorAccessor (INDEX (T::*getN)(void) const, + Ptr (T::*get)(INDEX) const) { return MakeObjectVectorAccessor (get, getN); } diff --git a/src/core/model/object.cc b/src/core/model/object.cc index a8f01d890..e64f9d93d 100644 --- a/src/core/model/object.cc +++ b/src/core/model/object.cc @@ -43,14 +43,15 @@ NS_OBJECT_ENSURE_REGISTERED (Object); Object::AggregateIterator::AggregateIterator () : m_object (0), m_current (0) -{} +{ +} -bool +bool Object::AggregateIterator::HasNext (void) const { return m_current < m_object->m_aggregates->n; } -Ptr +Ptr Object::AggregateIterator::Next (void) { Object *object = m_object->m_aggregates->buffer[m_current]; @@ -60,21 +61,22 @@ Object::AggregateIterator::Next (void) Object::AggregateIterator::AggregateIterator (Ptr object) : m_object (object), m_current (0) -{} +{ +} -TypeId +TypeId Object::GetInstanceTypeId (void) const { return m_tid; } -TypeId +TypeId Object::GetTypeId (void) { static TypeId tid = TypeId ("ns3::Object") .SetParent () - ; + ; return tid; } @@ -83,7 +85,7 @@ Object::Object () : m_tid (Object::GetTypeId ()), m_disposed (false), m_started (false), - m_aggregates ((struct Aggregates *)malloc (sizeof (struct Aggregates))), + m_aggregates ((struct Aggregates *) malloc (sizeof (struct Aggregates))), m_getObjectCount (0) { m_aggregates->n = 1; @@ -116,7 +118,7 @@ Object::Object (const Object &o) : m_tid (o.m_tid), m_disposed (false), m_started (false), - m_aggregates ((struct Aggregates *)malloc (sizeof (struct Aggregates))), + m_aggregates ((struct Aggregates *) malloc (sizeof (struct Aggregates))), m_getObjectCount (0) { m_aggregates->n = 1; @@ -172,7 +174,7 @@ Object::Start (void) * object at the end of the array. To be safe, we restart iteration over the * array whenever we call some user code, just in case. */ - restart: +restart: uint32_t n = m_aggregates->n; for (uint32_t i = 0; i < n; i++) { @@ -196,7 +198,7 @@ Object::Dispose (void) * So, to be safe, we restart the iteration over the array whenever we call some * user code. */ - restart: +restart: uint32_t n = m_aggregates->n; for (uint32_t i = 0; i < n; i++) { diff --git a/src/core/model/object.h b/src/core/model/object.h index 3b8333d10..f168872ed 100644 --- a/src/core/model/object.h +++ b/src/core/model/object.h @@ -76,7 +76,7 @@ public: */ class AggregateIterator { - public: +public: AggregateIterator (); /** @@ -89,7 +89,7 @@ public: * \returns the next aggregated object. */ Ptr Next (void); - private: +private: friend class Object; AggregateIterator (Ptr object); Ptr m_object; @@ -123,7 +123,7 @@ public: * * Note that you can call Dispose many times on the same object or * different objects aggregated together, and DoDispose will be - * called only once for each aggregated object. + * called only once for each aggregated object. * * This method is typically used to break reference cycles. */ @@ -164,13 +164,13 @@ public: void Start (void); protected: - /** - * This method is invoked whenever two sets of objects are aggregated together. - * It is invoked exactly once for each object in both sets. - * This method can be overriden by subclasses who wish to be notified of aggregation - * events. These subclasses must chain up to their base class NotifyNewAggregate method. - * It is safe to call GetObject and AggregateObject from within this method. - */ + /** + * This method is invoked whenever two sets of objects are aggregated together. + * It is invoked exactly once for each object in both sets. + * This method can be overriden by subclasses who wish to be notified of aggregation + * events. These subclasses must chain up to their base class NotifyNewAggregate method. + * It is safe to call GetObject and AggregateObject from within this method. + */ virtual void NotifyNewAggregate (void); /** * This method is called only once by Object::Start. If the user @@ -259,14 +259,14 @@ private: * keep track of the type of this object instance. */ void SetTypeId (TypeId tid); - /** - * \param attributes the attribute values used to initialize - * the member variables of this object's instance. - * - * Invoked from ns3::ObjectFactory::Create and ns3::CreateObject only. - * Initialize all the member variables which were - * registered with the associated TypeId. - */ + /** + * \param attributes the attribute values used to initialize + * the member variables of this object's instance. + * + * Invoked from ns3::ObjectFactory::Create and ns3::CreateObject only. + * Initialize all the member variables which were + * registered with the associated TypeId. + */ void Construct (const AttributeList &attributes); void UpdateSortedArray (struct Aggregates *aggregates, uint32_t i) const; @@ -359,15 +359,15 @@ Ptr CreateObjectWithAttributes (const AttributeList &attributes); template Ptr CreateObjectWithAttributes (std::string n1 = "", const AttributeValue & v1 = EmptyAttributeValue (), - std::string n2 = "", const AttributeValue & v2 = EmptyAttributeValue (), - std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (), - std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (), - std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (), - std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (), - std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (), - std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (), - std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ()); - + std::string n2 = "", const AttributeValue & v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (), + std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (), + std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (), + std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (), + std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (), + std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (), + std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ()); + } // namespace ns3 @@ -449,20 +449,20 @@ Ptr CreateObjectWithAttributes (const AttributeList &attributes) Ptr p = Ptr (new T (), false); p->SetTypeId (T::GetTypeId ()); p->Object::Construct (attributes); - return p; + return p; } template Ptr -CreateObjectWithAttributes (std::string n1 , const AttributeValue & v1, - std::string n2 , const AttributeValue & v2, - std::string n3 , const AttributeValue & v3, - std::string n4 , const AttributeValue & v4, - std::string n5 , const AttributeValue & v5, - std::string n6 , const AttributeValue & v6, - std::string n7 , const AttributeValue & v7, - std::string n8 , const AttributeValue & v8, - std::string n9 , const AttributeValue & v9) +CreateObjectWithAttributes (std::string n1, const AttributeValue & v1, + std::string n2, const AttributeValue & v2, + std::string n3, const AttributeValue & v3, + std::string n4, const AttributeValue & v4, + std::string n5, const AttributeValue & v5, + std::string n6, const AttributeValue & v6, + std::string n7, const AttributeValue & v7, + std::string n8, const AttributeValue & v8, + std::string n9, const AttributeValue & v9) { AttributeList attributes; if (n1 == "") @@ -510,7 +510,7 @@ CreateObjectWithAttributes (std::string n1 , const AttributeValue & v1, goto end; } attributes.SetWithTid (T::GetTypeId (), n9, v9); - end: +end: return CreateObjectWithAttributes (attributes); } diff --git a/src/core/model/pointer.cc b/src/core/model/pointer.cc index f941d6089..c4f4607de 100644 --- a/src/core/model/pointer.cc +++ b/src/core/model/pointer.cc @@ -23,30 +23,32 @@ namespace ns3 { PointerValue::PointerValue () : m_value () -{} +{ +} PointerValue::PointerValue (Ptr object) : m_value (object) -{} +{ +} -void +void PointerValue::SetObject (Ptr object) { m_value = object; } -Ptr +Ptr PointerValue::GetObject (void) const { return m_value; } -Ptr +Ptr PointerValue::Copy (void) const { return Create (*this); } -std::string +std::string PointerValue::SerializeToString (Ptr checker) const { std::ostringstream oss; diff --git a/src/core/model/pointer.h b/src/core/model/pointer.h index 4b0e4d671..04657f2d0 100644 --- a/src/core/model/pointer.h +++ b/src/core/model/pointer.h @@ -87,16 +87,16 @@ class APointerChecker : public PointerChecker const PointerValue *value = dynamic_cast (&val); if (value == 0) { - return false; + return false; } if (value->GetObject () == 0) { - return true; + return true; } T *ptr = dynamic_cast (PeekPointer (value->GetObject ())); if (ptr == 0) { - return false; + return false; } return true; } diff --git a/src/core/model/ptr.h b/src/core/model/ptr.h index 0c6c25bac..8486629cd 100644 --- a/src/core/model/ptr.h +++ b/src/core/model/ptr.h @@ -61,7 +61,7 @@ class Ptr private: T *m_ptr; class Tester { - private: +private: void operator delete (void *); }; friend class Ptr; @@ -86,12 +86,12 @@ public: * same, so that object is deleted if no more references to it * remain. */ - Ptr (T *ptr); + Ptr (T *ptr); /** * \param ptr raw pointer to manage * \param ref if set to true, this method calls Ref, otherwise, * it does not call Ref. - * + * * Create a smart pointer which points to the object pointed to by * the input raw pointer ptr. */ @@ -223,9 +223,9 @@ struct EventMemberImplObjTraits > namespace ns3 { - /************************************************* - * friend non-member function implementations - ************************************************/ +/************************************************* + * friend non-member function implementations + ************************************************/ template Ptr Create (void) @@ -408,23 +408,24 @@ Ptr::Acquire (void) const if (m_ptr != 0) { m_ptr->Ref (); - } + } } template Ptr::Ptr () : m_ptr (0) -{} +{ +} template -Ptr::Ptr (T *ptr) +Ptr::Ptr (T *ptr) : m_ptr (ptr) { Acquire (); } template -Ptr::Ptr (T *ptr, bool ref) +Ptr::Ptr (T *ptr, bool ref) : m_ptr (ptr) { if (ref) diff --git a/src/core/model/realtime-simulator-impl.cc b/src/core/model/realtime-simulator-impl.cc index 9a9df2ee6..6acb7ddee 100644 --- a/src/core/model/realtime-simulator-impl.cc +++ b/src/core/model/realtime-simulator-impl.cc @@ -58,7 +58,7 @@ RealtimeSimulatorImpl::GetTypeId (void) TimeValue (Seconds (0.1)), MakeTimeAccessor (&RealtimeSimulatorImpl::m_hardLimit), MakeTimeChecker ()) - ; + ; return tid; } @@ -86,7 +86,8 @@ RealtimeSimulatorImpl::RealtimeSimulatorImpl () } RealtimeSimulatorImpl::~RealtimeSimulatorImpl () -{} +{ +} void RealtimeSimulatorImpl::DoDispose (void) @@ -155,7 +156,7 @@ RealtimeSimulatorImpl::ProcessOneEvent (void) NS_LOG_FUNCTION_NOARGS (); // // The idea here is to wait until the next event comes due. In the case of - // a realtime simulation, we want real time to be consumed between events. + // a realtime simulation, we want real time to be consumed between events. // It is the realtime synchronizer that causes real time to be consumed by // doing some kind of a wait. // @@ -205,7 +206,7 @@ RealtimeSimulatorImpl::ProcessOneEvent (void) // time so we need to be careful about that and not delay in that case. // NS_ASSERT_MSG (m_synchronizer->Realtime (), - "RealtimeSimulatorImpl::ProcessOneEvent (): Synchronizer reports not Realtime ()"); + "RealtimeSimulatorImpl::ProcessOneEvent (): Synchronizer reports not Realtime ()"); // // tsNow is set to the normalized current real time. When the simulation was @@ -234,7 +235,7 @@ RealtimeSimulatorImpl::ProcessOneEvent (void) { tsDelay = tsNext - tsNow; } - + // // We've figured out how long we need to delay in order to pace the // simulation time with the real time. We're going to sleep, but need @@ -274,7 +275,7 @@ RealtimeSimulatorImpl::ProcessOneEvent (void) // attempting to sleep until its due. If we've slept until the timestamp is due, // Synchronize returns true and we break out of the sync loop. If an external // event happens that requires a re-schedule, Synchronize returns false and - // we re-evaluate our timing by continuing in the loop. + // we re-evaluate our timing by continuing in the loop. // // It is expected that tsDelay become shorter as external events interrupt our // waits. @@ -313,7 +314,7 @@ RealtimeSimulatorImpl::ProcessOneEvent (void) // mess with us. // NS_ASSERT_MSG (m_events->IsEmpty () == false, - "RealtimeSimulatorImpl::ProcessOneEvent(): event queue is empty"); + "RealtimeSimulatorImpl::ProcessOneEvent(): event queue is empty"); next = m_events->RemoveNext (); m_unscheduledEvents--; @@ -400,7 +401,7 @@ RealtimeSimulatorImpl::NextTs (void) const { NS_LOG_FUNCTION_NOARGS (); NS_ASSERT_MSG (m_events->IsEmpty () == false, - "RealtimeSimulatorImpl::NextTs(): event queue is empty"); + "RealtimeSimulatorImpl::NextTs(): event queue is empty"); Scheduler::Event ev = m_events->PeekNext (); return ev.key.m_ts; } @@ -461,7 +462,7 @@ RealtimeSimulatorImpl::Run (void) CriticalSection cs (m_mutex); NS_ASSERT_MSG (m_events->IsEmpty () == false || m_unscheduledEvents == 0, - "RealtimeSimulatorImpl::Run(): Empty queue and unprocessed events"); + "RealtimeSimulatorImpl::Run(): Empty queue and unprocessed events"); } m_running = false; @@ -628,7 +629,7 @@ void RealtimeSimulatorImpl::ScheduleRealtimeWithContext (uint32_t context, Time const &time, EventImpl *impl) { NS_LOG_FUNCTION (context << time << impl); - + { CriticalSection cs (m_mutex); @@ -743,7 +744,7 @@ RealtimeSimulatorImpl::Remove (const EventId &id) m_destroyEvents.erase (i); break; } - } + } return; } if (IsExpired (id)) @@ -759,7 +760,7 @@ RealtimeSimulatorImpl::Remove (const EventId &id) event.key.m_ts = id.GetTs (); event.key.m_context = id.GetContext (); event.key.m_uid = id.GetUid (); - + m_events->Remove (event); m_unscheduledEvents--; event.impl->Cancel (); @@ -794,7 +795,7 @@ RealtimeSimulatorImpl::IsExpired (const EventId &ev) const { return false; } - } + } return true; } @@ -853,7 +854,7 @@ RealtimeSimulatorImpl::GetSynchronizationMode (void) const NS_LOG_FUNCTION_NOARGS (); return m_synchronizationMode; } - + void RealtimeSimulatorImpl::SetHardLimit (Time limit) { @@ -867,5 +868,5 @@ RealtimeSimulatorImpl::GetHardLimit (void) const NS_LOG_FUNCTION_NOARGS (); return m_hardLimit; } - + }; // namespace ns3 diff --git a/src/core/model/ref-count-base.cc b/src/core/model/ref-count-base.cc index c89cc6a83..162f2faf0 100644 --- a/src/core/model/ref-count-base.cc +++ b/src/core/model/ref-count-base.cc @@ -3,6 +3,7 @@ namespace ns3 { RefCountBase::~RefCountBase () -{} +{ +} } // namespace ns3 diff --git a/src/core/model/rng-stream.cc b/src/core/model/rng-stream.cc index efcd06f49..1ef525878 100644 --- a/src/core/model/rng-stream.cc +++ b/src/core/model/rng-stream.cc @@ -42,52 +42,52 @@ const double fact = 5.9604644775390625e-8; /* 1 / 2^24 */ // (in matrix form), raised to the powers -1, 1, 2^76, and 2^127, resp. const double InvA1[3][3] = { // Inverse of A1p0 - { 184888585.0, 0.0, 1945170933.0 }, - { 1.0, 0.0, 0.0 }, - { 0.0, 1.0, 0.0 } - }; + { 184888585.0, 0.0, 1945170933.0 }, + { 1.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0 } +}; const double InvA2[3][3] = { // Inverse of A2p0 - { 0.0, 360363334.0, 4225571728.0 }, - { 1.0, 0.0, 0.0 }, - { 0.0, 1.0, 0.0 } - }; + { 0.0, 360363334.0, 4225571728.0 }, + { 1.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0 } +}; const double A1p0[3][3] = { - { 0.0, 1.0, 0.0 }, - { 0.0, 0.0, 1.0 }, - { -810728.0, 1403580.0, 0.0 } - }; + { 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 1.0 }, + { -810728.0, 1403580.0, 0.0 } +}; const double A2p0[3][3] = { - { 0.0, 1.0, 0.0 }, - { 0.0, 0.0, 1.0 }, - { -1370589.0, 0.0, 527612.0 } - }; + { 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 1.0 }, + { -1370589.0, 0.0, 527612.0 } +}; const double A1p76[3][3] = { - { 82758667.0, 1871391091.0, 4127413238.0 }, - { 3672831523.0, 69195019.0, 1871391091.0 }, - { 3672091415.0, 3528743235.0, 69195019.0 } - }; + { 82758667.0, 1871391091.0, 4127413238.0 }, + { 3672831523.0, 69195019.0, 1871391091.0 }, + { 3672091415.0, 3528743235.0, 69195019.0 } +}; const double A2p76[3][3] = { - { 1511326704.0, 3759209742.0, 1610795712.0 }, - { 4292754251.0, 1511326704.0, 3889917532.0 }, - { 3859662829.0, 4292754251.0, 3708466080.0 } - }; + { 1511326704.0, 3759209742.0, 1610795712.0 }, + { 4292754251.0, 1511326704.0, 3889917532.0 }, + { 3859662829.0, 4292754251.0, 3708466080.0 } +}; const double A1p127[3][3] = { - { 2427906178.0, 3580155704.0, 949770784.0 }, - { 226153695.0, 1230515664.0, 3580155704.0 }, - { 1988835001.0, 986791581.0, 1230515664.0 } - }; + { 2427906178.0, 3580155704.0, 949770784.0 }, + { 226153695.0, 1230515664.0, 3580155704.0 }, + { 1988835001.0, 986791581.0, 1230515664.0 } +}; const double A2p127[3][3] = { - { 1464411153.0, 277697599.0, 1610723613.0 }, - { 32183930.0, 1464411153.0, 1022607788.0 }, - { 2824425944.0, 32183930.0, 2093834863.0 } - }; + { 1464411153.0, 277697599.0, 1610723613.0 }, + { 32183930.0, 1464411153.0, 1022607788.0 }, + { 2824425944.0, 32183930.0, 2093834863.0 } +}; @@ -96,21 +96,21 @@ const double A2p127[3][3] = { // double MultModM (double a, double s, double c, double m) { - double v; - int32_t a1; + double v; + int32_t a1; - v = a * s + c; + v = a * s + c; - if (v >= two53 || v <= -two53) { - a1 = static_cast (a / two17); a -= a1 * two17; - v = a1 * s; - a1 = static_cast (v / m); v -= a1 * m; - v = v * two17 + a * s + c; + if (v >= two53 || v <= -two53) { + a1 = static_cast (a / two17); a -= a1 * two17; + v = a1 * s; + a1 = static_cast (v / m); v -= a1 * m; + v = v * two17 + a * s + c; } - a1 = static_cast (v / m); - /* in case v < 0)*/ - if ((v -= a1 * m) < 0.0) return v += m; else return v; + a1 = static_cast (v / m); + /* in case v < 0)*/ + if ((v -= a1 * m) < 0.0) return v += m;else return v; } @@ -121,16 +121,16 @@ double MultModM (double a, double s, double c, double m) void MatVecModM (const double A[3][3], const double s[3], double v[3], double m) { - int i; - double x[3]; // Necessary if v = s + int i; + double x[3]; // Necessary if v = s - for (i = 0; i < 3; ++i) { - x[i] = MultModM (A[i][0], s[0], 0.0, m); - x[i] = MultModM (A[i][1], s[1], x[i], m); - x[i] = MultModM (A[i][2], s[2], x[i], m); + for (i = 0; i < 3; ++i) { + x[i] = MultModM (A[i][0], s[0], 0.0, m); + x[i] = MultModM (A[i][1], s[1], x[i], m); + x[i] = MultModM (A[i][2], s[2], x[i], m); } - for (i = 0; i < 3; ++i) - v[i] = x[i]; + for (i = 0; i < 3; ++i) + v[i] = x[i]; } @@ -141,19 +141,19 @@ void MatVecModM (const double A[3][3], const double s[3], double v[3], void MatMatModM (const double A[3][3], const double B[3][3], double C[3][3], double m) { - int i, j; - double V[3], W[3][3]; + int i, j; + double V[3], W[3][3]; - for (i = 0; i < 3; ++i) { - for (j = 0; j < 3; ++j) - V[j] = B[j][i]; - MatVecModM (A, V, V, m); - for (j = 0; j < 3; ++j) - W[j][i] = V[j]; + for (i = 0; i < 3; ++i) { + for (j = 0; j < 3; ++j) + V[j] = B[j][i]; + MatVecModM (A, V, V, m); + for (j = 0; j < 3; ++j) + W[j][i] = V[j]; } - for (i = 0; i < 3; ++i) - for (j = 0; j < 3; ++j) - C[i][j] = W[i][j]; + for (i = 0; i < 3; ++i) + for (j = 0; j < 3; ++j) + C[i][j] = W[i][j]; } @@ -162,17 +162,17 @@ void MatMatModM (const double A[3][3], const double B[3][3], // void MatTwoPowModM (const double A[3][3], double B[3][3], double m, int32_t e) { - int i, j; + int i, j; - /* initialize: B = A */ - if (A != B) { + /* initialize: B = A */ + if (A != B) { for (i = 0; i < 3; ++i) - for (j = 0; j < 3; ++j) - B[i][j] = A[i][j]; - } - /* Compute B = A^(2^e) mod m */ - for (i = 0; i < e; i++) - MatMatModM (B, B, B, m); + for (j = 0; j < 3; ++j) + B[i][j] = A[i][j]; + } + /* Compute B = A^(2^e) mod m */ + for (i = 0; i < e; i++) + MatMatModM (B, B, B, m); } @@ -181,23 +181,23 @@ void MatTwoPowModM (const double A[3][3], double B[3][3], double m, int32_t e) // void MatPowModM (const double A[3][3], double B[3][3], double m, int32_t n) { - int i, j; - double W[3][3]; + int i, j; + double W[3][3]; - /* initialize: W = A; B = I */ - for (i = 0; i < 3; ++i) - for (j = 0; j < 3; ++j) { - W[i][j] = A[i][j]; - B[i][j] = 0.0; - } - for (j = 0; j < 3; ++j) - B[j][j] = 1.0; + /* initialize: W = A; B = I */ + for (i = 0; i < 3; ++i) + for (j = 0; j < 3; ++j) { + W[i][j] = A[i][j]; + B[i][j] = 0.0; + } + for (j = 0; j < 3; ++j) + B[j][j] = 1.0; - /* Compute B = A^n mod m using the binary decomposition of n */ - while (n > 0) { - if (n % 2) MatMatModM (W, B, B, m); - MatMatModM (W, W, W, m); - n /= 2; + /* Compute B = A^n mod m using the binary decomposition of n */ + while (n > 0) { + if (n % 2) MatMatModM (W, B, B, m); + MatMatModM (W, W, W, m); + n /= 2; } } @@ -214,33 +214,33 @@ static ns3::GlobalValue g_rngRun ("RngRun", } // end of anonymous namespace -namespace ns3{ +namespace ns3 { //------------------------------------------------------------------------- // Generate the next random number. // double RngStream::U01 () { - int32_t k; - double p1, p2, u; + int32_t k; + double p1, p2, u; - /* Component 1 */ - p1 = a12 * Cg[1] - a13n * Cg[0]; - k = static_cast (p1 / m1); - p1 -= k * m1; - if (p1 < 0.0) p1 += m1; - Cg[0] = Cg[1]; Cg[1] = Cg[2]; Cg[2] = p1; + /* Component 1 */ + p1 = a12 * Cg[1] - a13n * Cg[0]; + k = static_cast (p1 / m1); + p1 -= k * m1; + if (p1 < 0.0) p1 += m1; + Cg[0] = Cg[1]; Cg[1] = Cg[2]; Cg[2] = p1; - /* Component 2 */ - p2 = a21 * Cg[5] - a23n * Cg[3]; - k = static_cast (p2 / m2); - p2 -= k * m2; - if (p2 < 0.0) p2 += m2; - Cg[3] = Cg[4]; Cg[4] = Cg[5]; Cg[5] = p2; + /* Component 2 */ + p2 = a21 * Cg[5] - a23n * Cg[3]; + k = static_cast (p2 / m2); + p2 -= k * m2; + if (p2 < 0.0) p2 += m2; + Cg[3] = Cg[4]; Cg[4] = Cg[5]; Cg[5] = p2; - /* Combination */ - u = ((p1 > p2) ? (p1 - p2) * norm : (p1 - p2 + m1) * norm); + /* Combination */ + u = ((p1 > p2) ? (p1 - p2) * norm : (p1 - p2 + m1) * norm); - return (anti == false) ? u : (1 - u); + return (anti == false) ? u : (1 - u); } @@ -249,15 +249,15 @@ double RngStream::U01 () // double RngStream::U01d () { - double u; - u = U01(); - if (anti) { - // Don't forget that U01() returns 1 - u in the antithetic case - u += (U01() - 1.0) * fact; - return (u < 0.0) ? u + 1.0 : u; + double u; + u = U01(); + if (anti) { + // Don't forget that U01() returns 1 - u in the antithetic case + u += (U01() - 1.0) * fact; + return (u < 0.0) ? u + 1.0 : u; } else { - u += U01() * fact; - return (u < 1.0) ? u : (u - 1.0); + u += U01() * fact; + return (u < 1.0) ? u : (u - 1.0); } } @@ -267,38 +267,38 @@ double RngStream::U01d () // bool RngStream::CheckSeed (const uint32_t seed[6]) { - int i; + int i; - for (i = 0; i < 3; ++i) { - if (seed[i] >= m1) { - cerr << "****************************************\n\n" - << "ERROR: Seed[" << i << "] >= 4294967087, Seed is not set." - << "\n\n****************************************\n\n"; - return (false); + for (i = 0; i < 3; ++i) { + if (seed[i] >= m1) { + cerr << "****************************************\n\n" + << "ERROR: Seed[" << i << "] >= 4294967087, Seed is not set." + << "\n\n****************************************\n\n"; + return (false); } } - for (i = 3; i < 6; ++i) { - if (seed[i] >= m2) { - cerr << "Seed[" << i << "] = " << seed[i] << endl; + for (i = 3; i < 6; ++i) { + if (seed[i] >= m2) { + cerr << "Seed[" << i << "] = " << seed[i] << endl; cerr << "*****************************************\n\n" << "ERROR: Seed[" << i << "] >= 4294944443, Seed is not set." << "\n\n*****************************************\n\n"; return (false); } } - if (seed[0] == 0 && seed[1] == 0 && seed[2] == 0) { - cerr << "****************************\n\n" - << "ERROR: First 3 seeds = 0.\n\n" - << "****************************\n\n"; - return (false); + if (seed[0] == 0 && seed[1] == 0 && seed[2] == 0) { + cerr << "****************************\n\n" + << "ERROR: First 3 seeds = 0.\n\n" + << "****************************\n\n"; + return (false); } - if (seed[3] == 0 && seed[4] == 0 && seed[5] == 0) { - cerr << "****************************\n\n" - << "ERROR: Last 3 seeds = 0.\n\n" - << "****************************\n\n"; - return (false); + if (seed[3] == 0 && seed[4] == 0 && seed[5] == 0) { + cerr << "****************************\n\n" + << "ERROR: Last 3 seeds = 0.\n\n" + << "****************************\n\n"; + return (false); } - return true; + return true; } uint32_t @@ -340,7 +340,7 @@ double RngStream::nextSeed[6] = RngStream::RngStream () { uint32_t run = EnsureGlobalInitialized (); - + anti = false; incPrec = false; // Stream initialization moved to separate method. @@ -354,12 +354,12 @@ RngStream::RngStream(const RngStream& r) anti = r.anti; incPrec = r.incPrec; for (int i = 0; i < 6; ++i) { - Cg[i] = r.Cg[i]; - Bg[i] = r.Bg[i]; - Ig[i] = r.Ig[i]; - } + Cg[i] = r.Cg[i]; + Bg[i] = r.Bg[i]; + Ig[i] = r.Ig[i]; + } } - + void RngStream::InitializeStream() { // Moved from the RngStream constructor above to allow seeding @@ -373,8 +373,8 @@ void RngStream::InitializeStream() will be the seed of the next declared RngStream. */ for (int i = 0; i < 6; ++i) { - Bg[i] = Cg[i] = Ig[i] = nextSeed[i]; - } + Bg[i] = Cg[i] = Ig[i] = nextSeed[i]; + } MatVecModM (A1p127, nextSeed, nextSeed, m1); MatVecModM (A2p127, &nextSeed[3], &nextSeed[3], m2); @@ -417,10 +417,10 @@ void RngStream::ResetNextSubstream () void RngStream::ResetNthSubstream (uint32_t N) { if(N==0) return; - for(uint32_t i=0;i 0) { - MatTwoPowModM (A1p0, B1, m1, e); - MatTwoPowModM (A2p0, B2, m2, e); + if (e > 0) { + MatTwoPowModM (A1p0, B1, m1, e); + MatTwoPowModM (A2p0, B2, m2, e); } else if (e < 0) { - MatTwoPowModM (InvA1, B1, m1, -e); - MatTwoPowModM (InvA2, B2, m2, -e); + MatTwoPowModM (InvA1, B1, m1, -e); + MatTwoPowModM (InvA2, B2, m2, -e); } - if (c >= 0) { - MatPowModM (A1p0, C1, m1, c); - MatPowModM (A2p0, C2, m2, c); + if (c >= 0) { + MatPowModM (A1p0, C1, m1, c); + MatPowModM (A2p0, C2, m2, c); } else { - MatPowModM (InvA1, C1, m1, -c); - MatPowModM (InvA2, C2, m2, -c); + MatPowModM (InvA1, C1, m1, -c); + MatPowModM (InvA2, C2, m2, -c); } - if (e) { - MatMatModM (B1, C1, C1, m1); - MatMatModM (B2, C2, C2, m2); + if (e) { + MatMatModM (B1, C1, C1, m1); + MatMatModM (B2, C2, C2, m2); } - MatVecModM (C1, Cg, Cg, m1); - MatVecModM (C2, &Cg[3], &Cg[3], m2); + MatVecModM (C1, Cg, Cg, m1); + MatVecModM (C2, &Cg[3], &Cg[3], m2); } //------------------------------------------------------------------------- void RngStream::GetState (uint32_t seed[6]) const { - for (int i = 0; i < 6; ++i) - seed[i] = static_cast (Cg[i]); + for (int i = 0; i < 6; ++i) + seed[i] = static_cast (Cg[i]); } //------------------------------------------------------------------------- void RngStream::IncreasedPrecis (bool incp) { - incPrec = incp; + incPrec = incp; } //------------------------------------------------------------------------- void RngStream::SetAntithetic (bool a) { - anti = a; + anti = a; } @@ -547,10 +547,10 @@ void RngStream::SetAntithetic (bool a) // double RngStream::RandU01 () { - if (incPrec) - return U01d(); - else - return U01(); + if (incPrec) + return U01d(); + else + return U01(); } @@ -559,7 +559,7 @@ double RngStream::RandU01 () // int32_t RngStream::RandInt (int32_t low, int32_t high) { - return low + static_cast ((high - low + 1) * RandU01 ()); + return low + static_cast ((high - low + 1) * RandU01 ()); }; } //namespace ns3 diff --git a/src/core/model/rng-stream.h b/src/core/model/rng-stream.h index 19f6a787f..f698db9fc 100644 --- a/src/core/model/rng-stream.h +++ b/src/core/model/rng-stream.h @@ -33,7 +33,7 @@ namespace ns3 { * This class is the combined multiple-recursive random number * generator called MRG32k3a. The ns3::RandomVariableBase class * holds a static instance of this class. The details of this - * class are explained in: + * class are explained in: * http://www.iro.umontreal.ca/~lecuyer/myftp/papers/streams00.pdf */ class RngStream { diff --git a/src/core/model/simple-ref-count.h b/src/core/model/simple-ref-count.h index 8de374613..ed0d42488 100644 --- a/src/core/model/simple-ref-count.h +++ b/src/core/model/simple-ref-count.h @@ -97,7 +97,7 @@ public: } /** - * Get the reference count of the object. + * Get the reference count of the object. * Normally not needed; for language bindings. */ inline uint32_t GetReferenceCount (void) const diff --git a/src/core/model/simulation-singleton.h b/src/core/model/simulation-singleton.h index 8aa69a66f..8269e780f 100644 --- a/src/core/model/simulation-singleton.h +++ b/src/core/model/simulation-singleton.h @@ -45,7 +45,7 @@ private: static void DeleteObject (void); }; -}//namespace ns3 +} //namespace ns3 #include "simulator.h" diff --git a/src/core/model/simulator-impl.cc b/src/core/model/simulator-impl.cc index f65ccfd19..85db1c4ef 100644 --- a/src/core/model/simulator-impl.cc +++ b/src/core/model/simulator-impl.cc @@ -7,7 +7,7 @@ SimulatorImpl::GetTypeId (void) { static TypeId tid = TypeId ("ns3::SimulatorImpl") .SetParent () - ; + ; return tid; } diff --git a/src/core/model/simulator.cc b/src/core/model/simulator.cc index e517efaa0..729dc52a7 100644 --- a/src/core/model/simulator.cc +++ b/src/core/model/simulator.cc @@ -42,14 +42,14 @@ NS_LOG_COMPONENT_DEFINE ("Simulator"); namespace ns3 { GlobalValue g_simTypeImpl = GlobalValue ("SimulatorImplementationType", - "The object class to use as the simulator implementation", - StringValue ("ns3::DefaultSimulatorImpl"), - MakeStringChecker ()); + "The object class to use as the simulator implementation", + StringValue ("ns3::DefaultSimulatorImpl"), + MakeStringChecker ()); GlobalValue g_schedTypeImpl = GlobalValue ("SchedulerType", - "The object class to use as the scheduler implementation", - TypeIdValue (MapScheduler::GetTypeId ()), - MakeTypeIdChecker ()); + "The object class to use as the scheduler implementation", + TypeIdValue (MapScheduler::GetTypeId ()), + MakeTypeIdChecker ()); static void TimePrinter (std::ostream &os) @@ -87,7 +87,7 @@ static SimulatorImpl * GetImpl (void) { ObjectFactory factory; StringValue s; - + g_simTypeImpl.GetValue (s); factory.SetTypeId (s.Get ()); *pimpl = GetPointer (factory.Create ()); @@ -242,28 +242,28 @@ Simulator::DoScheduleDestroy (EventImpl *impl) EventId -Simulator::Schedule (Time const &time, void (*f) (void)) +Simulator::Schedule (Time const &time, void (*f)(void)) { NS_LOG_FUNCTION (time << f); return DoSchedule (time, MakeEvent (f)); } void -Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (void)) +Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(void)) { NS_LOG_FUNCTION (time << context << f); return ScheduleWithContext (context, time, MakeEvent (f)); } EventId -Simulator::ScheduleNow (void (*f) (void)) +Simulator::ScheduleNow (void (*f)(void)) { NS_LOG_FUNCTION (f); return DoScheduleNow (MakeEvent (f)); } EventId -Simulator::ScheduleDestroy (void (*f) (void)) +Simulator::ScheduleDestroy (void (*f)(void)) { NS_LOG_FUNCTION (f); return DoScheduleDestroy (MakeEvent (f)); diff --git a/src/core/model/simulator.h b/src/core/model/simulator.h index 88d32ff2c..c0d008d6d 100644 --- a/src/core/model/simulator.h +++ b/src/core/model/simulator.h @@ -146,7 +146,7 @@ public: * parameter * * When the event expires (when it becomes due to be run), the - * input method will be invoked on the input object. + * input method will be invoked on the input object. * * @param time the relative expiration time of the event. * @param mem_ptr member method pointer to invoke @@ -224,7 +224,7 @@ public: * @param f the function to invoke * @returns an id for the scheduled event. */ - static EventId Schedule (Time const &time, void (*f) (void)); + static EventId Schedule (Time const &time, void (*f)(void)); /** * @param time the relative expiration time of the event. @@ -233,7 +233,7 @@ public: * @returns an id for the scheduled event. */ template - static EventId Schedule (Time const &time, void (*f) (U1), T1 a1); + static EventId Schedule (Time const &time, void (*f)(U1), T1 a1); /** * @param time the relative expiration time of the event. @@ -243,7 +243,7 @@ public: * @returns an id for the scheduled event. */ template - static EventId Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2); + static EventId Schedule (Time const &time, void (*f)(U1,U2), T1 a1, T2 a2); /** * @param time the relative expiration time of the event. @@ -254,7 +254,7 @@ public: * @returns an id for the scheduled event. */ template - static EventId Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); + static EventId Schedule (Time const &time, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param time the relative expiration time of the event. @@ -267,7 +267,7 @@ public: */ template - static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); + static EventId Schedule (Time const &time, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param time the relative expiration time of the event. @@ -281,7 +281,7 @@ public: */ template - static EventId Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + static EventId Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * Schedule an event with the given context. @@ -357,13 +357,13 @@ public: template static void ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, - T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * @param time the relative expiration time of the event. * @param context user-specified context parameter * @param f the function to invoke */ - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (void)); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(void)); /** * @param time the relative expiration time of the event. @@ -372,7 +372,7 @@ public: * @param a1 the first argument to pass to the function to invoke */ template - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1), T1 a1); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1), T1 a1); /** * @param time the relative expiration time of the event. @@ -382,7 +382,7 @@ public: * @param a2 the second argument to pass to the function to invoke */ template - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2), T1 a1, T2 a2); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2), T1 a1, T2 a2); /** * @param time the relative expiration time of the event. @@ -393,7 +393,7 @@ public: * @param a3 the third argument to pass to the function to invoke */ template - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param time the relative expiration time of the event. @@ -406,7 +406,7 @@ public: */ template - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param time the relative expiration time of the event. @@ -420,7 +420,7 @@ public: */ template - static void ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + static void ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * Schedule an event to expire Now. All events scheduled to @@ -491,7 +491,7 @@ public: /** * @param f the function to invoke */ - static EventId ScheduleNow (void (*f) (void)); + static EventId ScheduleNow (void (*f)(void)); /** * @param f the function to invoke @@ -499,7 +499,7 @@ public: */ template - static EventId ScheduleNow (void (*f) (U1), T1 a1); + static EventId ScheduleNow (void (*f)(U1), T1 a1); /** * @param f the function to invoke @@ -508,7 +508,7 @@ public: */ template - static EventId ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2); + static EventId ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2); /** * @param f the function to invoke @@ -518,7 +518,7 @@ public: */ template - static EventId ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); + static EventId ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param f the function to invoke @@ -529,7 +529,7 @@ public: */ template - static EventId ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); + static EventId ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param f the function to invoke @@ -541,7 +541,7 @@ public: */ template - static EventId ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + static EventId ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * Schedule an event to expire at Destroy time. All events @@ -613,7 +613,7 @@ public: /** * @param f the function to invoke */ - static EventId ScheduleDestroy (void (*f) (void)); + static EventId ScheduleDestroy (void (*f)(void)); /** * @param f the function to invoke @@ -621,7 +621,7 @@ public: */ template - static EventId ScheduleDestroy (void (*f) (U1), T1 a1); + static EventId ScheduleDestroy (void (*f)(U1), T1 a1); /** * @param f the function to invoke @@ -630,7 +630,7 @@ public: */ template - static EventId ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2); + static EventId ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2); /** * @param f the function to invoke @@ -640,7 +640,7 @@ public: */ template - static EventId ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); + static EventId ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param f the function to invoke @@ -651,7 +651,7 @@ public: */ template - static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); + static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param f the function to invoke @@ -663,7 +663,7 @@ public: */ template - static EventId ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + static EventId ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * Remove an event from the event list. @@ -740,7 +740,7 @@ public: * This method will be typically used by language bindings * to delegate events to their own subclass of the EventImpl base class. */ - static EventId Schedule (Time const &time, const Ptr &event); + static EventId Schedule (Time const &time, const Ptr &event); /** * \param time delay until the event expires @@ -780,7 +780,7 @@ private: Simulator (); ~Simulator (); - static EventId DoSchedule (Time const &time, EventImpl *event); + static EventId DoSchedule (Time const &time, EventImpl *event); static EventId DoScheduleNow (EventImpl *event); static EventId DoScheduleDestroy (EventImpl *event); }; @@ -846,35 +846,35 @@ EventId Simulator::Schedule (Time const &time, MEM mem_ptr, OBJ obj, } template -EventId Simulator::Schedule (Time const &time, void (*f) (U1), T1 a1) +EventId Simulator::Schedule (Time const &time, void (*f)(U1), T1 a1) { return DoSchedule (time, MakeEvent (f, a1)); } template -EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2) +EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2), T1 a1, T2 a2) { return DoSchedule (time, MakeEvent (f, a1, a2)); } template -EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) +EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3) { return DoSchedule (time, MakeEvent (f, a1, a2, a3)); } template -EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) +EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4)); } template -EventId Simulator::Schedule (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +EventId Simulator::Schedule (Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return DoSchedule (time, MakeEvent (f, a1, a2, a3, a4, a5)); } @@ -920,41 +920,41 @@ void Simulator::ScheduleWithContext (uint32_t context, Time const &time, MEM mem template void Simulator::ScheduleWithContext (uint32_t context, Time const &time, MEM mem_ptr, OBJ obj, - T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) + T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return ScheduleWithContext (context, time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); } template -void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1), T1 a1) +void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1), T1 a1) { return ScheduleWithContext (context, time, MakeEvent (f, a1)); } template -void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2), T1 a1, T2 a2) +void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2), T1 a1, T2 a2) { return ScheduleWithContext (context, time, MakeEvent (f, a1, a2)); } template -void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) +void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3) { return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3)); } template -void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) +void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3, a4)); } template -void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +void Simulator::ScheduleWithContext (uint32_t context, Time const &time, void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return ScheduleWithContext (context, time, MakeEvent (f, a1, a2, a3, a4, a5)); } @@ -1014,7 +1014,7 @@ Simulator::ScheduleNow (MEM mem_ptr, OBJ obj, template EventId -Simulator::ScheduleNow (void (*f) (U1), T1 a1) +Simulator::ScheduleNow (void (*f)(U1), T1 a1) { return DoScheduleNow (MakeEvent (f, a1)); } @@ -1022,7 +1022,7 @@ Simulator::ScheduleNow (void (*f) (U1), T1 a1) template EventId -Simulator::ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2) +Simulator::ScheduleNow (void (*f)(U1,U2), T1 a1, T2 a2) { return DoScheduleNow (MakeEvent (f, a1, a2)); } @@ -1030,7 +1030,7 @@ Simulator::ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2) template EventId -Simulator::ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) +Simulator::ScheduleNow (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3) { return DoScheduleNow (MakeEvent (f, a1, a2, a3)); } @@ -1038,7 +1038,7 @@ Simulator::ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) template EventId -Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4)); } @@ -1046,7 +1046,7 @@ Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) template EventId -Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +Simulator::ScheduleNow (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return DoScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5)); } @@ -1105,7 +1105,7 @@ Simulator::ScheduleDestroy (MEM mem_ptr, OBJ obj, template EventId -Simulator::ScheduleDestroy (void (*f) (U1), T1 a1) +Simulator::ScheduleDestroy (void (*f)(U1), T1 a1) { return DoScheduleDestroy (MakeEvent (f, a1)); } @@ -1113,7 +1113,7 @@ Simulator::ScheduleDestroy (void (*f) (U1), T1 a1) template EventId -Simulator::ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2) +Simulator::ScheduleDestroy (void (*f)(U1,U2), T1 a1, T2 a2) { return DoScheduleDestroy (MakeEvent (f, a1, a2)); } @@ -1121,7 +1121,7 @@ Simulator::ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2) template EventId -Simulator::ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) +Simulator::ScheduleDestroy (void (*f)(U1,U2,U3), T1 a1, T2 a2, T3 a3) { return DoScheduleDestroy (MakeEvent (f, a1, a2, a3)); } @@ -1129,7 +1129,7 @@ Simulator::ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) template EventId -Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4)); } @@ -1137,7 +1137,7 @@ Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) template EventId -Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +Simulator::ScheduleDestroy (void (*f)(U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return DoScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5)); } diff --git a/src/core/model/synchronizer.cc b/src/core/model/synchronizer.cc index a28758191..f272b5604 100644 --- a/src/core/model/synchronizer.cc +++ b/src/core/model/synchronizer.cc @@ -27,7 +27,7 @@ Synchronizer::GetTypeId (void) { static TypeId tid = TypeId ("ns3::Synchronizer") .SetParent () - ; + ; return tid; } @@ -40,32 +40,32 @@ Synchronizer::~Synchronizer () { } - bool +bool Synchronizer::Realtime (void) { return DoRealtime (); } - uint64_t +uint64_t Synchronizer::GetCurrentRealtime (void) { return NanosecondToTimeStep (DoGetCurrentRealtime ()); } - void +void Synchronizer::SetOrigin (uint64_t ts) { m_simOriginNano = TimeStepToNanosecond (ts); DoSetOrigin (m_simOriginNano); } - uint64_t +uint64_t Synchronizer::GetOrigin (void) { return NanosecondToTimeStep (m_simOriginNano); } - int64_t +int64_t Synchronizer::GetDrift (uint64_t ts) { int64_t tDrift = DoGetDrift (TimeStepToNanosecond (ts)); @@ -75,47 +75,47 @@ Synchronizer::GetDrift (uint64_t ts) return -NanosecondToTimeStep (-tDrift); } else { return NanosecondToTimeStep (tDrift); - } + } } - bool +bool Synchronizer::Synchronize (uint64_t tsCurrent, uint64_t tsDelay) { return DoSynchronize (TimeStepToNanosecond (tsCurrent), - TimeStepToNanosecond (tsDelay)); + TimeStepToNanosecond (tsDelay)); } - void +void Synchronizer::Signal (void) { DoSignal (); } - void +void Synchronizer::SetCondition (bool cond) { DoSetCondition (cond); } - void +void Synchronizer::EventStart (void) { DoEventStart (); } - uint64_t +uint64_t Synchronizer::EventEnd (void) { return NanosecondToTimeStep (DoEventEnd ()); } - uint64_t +uint64_t Synchronizer::TimeStepToNanosecond (uint64_t ts) { return TimeStep (ts).GetNanoSeconds (); } - uint64_t +uint64_t Synchronizer::NanosecondToTimeStep (uint64_t ns) { return NanoSeconds (ns).GetTimeStep (); diff --git a/src/core/model/system-condition.h b/src/core/model/system-condition.h index 82e6c3fd6..2cfbe83c2 100644 --- a/src/core/model/system-condition.h +++ b/src/core/model/system-condition.h @@ -85,7 +85,7 @@ public: void Broadcast (void); /** - * Wait, possibly forever, for the condition to be true. + * Wait, possibly forever, for the condition to be true. */ void Wait (void); @@ -98,7 +98,7 @@ public: private: - SystemConditionPrivate * m_priv; + SystemConditionPrivate * m_priv; }; } //namespace ns3 diff --git a/src/core/model/system-mutex.h b/src/core/model/system-mutex.h index 95dbe484f..7fc298c40 100644 --- a/src/core/model/system-mutex.h +++ b/src/core/model/system-mutex.h @@ -64,7 +64,7 @@ public: void Unlock (); private: - SystemMutexPrivate * m_priv; + SystemMutexPrivate * m_priv; }; /** diff --git a/src/core/model/system-thread.h b/src/core/model/system-thread.h index ff7dbba14..55038017c 100644 --- a/src/core/model/system-thread.h +++ b/src/core/model/system-thread.h @@ -154,7 +154,7 @@ public: * * It is often the case that we want a thread to be off doing work until such * time as its job is done. We then want the thread to exit itself. This - * method allows a thread to query whether or not it should be running. + * method allows a thread to query whether or not it should be running. * Typically, the worker thread is running in a forever-loop, and will need to * "break" out of that loop to exit -- thus the name. * diff --git a/src/core/model/test.cc b/src/core/model/test.cc index 56b0e90d4..d863812bb 100644 --- a/src/core/model/test.cc +++ b/src/core/model/test.cc @@ -36,7 +36,7 @@ std::string ReplaceXmlSpecialCharacters (std::string xml) { std::string specials = "<>&\"'"; - std::string replacements[] = {"<", ">", "&", "'", """}; + std::string replacements[] = { "<", ">", "&", "'", """}; std::string result; std::size_t index, length = xml.length (); @@ -385,8 +385,8 @@ TestCase::DoReportEnd (void) const double MS_PER_SEC = 1000.; *m_ofs << " " << "real " << m_msClock.GetElapsedReal () / MS_PER_SEC - << " user " << m_msClock.GetElapsedUser () / MS_PER_SEC - << " system " << m_msClock.GetElapsedSystem () / MS_PER_SEC + << " user " << m_msClock.GetElapsedUser () / MS_PER_SEC + << " system " << m_msClock.GetElapsedSystem () / MS_PER_SEC << "" << std::endl; *m_ofs << " " << std::endl; @@ -604,7 +604,7 @@ void TestSuite::DoReportStart (void) { m_msClock.Start (); - + if (m_ofs == 0) { return; @@ -637,7 +637,7 @@ void TestSuite::DoReportEnd (void) { m_msClock.End (); - + if (m_ofs == 0) { return; @@ -649,8 +649,8 @@ TestSuite::DoReportEnd (void) const double MS_PER_SEC = 1000.; *m_ofs << " " << "real " << m_msClock.GetElapsedReal () / MS_PER_SEC - << " user " << m_msClock.GetElapsedUser () / MS_PER_SEC - << " system " << m_msClock.GetElapsedSystem () / MS_PER_SEC + << " user " << m_msClock.GetElapsedUser () / MS_PER_SEC + << " system " << m_msClock.GetElapsedSystem () / MS_PER_SEC << "" << std::endl; *m_ofs << "" << std::endl; diff --git a/src/core/model/test.h b/src/core/model/test.h index d719b4b98..098b51136 100644 --- a/src/core/model/test.h +++ b/src/core/model/test.h @@ -60,23 +60,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) == (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) == " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return; \ - } \ - } \ - } while (false) + if (!((actual) == (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) == " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return; \ + } \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -112,23 +112,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_EQ_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) == (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) == " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return true; \ - } \ - } \ - } while (false) + if (!((actual) == (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) == " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return true; \ + } \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -170,19 +170,19 @@ extern bool gBreakOnFailure; */ #define NS_TEST_EXPECT_MSG_EQ_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) == (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) == " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - } \ - } while (false) + if (!((actual) == (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) == " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -223,25 +223,25 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \ do { \ - if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit << " +- " << tol; \ - std::ostringstream condStream; \ - condStream << #actual << " (actual) < " << #limit << " (limit) + " << #tol << " (tol) && " << \ - #actual << " (actual) > " << #limit << " (limit) - " << #tol << " (tol)"; \ - ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return; \ - } \ - } \ - } while (false) + if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit << " +- " << tol; \ + std::ostringstream condStream; \ + condStream << # actual << " (actual) < " << # limit << " (limit) + " << # tol << " (tol) && " << \ + # actual << " (actual) > " << # limit << " (limit) - " << # tol << " (tol)"; \ + ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return; \ + } \ + } \ + } while (false) /** * \brief Test that actual and expected (limit) values are equal to plus or minus @@ -299,25 +299,25 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_EQ_TOL_RETURNS_BOOL_INTERNAL(actual, limit, tol, msg, file, line) \ do { \ - if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit << " +- " << tol; \ - std::ostringstream condStream; \ - condStream << #actual << " (actual) < " << #limit << " (limit) + " << #tol << " (tol) && " << \ - #actual << " (actual) > " << #limit << " (limit) - " << #tol << " (tol)"; \ - ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return true; \ - } \ - } \ - } while (false) + if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit << " +- " << tol; \ + std::ostringstream condStream; \ + condStream << # actual << " (actual) < " << # limit << " (limit) + " << # tol << " (tol) && " << \ + # actual << " (actual) > " << # limit << " (limit) - " << # tol << " (tol)"; \ + ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return true; \ + } \ + } \ + } while (false) /** * \brief Test that actual and expected (limit) values are equal to plus or minus @@ -381,21 +381,21 @@ extern bool gBreakOnFailure; */ #define NS_TEST_EXPECT_MSG_EQ_TOL_INTERNAL(actual, limit, tol, msg, file, line) \ do { \ - if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit << " +- " << tol; \ - std::ostringstream condStream; \ - condStream << #actual << " (actual) < " << #limit << " (limit) + " << #tol << " (tol) && " << \ - #actual << " (actual) > " << #limit << " (limit) - " << #tol << " (tol)"; \ - ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - } \ - } while (false) + if ((actual) > (limit) + (tol) || (actual) < (limit) - (tol)) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit << " +- " << tol; \ + std::ostringstream condStream; \ + condStream << # actual << " (actual) < " << # limit << " (limit) + " << # tol << " (tol) && " << \ + # actual << " (actual) > " << # limit << " (limit) - " << # tol << " (tol)"; \ + ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + } \ + } while (false) /** * \brief Test that actual and expected (limit) values are equal to plus or minus @@ -457,23 +457,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) != (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) != " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return; \ - } \ - } \ - } while (false) + if (!((actual) != (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) != " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return; \ + } \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -508,23 +508,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_NE_RETURNS_BOOL_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) != (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) != " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return true; \ - } \ - } \ - } while (false) + if (!((actual) != (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) != " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return true; \ + } \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -565,19 +565,19 @@ extern bool gBreakOnFailure; */ #define NS_TEST_EXPECT_MSG_NE_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) != (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) != " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - } \ - } while (false) + if (!((actual) != (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) != " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + } \ + } while (false) /** * \brief Test that an actual and expected (limit) value are equal and report @@ -616,23 +616,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) < (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) < " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return; \ - } \ - } \ - } while (false) + if (!((actual) < (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) < " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return; \ + } \ + } \ + } while (false) /** * \brief Test that an actual value is less than a limit and report and abort @@ -660,19 +660,19 @@ extern bool gBreakOnFailure; */ #define NS_TEST_EXPECT_MSG_LT_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) < (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) < " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - } \ - } while (false) + if (!((actual) < (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) < " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + } \ + } while (false) /** * \brief Test that an actual value is less than a limit and report if not. @@ -700,23 +700,23 @@ extern bool gBreakOnFailure; */ #define NS_TEST_ASSERT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) > (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReportTestFailure (std::string (#actual) + " (actual) > " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - if (!ContinueOnFailure ()) \ - { \ - return; \ - } \ - } \ - } while (false) + if (!((actual) > (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReportTestFailure (std::string (# actual) + " (actual) > " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + if (!ContinueOnFailure ()) \ + { \ + return; \ + } \ + } \ + } while (false) /** * \brief Test that an actual value is greater than a limit and report and abort @@ -744,19 +744,19 @@ extern bool gBreakOnFailure; */ #define NS_TEST_EXPECT_MSG_GT_INTERNAL(actual, limit, msg, file, line) \ do { \ - if (!((actual) > (limit))) \ - { \ - if (gBreakOnFailure) {*(int *)0 = 0;} \ - std::ostringstream msgStream; \ - msgStream << msg; \ - std::ostringstream actualStream; \ - actualStream << actual; \ - std::ostringstream limitStream; \ - limitStream << limit; \ - ReporTesttFailure (std::string (#actual) + " (actual) > " + std::string (#limit) + " (limit)", \ - actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ - } \ - } while (false) + if (!((actual) > (limit))) \ + { \ + if (gBreakOnFailure) { *(int *)0 = 0;} \ + std::ostringstream msgStream; \ + msgStream << msg; \ + std::ostringstream actualStream; \ + actualStream << actual; \ + std::ostringstream limitStream; \ + limitStream << limit; \ + ReporTesttFailure (std::string (# actual) + " (actual) > " + std::string (# limit) + " (limit)", \ + actualStream.str (), limitStream.str (), msgStream.str (), file, line); \ + } \ + } while (false) /** * \brief Test that an actual value is greater than a limit and report if not. @@ -795,7 +795,7 @@ namespace ns3 { * \param epsilon The second of double precision floating point numberss to compare * \returns Returns true if the doubles are equal to a precision defined by epsilon */ - bool TestDoubleIsEqual (const double a, const double b, const double epsilon = std::numeric_limits::epsilon ()); +bool TestDoubleIsEqual (const double a, const double b, const double epsilon = std::numeric_limits::epsilon ()); /** * \brief A single test case. @@ -843,7 +843,7 @@ public: /** * \brief Get the name of this test case. */ - std::string GetName (void); + std::string GetName (void); /** * \brief Set the base directory of the ns-3 distribution. @@ -962,7 +962,7 @@ public: * report the details. */ void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, - std::string file, int32_t line); + std::string file, int32_t line); /** * \brief Issue a test report than the test case has completed its run. @@ -993,7 +993,7 @@ protected: * \brief Implementation of reporting method for failure of the test case. */ virtual void DoReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, - std::string file, int32_t line); + std::string file, int32_t line); /** * \internal @@ -1133,7 +1133,7 @@ public: /** * \brief Get the name of this test suite. */ - std::string GetName (void); + std::string GetName (void); /** * \brief Set the base directory of the ns-3 distribution. @@ -1275,7 +1275,7 @@ private: std::ofstream *m_ofs; bool m_error; TestType m_type; - + typedef std::vector TestCaseVector_t; TestCaseVector_t m_tests; }; diff --git a/src/core/model/time.cc b/src/core/model/time.cc index d598018ec..ddf6008ff 100644 --- a/src/core/model/time.cc +++ b/src/core/model/time.cc @@ -84,7 +84,7 @@ Time::Time (const std::string& s) struct Time::Resolution Time::GetNsResolution (void) -{ +{ struct Resolution resolution; SetResolution (Time::NS, &resolution); return resolution; @@ -97,7 +97,7 @@ Time::SetResolution (enum Unit resolution) void Time::SetResolution (enum Unit unit, struct Resolution *resolution) { - int8_t power [LAST] = {15, 12, 9, 6, 3, 0}; + int8_t power [LAST] = { 15, 12, 9, 6, 3, 0}; for (int i = 0; i < Time::LAST; i++) { int shift = power[i] - power[(int)unit]; @@ -105,27 +105,27 @@ Time::SetResolution (enum Unit unit, struct Resolution *resolution) struct Information *info = &resolution->info[i]; info->factor = factor; if (shift == 0) - { - info->timeFrom = int64x64_t (1); - info->timeTo = int64x64_t (1); - info->toMul = true; - info->fromMul = true; - } + { + info->timeFrom = int64x64_t (1); + info->timeTo = int64x64_t (1); + info->toMul = true; + info->fromMul = true; + } else if (shift > 0) - { - info->timeFrom = int64x64_t (factor); - info->timeTo = int64x64_t::Invert (factor); - info->toMul = false; - info->fromMul = true; - } + { + info->timeFrom = int64x64_t (factor); + info->timeTo = int64x64_t::Invert (factor); + info->toMul = false; + info->fromMul = true; + } else - { - NS_ASSERT (shift < 0); - info->timeFrom = int64x64_t::Invert (factor); - info->timeTo = int64x64_t (factor); - info->toMul = true; - info->fromMul = false; - } + { + NS_ASSERT (shift < 0); + info->timeFrom = int64x64_t::Invert (factor); + info->timeTo = int64x64_t (factor); + info->toMul = true; + info->fromMul = false; + } } resolution->unit = unit; } diff --git a/src/core/model/trace-source-accessor.cc b/src/core/model/trace-source-accessor.cc index 7ffe93415..68a93c5ff 100644 --- a/src/core/model/trace-source-accessor.cc +++ b/src/core/model/trace-source-accessor.cc @@ -22,8 +22,10 @@ namespace ns3 { TraceSourceAccessor::TraceSourceAccessor () -{} +{ +} TraceSourceAccessor::~TraceSourceAccessor () -{} +{ +} } // namespace ns3 diff --git a/src/core/model/trace-source-accessor.h b/src/core/model/trace-source-accessor.h index b86224e26..9da846e07 100644 --- a/src/core/model/trace-source-accessor.h +++ b/src/core/model/trace-source-accessor.h @@ -92,38 +92,38 @@ DoMakeTraceSourceAccessor (SOURCE T::*a) virtual bool ConnectWithoutContext (ObjectBase *obj, const CallbackBase &cb) const { T *p = dynamic_cast (obj); if (p == 0) - { - return false; - } + { + return false; + } (p->*m_source).ConnectWithoutContext (cb); return true; } virtual bool Connect (ObjectBase *obj, std::string context, const CallbackBase &cb) const { T *p = dynamic_cast (obj); if (p == 0) - { - return false; - } + { + return false; + } (p->*m_source).Connect (cb, context); return true; } virtual bool DisconnectWithoutContext (ObjectBase *obj, const CallbackBase &cb) const { T *p = dynamic_cast (obj); if (p == 0) - { - return false; - } + { + return false; + } (p->*m_source).DisconnectWithoutContext (cb); - return true; + return true; } virtual bool Disconnect (ObjectBase *obj, std::string context, const CallbackBase &cb) const { T *p = dynamic_cast (obj); if (p == 0) - { - return false; - } + { + return false; + } (p->*m_source).Disconnect (cb, context); - return true; + return true; } SOURCE T::*m_source; } *accessor = new Accessor (); diff --git a/src/core/model/traced-callback.h b/src/core/model/traced-callback.h index 3610b595a..ddf16bc29 100644 --- a/src/core/model/traced-callback.h +++ b/src/core/model/traced-callback.h @@ -88,7 +88,7 @@ public: void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) const; void operator() (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8) const; -private: +private: typedef std::list > CallbackList; CallbackList m_callbackList; }; @@ -105,23 +105,24 @@ template TracedCallback::TracedCallback () : m_callbackList () -{} -template -void +void TracedCallback::ConnectWithoutContext (const CallbackBase & callback) { Callback cb; cb.Assign (callback); m_callbackList.push_back (cb); } -template -void +void TracedCallback::Connect (const CallbackBase & callback, std::string path) { Callback cb; @@ -140,13 +141,13 @@ TracedCallback::DisconnectWithoutContext (const Callbac i != m_callbackList.end (); /* empty */) { if ((*i).IsEqual (callback)) - { - i = m_callbackList.erase (i); - } + { + i = m_callbackList.erase (i); + } else - { - i++; - } + { + i++; + } } } template::operator() (void) const for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (); + (*i)(); } } template::operator() (T1 a1) const for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1); + (*i)(a1); } } template::operator() (T1 a1, T2 a2) const for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2); + (*i)(a1, a2); } } template::operator() (T1 a1, T2 a2, T3 a3) const for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3); + (*i)(a1, a2, a3); } } template::operator() (T1 a1, T2 a2, T3 a3, T4 a4) for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3, a4); + (*i)(a1, a2, a3, a4); } } template::operator() (T1 a1, T2 a2, T3 a3, T4 a4, for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3, a4, a5); + (*i)(a1, a2, a3, a4, a5); } } template::operator() (T1 a1, T2 a2, T3 a3, T4 a4, for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3, a4, a5, a6); + (*i)(a1, a2, a3, a4, a5, a6); } } template::operator() (T1 a1, T2 a2, T3 a3, T4 a4, for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3, a4, a5, a6, a7); + (*i)(a1, a2, a3, a4, a5, a6, a7); } } template::operator() (T1 a1, T2 a2, T3 a3, T4 a4, for (typename CallbackList::const_iterator i = m_callbackList.begin (); i != m_callbackList.end (); i++) { - (*i) (a1, a2, a3, a4, a5, a6, a7, a8); + (*i)(a1, a2, a3, a4, a5, a6, a7, a8); } } -}//namespace ns3 +} //namespace ns3 #endif /* TRACED_CALLBACK_H */ diff --git a/src/core/model/traced-value.h b/src/core/model/traced-value.h index d2e465846..05ea39cf3 100644 --- a/src/core/model/traced-value.h +++ b/src/core/model/traced-value.h @@ -90,8 +90,8 @@ public: void Set (const T &v) { if (m_v != v) { - m_cb (m_v, v); - m_v = v; + m_cb (m_v, v); + m_v = v; } } T Get (void) const { diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc index dcab76ecb..d52b803a6 100644 --- a/src/core/model/type-id.cc +++ b/src/core/model/type-id.cc @@ -105,9 +105,10 @@ private: }; IidManager::IidManager () -{} +{ +} -uint16_t +uint16_t IidManager::AllocateUid (std::string name) { uint16_t j = 1; @@ -433,8 +434,9 @@ TypeId::TypeId (const char *name) TypeId::TypeId (uint16_t tid) : m_tid (tid) -{} -TypeId +{ +} +TypeId TypeId::LookupByName (std::string name) { uint16_t uid = Singleton::Get ()->GetUid (name); @@ -488,21 +490,21 @@ TypeId::LookupAttributeByName (std::string name, struct TypeId::AttributeInfo *i TypeId tid; TypeId nextTid = *this; do { - tid = nextTid; - for (uint32_t i = 0; i < tid.GetAttributeN (); i++) - { - std::string paramName = tid.GetAttributeName (i); - if (paramName == name) - { - info->accessor = tid.GetAttributeAccessor (i); - info->flags = tid.GetAttributeFlags (i); - info->initialValue = tid.GetAttributeInitialValue (i); - info->checker = tid.GetAttributeChecker (i); - return true; - } - } - nextTid = tid.GetParent (); - } while (nextTid != tid); + tid = nextTid; + for (uint32_t i = 0; i < tid.GetAttributeN (); i++) + { + std::string paramName = tid.GetAttributeName (i); + if (paramName == name) + { + info->accessor = tid.GetAttributeAccessor (i); + info->flags = tid.GetAttributeFlags (i); + info->initialValue = tid.GetAttributeInitialValue (i); + info->checker = tid.GetAttributeChecker (i); + return true; + } + } + nextTid = tid.GetParent (); + } while (nextTid != tid); return false; } @@ -699,17 +701,17 @@ TypeId::LookupTraceSourceByName (std::string name) const TypeId tid; TypeId nextTid = *this; do { - tid = nextTid; - for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++) - { - std::string srcName = tid.GetTraceSourceName (i); - if (srcName == name) - { - return tid.GetTraceSourceAccessor (i); - } - } - nextTid = tid.GetParent (); - } while (nextTid != tid); + tid = nextTid; + for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++) + { + std::string srcName = tid.GetTraceSourceName (i); + if (srcName == name) + { + return tid.GetTraceSourceAccessor (i); + } + } + nextTid = tid.GetParent (); + } while (nextTid != tid); return 0; } diff --git a/src/core/model/type-id.h b/src/core/model/type-id.h index 94d75a4e3..bdd0a2aab 100644 --- a/src/core/model/type-id.h +++ b/src/core/model/type-id.h @@ -365,7 +365,7 @@ private: explicit TypeId (uint16_t tid); void DoAddConstructor (Callback callback); - + uint16_t m_tid; }; @@ -388,16 +388,19 @@ ATTRIBUTE_HELPER_HEADER (TypeId); namespace ns3 { TypeId::TypeId () - : m_tid (0) {} + : m_tid (0) { +} TypeId::TypeId (const TypeId &o) - : m_tid (o.m_tid) {} + : m_tid (o.m_tid) { +} TypeId &TypeId::operator = (const TypeId &o) { m_tid = o.m_tid; return *this; } TypeId::~TypeId () -{} +{ +} inline bool operator == (TypeId a, TypeId b) { return a.m_tid == b.m_tid; diff --git a/src/core/model/type-name.cc b/src/core/model/type-name.cc index bf5f6f9de..aad188bd4 100644 --- a/src/core/model/type-name.cc +++ b/src/core/model/type-name.cc @@ -4,13 +4,13 @@ namespace ns3 { -#define DEF_TYPE(x) \ - template <> \ - std::string TypeNameGet (void) \ - { \ - return #x; \ +#define DEF_TYPE(x) \ + template <> \ + std::string TypeNameGet (void) \ + { \ + return # x; \ } - + DEF_TYPE (uint8_t); DEF_TYPE (uint16_t); DEF_TYPE (uint32_t); @@ -23,4 +23,4 @@ DEF_TYPE (float); DEF_TYPE (double); -}//namespace ns3 +} //namespace ns3 diff --git a/src/core/model/type-name.h b/src/core/model/type-name.h index 22ed0244f..9971abc4b 100644 --- a/src/core/model/type-name.h +++ b/src/core/model/type-name.h @@ -14,10 +14,10 @@ std::string TypeNameGet (void) return "unknown"; } -#define DEF_TYPE(x) \ - template <> \ - std::string TypeNameGet (void) - +#define DEF_TYPE(x) \ + template <> \ + std::string TypeNameGet (void) + DEF_TYPE (uint8_t); DEF_TYPE (uint16_t); DEF_TYPE (uint32_t); @@ -31,6 +31,6 @@ DEF_TYPE (double); #undef DEF_TYPE -}//namespace ns3 +} //namespace ns3 #endif /* TYPE_NAME_H */ diff --git a/src/core/model/type-traits.h b/src/core/model/type-traits.h index 54c550e10..d3d00dc96 100644 --- a/src/core/model/type-traits.h +++ b/src/core/model/type-traits.h @@ -16,48 +16,48 @@ private: }; template struct ReferenceTraits { - enum {IsReference = 0}; + enum { IsReference = 0}; typedef U ReferencedType; }; template struct ReferenceTraits { - enum {IsReference = 1}; + enum { IsReference = 1}; typedef U ReferencedType; }; template struct PointerTraits { - enum {IsPointer = 0}; + enum { IsPointer = 0}; typedef U PointeeType; }; template struct PointerTraits { - enum {IsPointer = 1}; + enum { IsPointer = 1}; typedef U PointeeType; }; template struct FunctionPtrTraits { - enum {IsFunctionPointer = 0}; + enum { IsFunctionPointer = 0}; }; template struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 0}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 0}; typedef U ReturnType; }; template struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 1}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 1}; typedef U ReturnType; typedef V1 Arg1Type; }; template struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 2}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 2}; typedef U ReturnType; typedef V1 Arg1Type; typedef V2 Arg2Type; @@ -66,8 +66,8 @@ private: typename V3> struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 3}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 3}; typedef U ReturnType; typedef V1 Arg1Type; typedef V2 Arg2Type; @@ -77,8 +77,8 @@ private: typename V3, typename V4> struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 4}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 4}; typedef U ReturnType; typedef V1 Arg1Type; typedef V2 Arg2Type; @@ -90,8 +90,8 @@ private: typename V5> struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 5}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 5}; typedef U ReturnType; typedef V1 Arg1Type; typedef V2 Arg2Type; @@ -104,8 +104,8 @@ private: typename V5, typename V6> struct FunctionPtrTraits { - enum {IsFunctionPointer = 1}; - enum {nArgs = 6}; + enum { IsFunctionPointer = 1}; + enum { nArgs = 6}; typedef U ReturnType; typedef V1 Arg1Type; typedef V2 Arg2Type; @@ -116,52 +116,52 @@ private: }; template struct PtrToMemberTraits { - enum {IsPointerToMember = 0}; + enum { IsPointerToMember = 0}; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 0}; + enum { IsPointerToMember = 1}; + enum { nArgs = 0}; typedef U ReturnType; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 0}; + enum { IsPointerToMember = 1}; + enum { nArgs = 0}; typedef U ReturnType; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 1}; + enum { IsPointerToMember = 1}; + enum { nArgs = 1}; typedef U ReturnType; typedef W1 Arg1Type; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 1}; + enum { IsPointerToMember = 1}; + enum { nArgs = 1}; typedef U ReturnType; typedef W1 Arg1Type; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 2}; + enum { IsPointerToMember = 1}; + enum { nArgs = 2}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; }; template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 2}; + enum { IsPointerToMember = 1}; + enum { nArgs = 2}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -169,10 +169,10 @@ private: template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 3}; + enum { IsPointerToMember = 1}; + enum { nArgs = 3}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -181,10 +181,10 @@ private: template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 3}; + enum { IsPointerToMember = 1}; + enum { nArgs = 3}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -193,10 +193,10 @@ private: template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 4}; + enum { IsPointerToMember = 1}; + enum { nArgs = 4}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -206,10 +206,10 @@ private: template - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 4}; + enum { IsPointerToMember = 1}; + enum { nArgs = 4}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -220,10 +220,10 @@ private: typename W1, typename W2, typename W3, typename W4, typename W5> - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 5}; + enum { IsPointerToMember = 1}; + enum { nArgs = 5}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -235,10 +235,10 @@ private: typename W1, typename W2, typename W3, typename W4, typename W5> - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 5}; + enum { IsPointerToMember = 1}; + enum { nArgs = 5}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -250,10 +250,10 @@ private: typename W1, typename W2, typename W3, typename W4, typename W5, typename W6> - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 6}; + enum { IsPointerToMember = 1}; + enum { nArgs = 6}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -266,10 +266,10 @@ private: typename W1, typename W2, typename W3, typename W4, typename W5, typename W6> - struct PtrToMemberTraits + struct PtrToMemberTraits { - enum {IsPointerToMember = 1}; - enum {nArgs = 6}; + enum { IsPointerToMember = 1}; + enum { nArgs = 6}; typedef U ReturnType; typedef W1 Arg1Type; typedef W2 Arg2Type; @@ -283,10 +283,10 @@ public: typedef typename UnConst::Result NonConstType; typedef typename ReferenceTraits::ReferencedType ReferencedType; typedef typename PointerTraits::PointeeType PointeeType; - enum {IsPointerToMember = PtrToMemberTraits::IsPointerToMember}; - enum {IsPointer = PointerTraits::IsPointer}; - enum {IsReference = ReferenceTraits::IsReference}; - enum {IsFunctionPointer = FunctionPtrTraits::IsFunctionPointer}; + enum { IsPointerToMember = PtrToMemberTraits::IsPointerToMember}; + enum { IsPointer = PointerTraits::IsPointer}; + enum { IsReference = ReferenceTraits::IsReference}; + enum { IsFunctionPointer = FunctionPtrTraits::IsFunctionPointer}; typedef PtrToMemberTraits PointerToMemberTraits; typedef FunctionPtrTraits FunctionPointerTraits; }; diff --git a/src/core/model/uinteger.cc b/src/core/model/uinteger.cc index fd43ca990..86eba69a4 100644 --- a/src/core/model/uinteger.cc +++ b/src/core/model/uinteger.cc @@ -38,9 +38,9 @@ Ptr MakeUintegerChecker (uint64_t min, uint64_t max, std virtual bool Check (const AttributeValue &value) const { const UintegerValue *v = dynamic_cast (&value); if (v == 0) - { - return false; - } + { + return false; + } return v->Get () >= m_minValue && v->Get () <= m_maxValue; } virtual std::string GetValueTypeName (void) const { diff --git a/src/core/model/unix-fd-reader.cc b/src/core/model/unix-fd-reader.cc index a62fa9d10..f992b2ebc 100644 --- a/src/core/model/unix-fd-reader.cc +++ b/src/core/model/unix-fd-reader.cc @@ -82,7 +82,7 @@ void FdReader::Start (int fd, Callback readCallback) // scheduling a "destroy time" method to make sure the thread exits before // proceeding. // - if (! m_destroyEvent.IsRunning ()) + if (!m_destroyEvent.IsRunning ()) { // hold a reference to ensure that this object is not // deallocated before the destroy-time event fires @@ -162,7 +162,7 @@ void FdReader::Run (void) if (r == -1 && errno != EINTR) { NS_FATAL_ERROR ("select() failed: " << strerror (errno)); - } + } if (FD_ISSET (m_evpipe[0], &readfds)) { @@ -187,7 +187,7 @@ void FdReader::Run (void) NS_LOG_WARN ("read() failed: " << strerror (errno)); break; } - } + } if (m_stop) { diff --git a/src/core/model/unix-fd-reader.h b/src/core/model/unix-fd-reader.h index e3ec33960..4f86b1fde 100644 --- a/src/core/model/unix-fd-reader.h +++ b/src/core/model/unix-fd-reader.h @@ -110,4 +110,4 @@ private: } // namespace ns3 -#endif // UNIX_FD_READER_H +#endif // UNIX_FD_READER_H diff --git a/src/core/model/unix-system-condition.cc b/src/core/model/unix-system-condition.cc index 133dc18ed..70ace4583 100644 --- a/src/core/model/unix-system-condition.cc +++ b/src/core/model/unix-system-condition.cc @@ -27,7 +27,7 @@ NS_LOG_COMPONENT_DEFINE ("SystemCondition"); namespace ns3 { -class SystemConditionPrivate { +class SystemConditionPrivate { public: static const uint64_t NS_PER_SEC = (uint64_t)1000000000; @@ -71,7 +71,7 @@ SystemConditionPrivate::SystemConditionPrivate () pthread_condattr_setpshared (&cAttr, PTHREAD_PROCESS_PRIVATE); pthread_cond_init (&m_cond, &cAttr); } - + SystemConditionPrivate::~SystemConditionPrivate() { NS_LOG_FUNCTION_NOARGS (); @@ -79,21 +79,21 @@ SystemConditionPrivate::~SystemConditionPrivate() pthread_cond_destroy (&m_cond); } - void +void SystemConditionPrivate::SetCondition (bool condition) { NS_LOG_FUNCTION_NOARGS (); m_condition = condition; } - bool +bool SystemConditionPrivate::GetCondition (void) { NS_LOG_FUNCTION_NOARGS (); return m_condition; } - void +void SystemConditionPrivate::Signal (void) { NS_LOG_FUNCTION_NOARGS (); @@ -103,7 +103,7 @@ SystemConditionPrivate::Signal (void) pthread_mutex_unlock (&m_mutex); } - void +void SystemConditionPrivate::Broadcast (void) { NS_LOG_FUNCTION_NOARGS (); @@ -113,7 +113,7 @@ SystemConditionPrivate::Broadcast (void) pthread_mutex_unlock (&m_mutex); } - void +void SystemConditionPrivate::Wait (void) { NS_LOG_FUNCTION_NOARGS (); @@ -127,7 +127,7 @@ SystemConditionPrivate::Wait (void) pthread_mutex_unlock (&m_mutex); } - bool +bool SystemConditionPrivate::TimedWait (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); @@ -156,7 +156,7 @@ SystemConditionPrivate::TimedWait (uint64_t ns) if (rc == ETIMEDOUT) { pthread_mutex_unlock (&m_mutex); - return true; + return true; } } pthread_mutex_unlock (&m_mutex); @@ -175,46 +175,46 @@ SystemCondition::~SystemCondition () delete m_priv; } - void +void SystemCondition::SetCondition (bool condition) { NS_LOG_FUNCTION_NOARGS (); m_priv->SetCondition (condition); } - bool +bool SystemCondition::GetCondition (void) { NS_LOG_FUNCTION_NOARGS (); return m_priv->GetCondition (); } - void +void SystemCondition::Signal (void) { NS_LOG_FUNCTION_NOARGS (); m_priv->Signal (); } - void +void SystemCondition::Broadcast (void) { NS_LOG_FUNCTION_NOARGS (); m_priv->Broadcast (); -} +} - void +void SystemCondition::Wait (void) { NS_LOG_FUNCTION_NOARGS (); m_priv->Wait (); -} +} - bool +bool SystemCondition::TimedWait (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); return m_priv->TimedWait (ns); -} +} } // namespace ns3 diff --git a/src/core/model/unix-system-mutex.cc b/src/core/model/unix-system-mutex.cc index 9a01a3a33..e088b4a47 100644 --- a/src/core/model/unix-system-mutex.cc +++ b/src/core/model/unix-system-mutex.cc @@ -29,7 +29,7 @@ NS_LOG_COMPONENT_DEFINE ("SystemMutex"); namespace ns3 { -class SystemMutexPrivate { +class SystemMutexPrivate { public: SystemMutexPrivate (); ~SystemMutexPrivate (); @@ -62,14 +62,14 @@ SystemMutexPrivate::SystemMutexPrivate () #endif pthread_mutex_init (&m_mutex, &attr); } - + SystemMutexPrivate::~SystemMutexPrivate() { NS_LOG_FUNCTION_NOARGS (); pthread_mutex_destroy (&m_mutex); } - void +void SystemMutexPrivate::Lock (void) { NS_LOG_FUNCTION_NOARGS (); @@ -78,12 +78,12 @@ SystemMutexPrivate::Lock (void) if (rc != 0) { NS_FATAL_ERROR ("SystemMutexPrivate::Lock()" - "pthread_mutex_lock failed: " << rc << " = \"" << - strerror(rc) << "\""); + "pthread_mutex_lock failed: " << rc << " = \"" << + strerror(rc) << "\""); } } - void +void SystemMutexPrivate::Unlock (void) { NS_LOG_FUNCTION_NOARGS (); @@ -92,8 +92,8 @@ SystemMutexPrivate::Unlock (void) if (rc != 0) { NS_FATAL_ERROR ("SystemMutexPrivate::Unlock()" - "pthread_mutex_unlock failed: " << rc << " = \"" << - strerror(rc) << "\""); + "pthread_mutex_unlock failed: " << rc << " = \"" << + strerror(rc) << "\""); } } @@ -109,19 +109,19 @@ SystemMutex::~SystemMutex() delete m_priv; } - void +void SystemMutex::Lock() { NS_LOG_FUNCTION_NOARGS (); m_priv->Lock (); } - void +void SystemMutex::Unlock() { NS_LOG_FUNCTION_NOARGS (); m_priv->Unlock (); -} +} CriticalSection::CriticalSection (SystemMutex &mutex) : m_mutex(mutex) diff --git a/src/core/model/unix-system-thread.cc b/src/core/model/unix-system-thread.cc index ce2906b02..e792125f5 100644 --- a/src/core/model/unix-system-thread.cc +++ b/src/core/model/unix-system-thread.cc @@ -74,22 +74,22 @@ SystemThreadImpl::SystemThreadImpl (Callback callback) sigaction (SIGALRM, &act, 0); } - void +void SystemThreadImpl::Start (void) { NS_LOG_FUNCTION_NOARGS (); int rc = pthread_create (&m_thread, NULL, &SystemThreadImpl::DoRun, - (void *)this); + (void *)this); if (rc) { NS_FATAL_ERROR ("pthread_create failed: " << rc << "=\"" << - strerror(rc) << "\"."); + strerror(rc) << "\"."); } } - void +void SystemThreadImpl::Join (void) { NS_LOG_FUNCTION_NOARGS (); @@ -99,11 +99,11 @@ SystemThreadImpl::Join (void) if (rc) { NS_FATAL_ERROR ("pthread_join failed: " << rc << "=\"" << - strerror(rc) << "\"."); + strerror(rc) << "\"."); } } - void +void SystemThreadImpl::Shutdown (void) { NS_LOG_FUNCTION_NOARGS (); @@ -115,7 +115,7 @@ SystemThreadImpl::Shutdown (void) pthread_kill (m_thread, SIGALRM); } - bool +bool SystemThreadImpl::Break (void) { NS_LOG_FUNCTION_NOARGS (); @@ -123,7 +123,7 @@ SystemThreadImpl::Break (void) return m_break; } - void * +void * SystemThreadImpl::DoRun (void *arg) { NS_LOG_FUNCTION_NOARGS (); @@ -145,39 +145,39 @@ SystemThread::SystemThread (Callback callback) { NS_LOG_FUNCTION_NOARGS (); } - + SystemThread::~SystemThread() { NS_LOG_FUNCTION_NOARGS (); delete m_impl; } - - void + +void SystemThread::Start (void) { NS_LOG_FUNCTION_NOARGS (); m_impl->Start (); } - - void + +void SystemThread::Join (void) { NS_LOG_FUNCTION_NOARGS (); m_impl->Join (); -} +} - void +void SystemThread::Shutdown (void) { NS_LOG_FUNCTION_NOARGS (); m_impl->Shutdown (); -} +} - bool +bool SystemThread::Break (void) { NS_LOG_FUNCTION_NOARGS (); return m_impl->Break (); -} +} } // namespace ns3 diff --git a/src/core/model/unix-system-wall-clock-ms.cc b/src/core/model/unix-system-wall-clock-ms.cc index 78c83b566..c4f6cc938 100644 --- a/src/core/model/unix-system-wall-clock-ms.cc +++ b/src/core/model/unix-system-wall-clock-ms.cc @@ -117,10 +117,11 @@ SystemWallClockMsPrivate::GetElapsedSystem (void) const { return m_elapsedSystem; } - + SystemWallClockMs::SystemWallClockMs () : m_priv (new SystemWallClockMsPrivate ()) -{} +{ +} SystemWallClockMs::~SystemWallClockMs () { diff --git a/src/core/model/vector.cc b/src/core/model/vector.cc index 03e96ce42..feb218e09 100644 --- a/src/core/model/vector.cc +++ b/src/core/model/vector.cc @@ -26,7 +26,7 @@ namespace ns3 { ATTRIBUTE_HELPER_CPP (Vector3D); ATTRIBUTE_HELPER_CPP (Vector2D); - // compatibility for mobility code +// compatibility for mobility code Ptr MakeVectorChecker (void) { return MakeVector3DChecker (); @@ -37,25 +37,29 @@ Vector3D::Vector3D (double _x, double _y, double _z) : x (_x), y (_y), z (_z) -{} +{ +} Vector3D::Vector3D () : x (0.0), y (0.0), z (0.0) -{} +{ +} Vector2D::Vector2D (double _x, double _y) : x (_x), y (_y) -{} +{ +} Vector2D::Vector2D () : x (0.0), y (0.0) -{} +{ +} -double +double CalculateDistance (const Vector3D &a, const Vector3D &b) { double dx = b.x - a.x; diff --git a/src/core/model/wall-clock-synchronizer.cc b/src/core/model/wall-clock-synchronizer.cc index 301a68652..205421108 100644 --- a/src/core/model/wall-clock-synchronizer.cc +++ b/src/core/model/wall-clock-synchronizer.cc @@ -73,21 +73,21 @@ WallClockSynchronizer::~WallClockSynchronizer () NS_LOG_FUNCTION_NOARGS (); } - bool +bool WallClockSynchronizer::DoRealtime (void) { NS_LOG_FUNCTION_NOARGS (); return true; } - uint64_t +uint64_t WallClockSynchronizer::DoGetCurrentRealtime (void) { NS_LOG_FUNCTION_NOARGS (); return GetNormalizedRealtime (); } - void +void WallClockSynchronizer::DoSetOrigin (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); @@ -103,7 +103,7 @@ WallClockSynchronizer::DoSetOrigin (uint64_t ns) NS_LOG_INFO ("origin = " << m_realtimeOriginNano); } - int64_t +int64_t WallClockSynchronizer::DoGetDrift (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); @@ -143,7 +143,7 @@ WallClockSynchronizer::DoGetDrift (uint64_t ns) } } - bool +bool WallClockSynchronizer::DoSynchronize (uint64_t nsCurrent, uint64_t nsDelay) { NS_LOG_FUNCTION_NOARGS (); @@ -209,7 +209,7 @@ WallClockSynchronizer::DoSynchronize (uint64_t nsCurrent, uint64_t nsDelay) { NS_LOG_INFO ("SleepWait for " << numberJiffies * m_jiffy << " ns"); NS_LOG_INFO ("SleepWait until " << nsCurrent + numberJiffies * m_jiffy - << " ns"); + << " ns"); // // SleepWait is interruptible. If it returns true it meant that the sleep // went until the end. If it returns false, it means that the sleep was @@ -261,7 +261,7 @@ WallClockSynchronizer::DoSynchronize (uint64_t nsCurrent, uint64_t nsDelay) return SpinWait (nsCurrent + nsDelay); } - void +void WallClockSynchronizer::DoSignal (void) { NS_LOG_FUNCTION_NOARGS (); @@ -270,28 +270,28 @@ WallClockSynchronizer::DoSignal (void) m_condition.Signal (); } - void +void WallClockSynchronizer::DoSetCondition (bool cond) { NS_LOG_FUNCTION_NOARGS (); m_condition.SetCondition (cond); } - void +void WallClockSynchronizer::DoEventStart (void) { NS_LOG_FUNCTION_NOARGS (); m_nsEventStart = GetNormalizedRealtime (); } - uint64_t +uint64_t WallClockSynchronizer::DoEventEnd (void) { NS_LOG_FUNCTION_NOARGS (); return GetNormalizedRealtime () - m_nsEventStart; } - bool +bool WallClockSynchronizer::SpinWait (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); @@ -319,7 +319,7 @@ WallClockSynchronizer::SpinWait (uint64_t ns) return true; } - bool +bool WallClockSynchronizer::SleepWait (uint64_t ns) { NS_LOG_FUNCTION_NOARGS (); @@ -345,7 +345,7 @@ WallClockSynchronizer::SleepWait (uint64_t ns) return m_condition.TimedWait (ns); } - uint64_t +uint64_t WallClockSynchronizer::DriftCorrect (uint64_t nsNow, uint64_t nsDelay) { int64_t drift = DoGetDrift (nsNow); @@ -375,7 +375,7 @@ WallClockSynchronizer::DriftCorrect (uint64_t nsNow, uint64_t nsDelay) } } - uint64_t +uint64_t WallClockSynchronizer::GetRealtime (void) { struct timeval tvNow; @@ -383,13 +383,13 @@ WallClockSynchronizer::GetRealtime (void) return TimevalToNs (&tvNow); } - uint64_t +uint64_t WallClockSynchronizer::GetNormalizedRealtime (void) { return GetRealtime () - m_realtimeOriginNano; } - void +void WallClockSynchronizer::NsToTimeval (int64_t ns, struct timeval *tv) { NS_ASSERT ((ns % US_PER_NS) == 0); @@ -397,7 +397,7 @@ WallClockSynchronizer::NsToTimeval (int64_t ns, struct timeval *tv) tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS; } - uint64_t +uint64_t WallClockSynchronizer::TimevalToNs (struct timeval *tv) { uint64_t nsResult = tv->tv_sec * NS_PER_SEC + tv->tv_usec * US_PER_NS; @@ -405,7 +405,7 @@ WallClockSynchronizer::TimevalToNs (struct timeval *tv) return nsResult; } - void +void WallClockSynchronizer::TimevalAdd ( struct timeval *tv1, struct timeval *tv2, diff --git a/src/core/model/wall-clock-synchronizer.h b/src/core/model/wall-clock-synchronizer.h index b0784568d..015123ecc 100644 --- a/src/core/model/wall-clock-synchronizer.h +++ b/src/core/model/wall-clock-synchronizer.h @@ -37,7 +37,7 @@ namespace ns3 { * The simulation clock is maintained as a 64-bit integer in a unit specified * by the user through the TimeStepPrecision::Set function. This means that * it is not possible to specify event expiration times with anything better - * than this user-specified accuracy. + * than this user-specified accuracy. * * There are a couple of more issues at this level. Posix clocks provide * access to several clocks we could use as a wall clock. We don't care about diff --git a/src/core/model/watchdog.cc b/src/core/model/watchdog.cc index 703f7279a..ac91f321e 100644 --- a/src/core/model/watchdog.cc +++ b/src/core/model/watchdog.cc @@ -25,14 +25,15 @@ Watchdog::Watchdog () : m_impl (0), m_event (), m_end (MicroSeconds (0)) -{} +{ +} Watchdog::~Watchdog () { delete m_impl; } -void +void Watchdog::Ping (Time delay) { Time end = Simulator::Now () + delay; diff --git a/src/core/model/win32-system-wall-clock-ms.cc b/src/core/model/win32-system-wall-clock-ms.cc index 25046dbea..812c882b5 100644 --- a/src/core/model/win32-system-wall-clock-ms.cc +++ b/src/core/model/win32-system-wall-clock-ms.cc @@ -110,10 +110,11 @@ SystemWallClockMsPrivate::GetElapsedSystem (void) const { return m_elapsedSystem; } - + SystemWallClockMs::SystemWallClockMs () : m_priv (new SystemWallClockMsPrivate ()) -{} +{ +} SystemWallClockMs::~SystemWallClockMs () { diff --git a/src/core/test/attribute-test-suite.cc b/src/core/test/attribute-test-suite.cc index 3e3ca564f..600888d5a 100644 --- a/src/core/test/attribute-test-suite.cc +++ b/src/core/test/attribute-test-suite.cc @@ -61,7 +61,7 @@ public: static TypeId GetTypeId (void) { static TypeId tid = TypeId ("ns3::Derived") .SetParent () - ; + ; return tid; } }; @@ -79,89 +79,89 @@ public: .SetParent () .HideFromDocumentation () .AddAttribute ("TestBoolName", "help text", - BooleanValue (false), - MakeBooleanAccessor (&AttributeObjectTest::m_boolTest), - MakeBooleanChecker ()) + BooleanValue (false), + MakeBooleanAccessor (&AttributeObjectTest::m_boolTest), + MakeBooleanChecker ()) .AddAttribute ("TestBoolA", "help text", - BooleanValue (false), - MakeBooleanAccessor (&AttributeObjectTest::DoSetTestB, - &AttributeObjectTest::DoGetTestB), - MakeBooleanChecker ()) + BooleanValue (false), + MakeBooleanAccessor (&AttributeObjectTest::DoSetTestB, + &AttributeObjectTest::DoGetTestB), + MakeBooleanChecker ()) .AddAttribute ("TestInt16", "help text", - IntegerValue (-2), - MakeIntegerAccessor (&AttributeObjectTest::m_int16), - MakeIntegerChecker ()) + IntegerValue (-2), + MakeIntegerAccessor (&AttributeObjectTest::m_int16), + MakeIntegerChecker ()) .AddAttribute ("TestInt16WithBounds", "help text", - IntegerValue (-2), - MakeIntegerAccessor (&AttributeObjectTest::m_int16WithBounds), - MakeIntegerChecker (-5, 10)) + IntegerValue (-2), + MakeIntegerAccessor (&AttributeObjectTest::m_int16WithBounds), + MakeIntegerChecker (-5, 10)) .AddAttribute ("TestInt16SetGet", "help text", - IntegerValue (6), - MakeIntegerAccessor (&AttributeObjectTest::DoSetInt16, - &AttributeObjectTest::DoGetInt16), - MakeIntegerChecker ()) + IntegerValue (6), + MakeIntegerAccessor (&AttributeObjectTest::DoSetInt16, + &AttributeObjectTest::DoGetInt16), + MakeIntegerChecker ()) .AddAttribute ("TestUint8", "help text", - UintegerValue (1), - MakeUintegerAccessor (&AttributeObjectTest::m_uint8), - MakeUintegerChecker ()) + UintegerValue (1), + MakeUintegerAccessor (&AttributeObjectTest::m_uint8), + MakeUintegerChecker ()) .AddAttribute ("TestEnum", "help text", - EnumValue (TEST_A), - MakeEnumAccessor (&AttributeObjectTest::m_enum), - MakeEnumChecker (TEST_A, "TestA", - TEST_B, "TestB", - TEST_C, "TestC")) + EnumValue (TEST_A), + MakeEnumAccessor (&AttributeObjectTest::m_enum), + MakeEnumChecker (TEST_A, "TestA", + TEST_B, "TestB", + TEST_C, "TestC")) .AddAttribute ("TestRandom", "help text", - RandomVariableValue (ConstantVariable (1.0)), - MakeRandomVariableAccessor (&AttributeObjectTest::m_random), - MakeRandomVariableChecker ()) + RandomVariableValue (ConstantVariable (1.0)), + MakeRandomVariableAccessor (&AttributeObjectTest::m_random), + MakeRandomVariableChecker ()) .AddAttribute ("TestFloat", "help text", - DoubleValue (-1.1), - MakeDoubleAccessor (&AttributeObjectTest::m_float), - MakeDoubleChecker ()) + DoubleValue (-1.1), + MakeDoubleAccessor (&AttributeObjectTest::m_float), + MakeDoubleChecker ()) .AddAttribute ("TestVector1", "help text", - ObjectVectorValue (), - MakeObjectVectorAccessor (&AttributeObjectTest::m_vector1), - MakeObjectVectorChecker ()) + ObjectVectorValue (), + MakeObjectVectorAccessor (&AttributeObjectTest::m_vector1), + MakeObjectVectorChecker ()) .AddAttribute ("TestVector2", "help text", - ObjectVectorValue (), - MakeObjectVectorAccessor (&AttributeObjectTest::DoGetVectorN, - &AttributeObjectTest::DoGetVector), - MakeObjectVectorChecker ()) + ObjectVectorValue (), + MakeObjectVectorAccessor (&AttributeObjectTest::DoGetVectorN, + &AttributeObjectTest::DoGetVector), + MakeObjectVectorChecker ()) .AddAttribute ("IntegerTraceSource1", "help text", - IntegerValue (-2), - MakeIntegerAccessor (&AttributeObjectTest::m_intSrc1), - MakeIntegerChecker ()) + IntegerValue (-2), + MakeIntegerAccessor (&AttributeObjectTest::m_intSrc1), + MakeIntegerChecker ()) .AddAttribute ("IntegerTraceSource2", "help text", - IntegerValue (-2), - MakeIntegerAccessor (&AttributeObjectTest::DoSetIntSrc, - &AttributeObjectTest::DoGetIntSrc), - MakeIntegerChecker ()) + IntegerValue (-2), + MakeIntegerAccessor (&AttributeObjectTest::DoSetIntSrc, + &AttributeObjectTest::DoGetIntSrc), + MakeIntegerChecker ()) .AddAttribute ("UIntegerTraceSource", "help text", - UintegerValue (2), - MakeUintegerAccessor (&AttributeObjectTest::m_uintSrc), - MakeIntegerChecker ()) + UintegerValue (2), + MakeUintegerAccessor (&AttributeObjectTest::m_uintSrc), + MakeIntegerChecker ()) .AddAttribute ("DoubleTraceSource", "help text", - DoubleValue (2), - MakeDoubleAccessor (&AttributeObjectTest::m_doubleSrc), - MakeDoubleChecker ()) + DoubleValue (2), + MakeDoubleAccessor (&AttributeObjectTest::m_doubleSrc), + MakeDoubleChecker ()) .AddAttribute ("BoolTraceSource", "help text", BooleanValue (false), - MakeBooleanAccessor (&AttributeObjectTest::m_boolSrc), - MakeBooleanChecker ()) + MakeBooleanAccessor (&AttributeObjectTest::m_boolSrc), + MakeBooleanChecker ()) .AddAttribute ("EnumTraceSource", "help text", EnumValue (false), - MakeEnumAccessor (&AttributeObjectTest::m_enumSrc), - MakeEnumChecker (TEST_A, "TestA")) + MakeEnumAccessor (&AttributeObjectTest::m_enumSrc), + MakeEnumChecker (TEST_A, "TestA")) .AddAttribute ("ValueClassSource", "help text", - ValueClassTestValue (ValueClassTest ()), - MakeValueClassTestAccessor (&AttributeObjectTest::m_valueSrc), - MakeValueClassTestChecker ()) + ValueClassTestValue (ValueClassTest ()), + MakeValueClassTestAccessor (&AttributeObjectTest::m_valueSrc), + MakeValueClassTestChecker ()) .AddTraceSource ("Source1", "help test", - MakeTraceSourceAccessor (&AttributeObjectTest::m_intSrc1)) + MakeTraceSourceAccessor (&AttributeObjectTest::m_intSrc1)) .AddTraceSource ("Source2", "help text", - MakeTraceSourceAccessor (&AttributeObjectTest::m_cb)) + MakeTraceSourceAccessor (&AttributeObjectTest::m_cb)) .AddTraceSource ("ValueSource", "help text", - MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc)) + MakeTraceSourceAccessor (&AttributeObjectTest::m_valueSrc)) .AddAttribute ("Pointer", "help text", PointerValue (), MakePointerAccessor (&AttributeObjectTest::m_ptr), @@ -170,14 +170,14 @@ public: CallbackValue (), MakeCallbackAccessor (&AttributeObjectTest::m_cbValue), MakeCallbackChecker ()) - ; - + ; + return tid; } - void AddToVector1 (void) {m_vector1.push_back (CreateObject ());} - void AddToVector2 (void) {m_vector2.push_back (CreateObject ());} - void InvokeCb (double a, int b, float c) {m_cb (a,b,c);} + void AddToVector1 (void) { m_vector1.push_back (CreateObject ());} + void AddToVector2 (void) { m_vector2.push_back (CreateObject ());} + void InvokeCb (double a, int b, float c) { m_cb (a,b,c);} void InvokeCbValue (int8_t a) { @@ -187,14 +187,14 @@ public: } private: - void DoSetTestB (bool v) {m_boolTestA = v;} - bool DoGetTestB (void) const {return m_boolTestA;} - int16_t DoGetInt16 (void) const {return m_int16SetGet;} - void DoSetInt16 (int16_t v) {m_int16SetGet = v;} - uint32_t DoGetVectorN (void) const {return m_vector2.size ();} - Ptr DoGetVector (uint32_t i) const {return m_vector2[i];} - bool DoSetIntSrc (int8_t v) {m_intSrc2 = v; return true;} - int8_t DoGetIntSrc (void) const {return m_intSrc2;} + void DoSetTestB (bool v) { m_boolTestA = v;} + bool DoGetTestB (void) const { return m_boolTestA;} + int16_t DoGetInt16 (void) const { return m_int16SetGet;} + void DoSetInt16 (int16_t v) { m_int16SetGet = v;} + uint32_t DoGetVectorN (void) const { return m_vector2.size ();} + Ptr DoGetVector (uint32_t i) const { return m_vector2[i];} + bool DoSetIntSrc (int8_t v) { m_intSrc2 = v; return true;} + int8_t DoGetIntSrc (void) const { return m_intSrc2;} bool m_boolTestA; bool m_boolTest; @@ -836,7 +836,7 @@ public: private: virtual void DoRun (void); - void NotifySource1 (int8_t old, int8_t n) {m_got1 = n;} + void NotifySource1 (int8_t old, int8_t n) { m_got1 = n;} int64_t m_got1; }; @@ -908,7 +908,7 @@ public: private: virtual void DoRun (void); - void NotifySource2 (double a, int b, float c) {m_got2 = a;} + void NotifySource2 (double a, int b, float c) { m_got2 = a;} double m_got2; }; @@ -982,7 +982,7 @@ public: private: virtual void DoRun (void); - void NotifySource2 (double a, int b, float c) {m_got2 = a;} + void NotifySource2 (double a, int b, float c) { m_got2 = a;} double m_got2; }; @@ -1078,7 +1078,7 @@ private: Callback m_cbValue; - void NotifyCallbackValue (int8_t a) {m_gotCbValue = a;} + void NotifyCallbackValue (int8_t a) { m_gotCbValue = a;} int16_t m_gotCbValue; }; @@ -1136,7 +1136,7 @@ CallbackValueTestCase::DoRun (void) // p->InvokeCbValue (3); NS_TEST_ASSERT_MSG_EQ (m_gotCbValue, 2, "Callback Attribute set to null callback unexpectedly fired"); - } +} // =========================================================================== // The Test Suite that glues all of the Test Cases together. diff --git a/src/core/test/callback-test-suite.cc b/src/core/test/callback-test-suite.cc index dbb7c9e10..ad82cbe91 100644 --- a/src/core/test/callback-test-suite.cc +++ b/src/core/test/callback-test-suite.cc @@ -31,10 +31,10 @@ public: BasicCallbackTestCase (); virtual ~BasicCallbackTestCase () {} - void Target1 (void) {m_test1 = true;} - int Target2 (void) {m_test2 = true; return 2;} - void Target3 (double a) {m_test3 = true;} - int Target4 (double a, int b) {m_test4 = true; return 4;} + void Target1 (void) { m_test1 = true;} + int Target2 (void) { m_test2 = true; return 2;} + void Target3 (double a) { m_test3 = true;} + int Target4 (double a, int b) { m_test4 = true; return 4;} private: virtual void DoRun (void); @@ -135,7 +135,7 @@ BasicCallbackTestCase::DoRun (void) // // Make sure we can declare and compile a Callback pointing to a non-member - // function that returns void, takes one integer argument and execute it. + // function that returns void, takes one integer argument and execute it. // We also need to provide two dummy arguments to the constructor here. // Callback target6 = Callback (&BasicCallbackTarget6, true, true); @@ -144,7 +144,7 @@ BasicCallbackTestCase::DoRun (void) // // Make sure we can declare and compile a Callback pointing to a non-member - // function that returns int, takes one integer argument and execute it. + // function that returns int, takes one integer argument and execute it. // We also need to provide two dummy arguments to the constructor here. // Callback target7 = Callback (&BasicCallbackTarget7, true, true); @@ -161,10 +161,10 @@ public: MakeCallbackTestCase (); virtual ~MakeCallbackTestCase () {} - void Target1 (void) {m_test1 = true;} - int Target2 (void) {m_test2 = true; return 2;} - void Target3 (double a) {m_test3 = true;} - int Target4 (double a, int b) {m_test4 = true; return 4;} + void Target1 (void) { m_test1 = true;} + int Target2 (void) { m_test2 = true; return 2;} + void Target3 (double a) { m_test3 = true;} + int Target4 (double a, int b) { m_test4 = true; return 4;} private: virtual void DoRun (void); @@ -263,7 +263,7 @@ MakeCallbackTestCase::DoRun (void) // // Make sure we can declare and compile a Callback pointing to a non-member - // function that returns void, takes one integer argument and execute it. + // function that returns void, takes one integer argument and execute it. // This uses a higher level call than in the basic tests so we do not need to // include any dummy arguments here. // @@ -273,7 +273,7 @@ MakeCallbackTestCase::DoRun (void) // // Make sure we can declare and compile a Callback pointing to a non-member - // function that returns int, takes one integer argument and execute it. + // function that returns int, takes one integer argument and execute it. // This uses a higher level call than in the basic tests so we do not need to // include any dummy arguments here. // @@ -387,7 +387,7 @@ public: NullifyCallbackTestCase (); virtual ~NullifyCallbackTestCase () {} - void Target1 (void) {m_test1 = true;} + void Target1 (void) { m_test1 = true;} private: virtual void DoRun (void); @@ -435,7 +435,7 @@ public: MakeCallbackTemplatesTestCase (); virtual ~MakeCallbackTemplatesTestCase () {} - void Target1 (void) {m_test1 = true;} + void Target1 (void) { m_test1 = true;} private: virtual void DoRun (void); diff --git a/src/core/test/config-test-suite.cc b/src/core/test/config-test-suite.cc index 56a65293f..625343c1b 100644 --- a/src/core/test/config-test-suite.cc +++ b/src/core/test/config-test-suite.cc @@ -69,36 +69,36 @@ ConfigTestObject::GetTypeId (void) static TypeId tid = TypeId ("ConfigTestObject") .SetParent () .AddAttribute ("NodesA", "", - ObjectVectorValue (), - MakeObjectVectorAccessor (&ConfigTestObject::m_nodesA), - MakeObjectVectorChecker ()) + ObjectVectorValue (), + MakeObjectVectorAccessor (&ConfigTestObject::m_nodesA), + MakeObjectVectorChecker ()) .AddAttribute ("NodesB", "", - ObjectVectorValue (), - MakeObjectVectorAccessor (&ConfigTestObject::m_nodesB), - MakeObjectVectorChecker ()) + ObjectVectorValue (), + MakeObjectVectorAccessor (&ConfigTestObject::m_nodesB), + MakeObjectVectorChecker ()) .AddAttribute ("NodeA", "", PointerValue (), - MakePointerAccessor (&ConfigTestObject::m_nodeA), - MakePointerChecker ()) + MakePointerAccessor (&ConfigTestObject::m_nodeA), + MakePointerChecker ()) .AddAttribute ("NodeB", "", PointerValue (), - MakePointerAccessor (&ConfigTestObject::m_nodeB), - MakePointerChecker ()) + MakePointerAccessor (&ConfigTestObject::m_nodeB), + MakePointerChecker ()) .AddAttribute ("A", "", - IntegerValue (10), - MakeIntegerAccessor (&ConfigTestObject::m_a), - MakeIntegerChecker ()) + IntegerValue (10), + MakeIntegerAccessor (&ConfigTestObject::m_a), + MakeIntegerChecker ()) .AddAttribute ("B", "", - IntegerValue (9), - MakeIntegerAccessor (&ConfigTestObject::m_b), - MakeIntegerChecker ()) + IntegerValue (9), + MakeIntegerAccessor (&ConfigTestObject::m_b), + MakeIntegerChecker ()) .AddAttribute ("Source", "XX", - IntegerValue (-1), - MakeIntegerAccessor (&ConfigTestObject::m_trace), - MakeIntegerChecker ()) + IntegerValue (-1), + MakeIntegerAccessor (&ConfigTestObject::m_trace), + MakeIntegerChecker ()) .AddTraceSource ("Source", "XX", - MakeTraceSourceAccessor (&ConfigTestObject::m_trace)) - ; + MakeTraceSourceAccessor (&ConfigTestObject::m_trace)) + ; return tid; } @@ -457,8 +457,8 @@ public: ObjectVectorTraceConfigTestCase (); virtual ~ObjectVectorTraceConfigTestCase () {} - void Trace (int16_t oldValue, int16_t newValue) {m_newValue = newValue;} - void TraceWithPath (std::string path, int16_t old, int16_t newValue) {m_newValue = newValue; m_path = path;} + void Trace (int16_t oldValue, int16_t newValue) { m_newValue = newValue;} + void TraceWithPath (std::string path, int16_t old, int16_t newValue) { m_newValue = newValue; m_path = path;} private: virtual void DoRun (void); diff --git a/src/core/test/global-value-test-suite.cc b/src/core/test/global-value-test-suite.cc index 0aaa31311..23c6b5127 100644 --- a/src/core/test/global-value-test-suite.cc +++ b/src/core/test/global-value-test-suite.cc @@ -49,8 +49,8 @@ GlobalValueTestCase::DoRun (void) // keep it hidden from the documentation. // GlobalValue uint = GlobalValue ("TestUint", "help text", - UintegerValue (10), - MakeUintegerChecker ()); + UintegerValue (10), + MakeUintegerChecker ()); // // Make sure we can get at the value and that it was initialized correctly. @@ -66,8 +66,8 @@ GlobalValueTestCase::DoRun (void) for (GlobalValue::Vector::iterator i = vector->begin (); i != vector->end (); ++i) { if ((*i) == &uint) - { - vector->erase (i); + { + vector->erase (i); break; } } diff --git a/src/core/test/int64x64-test-suite.cc b/src/core/test/int64x64-test-suite.cc index 836be9f2b..8bfacb4ca 100644 --- a/src/core/test/int64x64-test-suite.cc +++ b/src/core/test/int64x64-test-suite.cc @@ -17,9 +17,9 @@ Int64x64FracTestCase::CheckFrac (int64_t hi, uint64_t lo) { int64x64_t tmp = int64x64_t (hi,lo); NS_TEST_EXPECT_MSG_EQ (tmp.GetHigh (), hi, - "High part does not match"); + "High part does not match"); NS_TEST_EXPECT_MSG_EQ (tmp.GetLow (), lo, - "Low part does not match"); + "Low part does not match"); } Int64x64FracTestCase::Int64x64FracTestCase () @@ -273,25 +273,26 @@ Int64x64InvertTestCase::DoRun (void) { #define TEST(factor) \ do { \ - int64x64_t a; \ - a = int64x64_t::Invert (factor); \ - int64x64_t b = V (factor); \ - b.MulByInvert (a); \ - NS_TEST_ASSERT_MSG_EQ (b.GetHigh (), 1, \ - "x * 1/x should be 1 for x=" << factor); \ - int64x64_t c = V (1); \ - c.MulByInvert (a); \ - NS_TEST_ASSERT_MSG_EQ (c.GetHigh (), 0, \ - "1 * 1/x should be 0 for x=" << factor); \ - int64x64_t d = V (1); \ - d /= (V(factor)); \ - NS_TEST_ASSERT_MSG_EQ (d.GetDouble (), c.GetDouble (), \ - "1 * 1/x should be equal to 1/x for x=" << factor); \ - int64x64_t e = V (-factor); \ - e.MulByInvert (a); \ - NS_TEST_ASSERT_MSG_EQ (e.GetHigh (), -1, \ - "-x * 1/x should be -1 for x=" << factor); \ - } while(false) + int64x64_t a; \ + a = int64x64_t::Invert (factor); \ + int64x64_t b = V (factor); \ + b.MulByInvert (a); \ + NS_TEST_ASSERT_MSG_EQ (b.GetHigh (), 1, \ + "x * 1/x should be 1 for x=" << factor); \ + int64x64_t c = V (1); \ + c.MulByInvert (a); \ + NS_TEST_ASSERT_MSG_EQ (c.GetHigh (), 0, \ + "1 * 1/x should be 0 for x=" << factor); \ + int64x64_t d = V (1); \ + d /= (V(factor)); \ + NS_TEST_ASSERT_MSG_EQ (d.GetDouble (), c.GetDouble (), \ + "1 * 1/x should be equal to 1/x for x=" << factor); \ + int64x64_t e = V (-factor); \ + e.MulByInvert (a); \ + NS_TEST_ASSERT_MSG_EQ (e.GetHigh (), -1, \ + "-x * 1/x should be -1 for x=" << factor); \ + } \ + while(false) TEST(2); TEST(3); TEST(4); diff --git a/src/core/test/names-test-suite.cc b/src/core/test/names-test-suite.cc index 942e1ef36..07767e399 100644 --- a/src/core/test/names-test-suite.cc +++ b/src/core/test/names-test-suite.cc @@ -903,20 +903,20 @@ AlternateFindTestCase::DoRun (void) foundTestObject = Names::Find ("Test Object"); NS_TEST_ASSERT_MSG_EQ (foundTestObject, testObject, - "Could not find a previously named TestObject via GetObject"); + "Could not find a previously named TestObject via GetObject"); foundAlternateTestObject = Names::Find ("Alternate Test Object"); NS_TEST_ASSERT_MSG_EQ (foundAlternateTestObject, alternateTestObject, - "Could not find a previously named AlternateTestObject via GetObject"); + "Could not find a previously named AlternateTestObject via GetObject"); foundAlternateTestObject = Names::Find ("Test Object"); NS_TEST_ASSERT_MSG_EQ (foundAlternateTestObject, 0, - "Unexpectedly able to GetObject on a TestObject"); + "Unexpectedly able to GetObject on a TestObject"); foundTestObject = Names::Find ("Alternate Test Object"); NS_TEST_ASSERT_MSG_EQ (foundTestObject, 0, - "Unexpectedly able to GetObject on an AlternateTestObject"); + "Unexpectedly able to GetObject on an AlternateTestObject"); } class NamesTestSuite : public TestSuite diff --git a/src/core/test/ptr-test-suite.cc b/src/core/test/ptr-test-suite.cc index 99967b4ec..f85831a61 100644 --- a/src/core/test/ptr-test-suite.cc +++ b/src/core/test/ptr-test-suite.cc @@ -62,15 +62,17 @@ private: Base::Base () : m_count (1) -{} +{ +} Base::~Base () -{} -void +{ +} +void Base::Ref (void) const { m_count++; } -void +void Base::Unref (void) const { m_count--; @@ -82,7 +84,8 @@ Base::Unref (void) const NoCount::NoCount (PtrTestCase *test) : m_test (test) -{} +{ +} NoCount::~NoCount () { m_test->DestroyNotify (); @@ -95,19 +98,20 @@ NoCount::Nothing () const PtrTestCase::PtrTestCase (void) : TestCase ("Sanity checking of Ptr<>") -{} -void +{ +} +void PtrTestCase::DestroyNotify (void) { m_nDestroyed++; } -Ptr +Ptr PtrTestCase::CallTest (Ptr p) { return p; } -Ptr const +Ptr const PtrTestCase::CallTestConst (Ptr const p) { return p; @@ -263,7 +267,7 @@ static class PtrTestSuite : public TestSuite { public: PtrTestSuite () - : TestSuite ("ptr", UNIT) + : TestSuite ("ptr", UNIT) { AddTestCase (new PtrTestCase ()); } diff --git a/src/core/test/rng-test-suite.cc b/src/core/test/rng-test-suite.cc index ea859bb31..eb1b3b6a4 100644 --- a/src/core/test/rng-test-suite.cc +++ b/src/core/test/rng-test-suite.cc @@ -31,7 +31,7 @@ FillHistoRangeUniformly (double *array, uint32_t n, double start, double end) { double increment = (end - start) / (n - 1.); double d = start; - + for (uint32_t i = 0; i < n; ++i) { array[i] = d; @@ -98,7 +98,7 @@ RngUniformTestCase::ChiSquaredTest (UniformVariable &u) { chiSquared += tmp[i]; } - + return chiSquared; } @@ -195,7 +195,7 @@ RngNormalTestCase::ChiSquaredTest (NormalVariable &n) { chiSquared += tmp[i]; } - + return chiSquared; } @@ -291,7 +291,7 @@ RngExponentialTestCase::ChiSquaredTest (ExponentialVariable &e) { chiSquared += tmp[i]; } - + return chiSquared; } @@ -388,7 +388,7 @@ RngParetoTestCase::ChiSquaredTest (ParetoVariable &p) { chiSquared += tmp[i]; } - + return chiSquared; } diff --git a/src/core/test/sample-test-suite.cc b/src/core/test/sample-test-suite.cc index c10f2bf3f..45e1be737 100644 --- a/src/core/test/sample-test-suite.cc +++ b/src/core/test/sample-test-suite.cc @@ -7,7 +7,7 @@ // to use the using directive to access the ns3 namespace directly using namespace ns3; -// This is an example TestCase. +// This is an example TestCase. class SampleTestCase1 : public TestCase { public: diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc index 285c1eba0..0206c6477 100644 --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -53,13 +53,14 @@ SimulatorEventsTestCase::SimulatorEventsTestCase (ObjectFactory schedulerFactory : TestCase ("Check that basic event handling is working with " + schedulerFactory.GetTypeId ().GetName ()), m_schedulerFactory (schedulerFactory) -{} +{ +} uint64_t SimulatorEventsTestCase::NowUs (void) { uint64_t ns = Now ().GetNanoSeconds (); return ns / 1000; -} +} void SimulatorEventsTestCase::A (int a) @@ -249,7 +250,8 @@ static void cber5 (const int &, const int &, const int &, const int &, const int SimulatorTemplateTestCase::SimulatorTemplateTestCase () : TestCase ("Check that all templates are instanciated correctly. This is a compilation test, it cannot fail at runtime.") -{} +{ +} void SimulatorTemplateTestCase::DoRun (void) { diff --git a/src/core/test/time-test-suite.cc b/src/core/test/time-test-suite.cc index 6f2503c87..e31030c7d 100644 --- a/src/core/test/time-test-suite.cc +++ b/src/core/test/time-test-suite.cc @@ -39,7 +39,8 @@ private: TimeSimpleTestCase::TimeSimpleTestCase (enum Time::Unit resolution) : TestCase ("Sanity check of common time operations"), m_resolution (resolution) -{} +{ +} void TimeSimpleTestCase::DoSetup (void) diff --git a/src/core/test/type-traits-test-suite.cc b/src/core/test/type-traits-test-suite.cc index 66e02225f..f2b220ee4 100644 --- a/src/core/test/type-traits-test-suite.cc +++ b/src/core/test/type-traits-test-suite.cc @@ -39,12 +39,12 @@ TypeTraitsTestCase::TypeTraitsTestCase (void) void TypeTraitsTestCase::DoRun (void) { - NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); - NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); - NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); - NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); - NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 0, "Check"); - NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 1, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::IsPointerToMember, 1, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 0, "Check"); + NS_TEST_ASSERT_MSG_EQ (TypeTraits::PointerToMemberTraits::nArgs, 1, "Check"); } class TypeTraitsTestSuite : public TestSuite diff --git a/src/core/test/watchdog-test-suite.cc b/src/core/test/watchdog-test-suite.cc index b781da7d2..36e1f6007 100644 --- a/src/core/test/watchdog-test-suite.cc +++ b/src/core/test/watchdog-test-suite.cc @@ -35,7 +35,8 @@ public: WatchdogTestCase::WatchdogTestCase() : TestCase ("Check that we can keepalive a watchdog") -{} +{ +} void WatchdogTestCase::Expire (Time expected)