LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2005,2006 INRIA | 3 * Copyright (c) 2005,2006 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #include "ptr.h" | 24 #include "ptr.h" |
25 #include "fatal-error.h" | 25 #include "fatal-error.h" |
26 #include "empty.h" | 26 #include "empty.h" |
27 #include "type-traits.h" | 27 #include "type-traits.h" |
28 #include "attribute.h" | 28 #include "attribute.h" |
29 #include "attribute-helper.h" | 29 #include "attribute-helper.h" |
30 #include "simple-ref-count.h" | 30 #include "simple-ref-count.h" |
31 #include <typeinfo> | 31 #include <typeinfo> |
32 | 32 |
| 33 #include "ns3/ns3-module.h" |
| 34 #define NS3_MODULE NS3_CORE_MODULE |
| 35 #include "ns3/ns3-export.h" |
| 36 |
33 /** | 37 /** |
34 * \file | 38 * \file |
35 * \ingroup callback | 39 * \ingroup callback |
36 * Declaration of the various callback functions. | 40 * Declaration of the various callback functions. |
37 */ | 41 */ |
38 | 42 |
39 namespace ns3 { | 43 namespace ns3 { |
40 | 44 |
41 // Define the doxygen subgroups all at once, | 45 // Define the doxygen subgroups all at once, |
42 // since the implementations are interleaved. | 46 // since the implementations are interleaved. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 { | 133 { |
130 return *p; | 134 return *p; |
131 } | 135 } |
132 }; | 136 }; |
133 | 137 |
134 /** | 138 /** |
135 * \ingroup callbackimpl | 139 * \ingroup callbackimpl |
136 * Abstract base class for CallbackImpl | 140 * Abstract base class for CallbackImpl |
137 * Provides reference counting and equality test. | 141 * Provides reference counting and equality test. |
138 */ | 142 */ |
139 class CallbackImplBase : public SimpleRefCount<CallbackImplBase> | 143 class NS3_EXPORT CallbackImplBase : public SimpleRefCount<CallbackImplBase> |
140 { | 144 { |
141 public: | 145 public: |
142 /** Virtual destructor */ | 146 /** Virtual destructor */ |
143 virtual ~CallbackImplBase () {} | 147 virtual ~CallbackImplBase () {} |
144 /** | 148 /** |
145 * Equality test | 149 * Equality test |
146 * | 150 * |
147 * \param [in] other Callback Ptr | 151 * \param [in] other Callback Ptr |
148 * \return \c true if we are equal | 152 * \return \c true if we are equal |
149 */ | 153 */ |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4,T5,T6),R,
TX1,TX2,TX3,T1,T2,T3,T4,T5,T6> > (fnPtr, a1, a2, a3); | 1874 Create<ThreeBoundFunctorCallbackImpl<R (*)(TX1,TX2,TX3,T1,T2,T3,T4,T5,T6),R,
TX1,TX2,TX3,T1,T2,T3,T4,T5,T6> > (fnPtr, a1, a2, a3); |
1871 return Callback<R,T1,T2,T3,T4,T5,T6> (impl); | 1875 return Callback<R,T1,T2,T3,T4,T5,T6> (impl); |
1872 } | 1876 } |
1873 /**@}*/ | 1877 /**@}*/ |
1874 | 1878 |
1875 | 1879 |
1876 } // namespace ns3 | 1880 } // namespace ns3 |
1877 | 1881 |
1878 namespace ns3 { | 1882 namespace ns3 { |
1879 | 1883 |
1880 class CallbackValue : public AttributeValue | 1884 class NS3_EXPORT CallbackValue : public AttributeValue |
1881 { | 1885 { |
1882 public: | 1886 public: |
1883 /** Constructor */ | 1887 /** Constructor */ |
1884 CallbackValue (); | 1888 CallbackValue (); |
1885 /** | 1889 /** |
1886 * Copy constructor | 1890 * Copy constructor |
1887 * \param [in] base Callback to copy | 1891 * \param [in] base Callback to copy |
1888 */ | 1892 */ |
1889 CallbackValue (const CallbackBase &base); | 1893 CallbackValue (const CallbackBase &base); |
1890 /** Destructor */ | 1894 /** Destructor */ |
(...skipping 21 matching lines...) Expand all Loading... |
1912 * | 1916 * |
1913 * \param [in] value Source string | 1917 * \param [in] value Source string |
1914 * \param [in] checker Checker to validate with | 1918 * \param [in] checker Checker to validate with |
1915 * \return \c true if successful | 1919 * \return \c true if successful |
1916 */ | 1920 */ |
1917 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChec
ker> checker); | 1921 virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChec
ker> checker); |
1918 private: | 1922 private: |
1919 CallbackBase m_value; //!< the CallbackBase | 1923 CallbackBase m_value; //!< the CallbackBase |
1920 }; | 1924 }; |
1921 | 1925 |
1922 #ifdef _WIN32 | 1926 ATTRIBUTE_ACCESSOR_DEFINE_LIB (Callback, NS3_EXPORT); |
1923 ATTRIBUTE_ACCESSOR_DEFINE_LIB (Callback,NS3CORELIB); | 1927 ATTRIBUTE_CHECKER_DEFINE_LIB (Callback, NS3_EXPORT); |
1924 ATTRIBUTE_CHECKER_DEFINE_LIB (Callback,NS3CORELIB); | |
1925 #else | |
1926 ATTRIBUTE_ACCESSOR_DEFINE (Callback); | |
1927 ATTRIBUTE_CHECKER_DEFINE (Callback); | |
1928 #endif | |
1929 | 1928 |
1930 } // namespace ns3 | 1929 } // namespace ns3 |
1931 | 1930 |
1932 namespace ns3 { | 1931 namespace ns3 { |
1933 | 1932 |
1934 template <typename T> | 1933 template <typename T> |
1935 bool CallbackValue::GetAccessor (T &value) const | 1934 bool CallbackValue::GetAccessor (T &value) const |
1936 { | 1935 { |
1937 if (value.CheckType (m_value)) | 1936 if (value.CheckType (m_value)) |
1938 { | 1937 { |
1939 if (!value.Assign (m_value)) | 1938 if (!value.Assign (m_value)) |
1940 NS_FATAL_ERROR_NO_MSG (); | 1939 NS_FATAL_ERROR_NO_MSG (); |
1941 return true; | 1940 return true; |
1942 } | 1941 } |
1943 return false; | 1942 return false; |
1944 } | 1943 } |
1945 | 1944 |
1946 } // namespace ns3 | 1945 } // namespace ns3 |
1947 | 1946 |
1948 | 1947 |
1949 #endif /* CALLBACK_H */ | 1948 #endif /* CALLBACK_H */ |
LEFT | RIGHT |