A Discrete-Event Network Simulator
API
traced-value.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005,2006,2007 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 #ifndef TRACED_VALUE_H
20 #define TRACED_VALUE_H
21 
22 #include "boolean.h"
23 #include "double.h"
24 #include "enum.h"
25 #include "integer.h"
26 #include "traced-callback.h"
27 #include "uinteger.h"
28 
46 #define TRACED_VALUE_DEBUG(x)
47 
48 namespace ns3
49 {
50 
69 namespace TracedValueCallback
70 {
71 
82 typedef void (*Bool)(bool oldValue, bool newValue);
83 typedef void (*Int8)(int8_t oldValue, int8_t newValue);
84 typedef void (*Uint8)(uint8_t oldValue, uint8_t newValue);
85 typedef void (*Int16)(int16_t oldValue, int16_t newValue);
86 typedef void (*Uint16)(uint16_t oldValue, uint16_t newValue);
87 typedef void (*Int32)(int32_t oldValue, int32_t newValue);
88 typedef void (*Uint32)(uint32_t oldValue, uint32_t newValue);
89 typedef void (*Int64)(int64_t oldValue, int64_t newValue);
90 typedef void (*Uint64)(uint64_t oldValue, uint64_t newValue);
91 typedef void (*Double)(double oldValue, double newValue);
94 typedef void (*Void)();
97 } // namespace TracedValueCallback
98 
114 template <typename T>
116 {
117  public:
120  : m_v()
121  {
122  }
123 
129  : m_v(o.m_v)
130  {
131  }
132 
137  TracedValue(const T& v)
138  : m_v(v)
139  {
140  }
141 
146  operator T() const
147  {
148  return m_v;
149  }
150 
157  {
158  TRACED_VALUE_DEBUG("x=");
159  Set(o.m_v);
160  return *this;
161  }
162 
168  template <typename U>
170  : m_v(other.Get())
171  {
172  }
173 
179  template <typename U>
180  TracedValue(const U& other)
181  : m_v((T)other)
182  {
183  }
184 
191  {
193  }
194 
204  void Connect(const CallbackBase& cb, std::string path)
205  {
206  m_cb.Connect(cb, path);
207  }
208 
215  {
217  }
218 
225  void Disconnect(const CallbackBase& cb, std::string path)
226  {
227  m_cb.Disconnect(cb, path);
228  }
229 
236  void Set(const T& v)
237  {
238  if (m_v != v)
239  {
240  m_cb(m_v, v);
241  m_v = v;
242  }
243  }
244 
249  T Get() const
250  {
251  return m_v;
252  }
253 
262  {
263  TRACED_VALUE_DEBUG("++x");
264  T tmp = Get();
265  ++tmp;
266  Set(tmp);
267  return *this;
268  }
269 
271  {
272  TRACED_VALUE_DEBUG("--x");
273  T tmp = Get();
274  --tmp;
275  Set(tmp);
276  return *this;
277  }
278 
280  {
281  TRACED_VALUE_DEBUG("x++");
282  TracedValue old(*this);
283  T tmp = Get();
284  tmp++;
285  Set(tmp);
286  return old;
287  }
288 
290  {
291  TRACED_VALUE_DEBUG("x--");
292  TracedValue old(*this);
293  T tmp = Get();
294  tmp--;
295  Set(tmp);
296  return old;
297  }
298 
301  private:
303  T m_v;
306 };
307 
308 /********************************************************************
309  Operator implementations for TracedValue
310  ********************************************************************/
311 
326 template <typename T>
327 std::ostream&
328 operator<<(std::ostream& os, const TracedValue<T>& rhs)
329 {
330  return os << rhs.Get();
331 }
332 
341 template <typename T, typename U>
342 bool
343 operator==(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
344 {
345  TRACED_VALUE_DEBUG("x==x");
346  return lhs.Get() == rhs.Get();
347 }
348 
350 template <typename T, typename U>
351 bool
352 operator==(const TracedValue<T>& lhs, const U& rhs)
353 {
354  TRACED_VALUE_DEBUG("x==");
355  return lhs.Get() == rhs;
356 }
357 
359 template <typename T, typename U>
360 bool
361 operator==(const U& lhs, const TracedValue<T>& rhs)
362 {
363  TRACED_VALUE_DEBUG("==x");
364  return lhs == rhs.Get();
365 }
366 
368 template <typename T, typename U>
369 bool
370 operator!=(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
371 {
372  TRACED_VALUE_DEBUG("x!=x");
373  return lhs.Get() != rhs.Get();
374 }
375 
377 template <typename T, typename U>
378 bool
379 operator!=(const TracedValue<T>& lhs, const U& rhs)
380 {
381  TRACED_VALUE_DEBUG("x!=");
382  return lhs.Get() != rhs;
383 }
384 
386 template <typename T, typename U>
387 bool
388 operator!=(const U& lhs, const TracedValue<T>& rhs)
389 {
390  TRACED_VALUE_DEBUG("!=x");
391  return lhs != rhs.Get();
392 }
393 
395 template <typename T, typename U>
396 bool
397 operator<=(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
398 {
399  TRACED_VALUE_DEBUG("x<=x");
400  return lhs.Get() <= rhs.Get();
401 }
402 
404 template <typename T, typename U>
405 bool
406 operator<=(const TracedValue<T>& lhs, const U& rhs)
407 {
408  TRACED_VALUE_DEBUG("x<=");
409  return lhs.Get() <= rhs;
410 }
411 
413 template <typename T, typename U>
414 bool
415 operator<=(const U& lhs, const TracedValue<T>& rhs)
416 {
417  TRACED_VALUE_DEBUG("<=x");
418  return lhs <= rhs.Get();
419 }
420 
422 template <typename T, typename U>
423 bool
424 operator>=(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
425 {
426  TRACED_VALUE_DEBUG("x>=x");
427  return lhs.Get() >= rhs.Get();
428 }
429 
431 template <typename T, typename U>
432 bool
433 operator>=(const TracedValue<T>& lhs, const U& rhs)
434 {
435  TRACED_VALUE_DEBUG("x>=");
436  return lhs.Get() >= rhs;
437 }
438 
440 template <typename T, typename U>
441 bool
442 operator>=(const U& lhs, const TracedValue<T>& rhs)
443 {
444  TRACED_VALUE_DEBUG(">=x");
445  return lhs >= rhs.Get();
446 }
447 
449 template <typename T, typename U>
450 bool
451 operator<(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
452 {
453  TRACED_VALUE_DEBUG("x<x");
454  return lhs.Get() < rhs.Get();
455 }
456 
458 template <typename T, typename U>
459 bool
460 operator<(const TracedValue<T>& lhs, const U& rhs)
461 {
462  TRACED_VALUE_DEBUG("x<");
463  return lhs.Get() < rhs;
464 }
465 
467 template <typename T, typename U>
468 bool
469 operator<(const U& lhs, const TracedValue<T>& rhs)
470 {
471  TRACED_VALUE_DEBUG("<x");
472  return lhs < rhs.Get();
473 }
474 
476 template <typename T, typename U>
477 bool
478 operator>(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
479 {
480  TRACED_VALUE_DEBUG("x>x");
481  return lhs.Get() > rhs.Get();
482 }
483 
485 template <typename T, typename U>
486 bool
487 operator>(const TracedValue<T>& lhs, const U& rhs)
488 {
489  TRACED_VALUE_DEBUG("x>");
490  return lhs.Get() > rhs;
491 }
492 
494 template <typename T, typename U>
495 bool
496 operator>(const U& lhs, const TracedValue<T>& rhs)
497 {
498  TRACED_VALUE_DEBUG(">x");
499  return lhs > rhs.Get();
500 }
501 
515 template <typename T, typename U>
516 auto
517 operator+(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
518  -> TracedValue<decltype(lhs.Get() + rhs.Get())>
519 {
520  TRACED_VALUE_DEBUG("x+x");
521  return TracedValue<decltype(lhs.Get() + rhs.Get())>(lhs.Get() + rhs.Get());
522 }
523 
525 template <typename T, typename U>
526 auto
527 operator+(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() + rhs)>
528 {
529  TRACED_VALUE_DEBUG("x+");
530  return TracedValue<decltype(lhs.Get() + rhs)>(lhs.Get() + rhs);
531 }
532 
534 template <typename T, typename U>
535 auto
536 operator+(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs + rhs.Get())>
537 {
538  TRACED_VALUE_DEBUG("+x");
539  return TracedValue<decltype(lhs + rhs.Get())>(lhs + rhs.Get());
540 }
541 
543 template <typename T, typename U>
544 auto
545 operator-(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
546  -> TracedValue<decltype(lhs.Get() - rhs.Get())>
547 {
548  TRACED_VALUE_DEBUG("x-x");
549  return TracedValue<decltype(lhs.Get() - rhs.Get())>(lhs.Get() - rhs.Get());
550 }
551 
553 template <typename T, typename U>
554 auto
555 operator-(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() - rhs)>
556 {
557  TRACED_VALUE_DEBUG("x-");
558  return TracedValue<decltype(lhs.Get() - rhs)>(lhs.Get() - rhs);
559 }
560 
562 template <typename T, typename U>
563 auto
564 operator-(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs - rhs.Get())>
565 {
566  TRACED_VALUE_DEBUG("-x");
567  return TracedValue<decltype(lhs - rhs.Get())>(lhs - rhs.Get());
568 }
569 
571 template <typename T, typename U>
572 auto
573 operator*(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
574  -> TracedValue<decltype(lhs.Get() * rhs.Get())>
575 {
576  TRACED_VALUE_DEBUG("x*x");
577  return TracedValue<decltype(lhs.Get() * rhs.Get())>(lhs.Get() * rhs.Get());
578 }
579 
581 template <typename T, typename U>
582 auto
583 operator*(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() * rhs)>
584 {
585  TRACED_VALUE_DEBUG("x*");
586  return TracedValue<decltype(lhs.Get() * rhs)>(lhs.Get() * rhs);
587 }
588 
590 template <typename T, typename U>
591 auto
592 operator*(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs + rhs.Get())>
593 {
594  TRACED_VALUE_DEBUG("*x");
595  return TracedValue<decltype(lhs + rhs.Get())>(lhs * rhs.Get());
596 }
597 
599 template <typename T, typename U>
600 auto
601 operator/(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
602  -> TracedValue<decltype(lhs.Get() / rhs.Get())>
603 {
604  TRACED_VALUE_DEBUG("x/x");
605  return TracedValue<decltype(lhs.Get() / rhs.Get())>(lhs.Get() / rhs.Get());
606 }
607 
609 template <typename T, typename U>
610 auto
611 operator/(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() / rhs)>
612 {
613  TRACED_VALUE_DEBUG("x/");
614  return TracedValue<decltype(lhs.Get() / rhs)>(lhs.Get() / rhs);
615 }
616 
618 template <typename T, typename U>
619 auto
620 operator/(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs / rhs.Get())>
621 {
622  TRACED_VALUE_DEBUG("/x");
623  return TracedValue<decltype(lhs / rhs.Get())>(lhs / rhs.Get());
624 }
625 
627 template <typename T, typename U>
628 auto
629 operator%(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
630  -> TracedValue<decltype(lhs.Get() % rhs.Get())>
631 {
632  TRACED_VALUE_DEBUG("x%x");
633  return TracedValue<decltype(lhs.Get() % rhs.Get())>(lhs.Get() % rhs.Get());
634 }
635 
637 template <typename T, typename U>
638 auto
639 operator%(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() % rhs)>
640 {
641  TRACED_VALUE_DEBUG("x%");
642  return TracedValue<decltype(lhs.Get() % rhs)>(lhs.Get() % rhs);
643 }
644 
646 template <typename T, typename U>
647 auto
648 operator%(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs % rhs.Get())>
649 {
650  TRACED_VALUE_DEBUG("%x");
651  return TracedValue<decltype(lhs % rhs.Get())>(lhs % rhs.Get());
652 }
653 
655 template <typename T, typename U>
656 auto
657 operator^(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
658  -> TracedValue<decltype(lhs.Get() ^ rhs.Get())>
659 {
660  TRACED_VALUE_DEBUG("x^x");
661  return TracedValue<decltype(lhs.Get() ^ rhs.Get())>(lhs.Get() ^ rhs.Get());
662 }
663 
665 template <typename T, typename U>
666 auto
667 operator^(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() ^ rhs)>
668 {
669  TRACED_VALUE_DEBUG("x^");
670  return TracedValue<decltype(lhs.Get() ^ rhs)>(lhs.Get() ^ rhs);
671 }
672 
674 template <typename T, typename U>
675 auto
676 operator^(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs ^ rhs.Get())>
677 {
678  TRACED_VALUE_DEBUG("^x");
679  return TracedValue<decltype(lhs ^ rhs.Get())>(lhs ^ rhs.Get());
680 }
681 
683 template <typename T, typename U>
684 auto
685 operator|(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
686  -> TracedValue<decltype(lhs.Get() | rhs.Get())>
687 {
688  TRACED_VALUE_DEBUG("x|x");
689  return TracedValue<decltype(lhs.Get() | rhs.Get())>(lhs.Get() | rhs.Get());
690 }
691 
693 template <typename T, typename U>
694 auto
695 operator|(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() | rhs)>
696 {
697  TRACED_VALUE_DEBUG("x|");
698  return TracedValue<decltype(lhs.Get() | rhs)>(lhs.Get() | rhs);
699 }
700 
702 template <typename T, typename U>
703 auto
704 operator|(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs | rhs.Get())>
705 {
706  TRACED_VALUE_DEBUG("|x");
707  return TracedValue<decltype(lhs | rhs.Get())>(lhs | rhs.Get());
708 }
709 
711 template <typename T, typename U>
712 auto
713 operator&(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
714  -> TracedValue<decltype(lhs.Get() & rhs.Get())>
715 {
716  TRACED_VALUE_DEBUG("x&x");
717  return TracedValue<decltype(lhs.Get() & rhs.Get())>(lhs.Get() & rhs.Get());
718 }
719 
721 template <typename T, typename U>
722 auto
723 operator&(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() & rhs)>
724 {
725  TRACED_VALUE_DEBUG("x&");
726  return TracedValue<decltype(lhs.Get() & rhs)>(lhs.Get() & rhs);
727 }
728 
730 template <typename T, typename U>
731 auto
732 operator&(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs & rhs.Get())>
733 {
734  TRACED_VALUE_DEBUG("&x");
735  return TracedValue<decltype(lhs & rhs.Get())>(lhs & rhs.Get());
736 }
737 
739 template <typename T, typename U>
740 auto
741 operator<<(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
742  -> TracedValue<decltype(lhs.Get() << rhs.Get())>
743 {
744  TRACED_VALUE_DEBUG("x<<x");
745  return TracedValue<decltype(lhs.Get() << rhs.Get())>(lhs.Get() << rhs.Get());
746 }
747 
749 template <typename T, typename U>
750 auto
751 operator<<(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() << rhs)>
752 {
753  TRACED_VALUE_DEBUG("x<<");
754  return TracedValue<decltype(lhs.Get() << rhs)>(lhs.Get() << rhs);
755 }
756 
758 template <typename T, typename U>
759 auto
760 operator<<(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs << rhs.Get())>
761 {
762  TRACED_VALUE_DEBUG("<<x");
763  return TracedValue<decltype(lhs << rhs.Get())>(lhs << rhs.Get());
764 }
765 
767 template <typename T, typename U>
768 auto
769 operator>>(const TracedValue<T>& lhs, const TracedValue<U>& rhs)
770  -> TracedValue<decltype(lhs.Get() >> rhs.Get())>
771 {
772  TRACED_VALUE_DEBUG("x>>x");
773  return TracedValue<decltype(lhs.Get() >> rhs.Get())>(lhs.Get() >> rhs.Get());
774 }
775 
777 template <typename T, typename U>
778 auto
779 operator>>(const TracedValue<T>& lhs, const U& rhs) -> TracedValue<decltype(lhs.Get() >> rhs)>
780 {
781  TRACED_VALUE_DEBUG("x>>");
782  return TracedValue<decltype(lhs.Get() >> rhs)>(lhs.Get() >> rhs);
783 }
784 
786 template <typename T, typename U>
787 auto
788 operator>>(const U& lhs, const TracedValue<T>& rhs) -> TracedValue<decltype(lhs >> rhs.Get())>
789 {
790  TRACED_VALUE_DEBUG(">>x");
791  return TracedValue<decltype(lhs >> rhs.Get())>(lhs >> rhs.Get());
792 }
793 
808 template <typename T, typename U>
809 TracedValue<T>&
810 operator+=(TracedValue<T>& lhs, const U& rhs)
811 {
812  TRACED_VALUE_DEBUG("x+=");
813  T tmp = lhs.Get();
814  tmp += rhs;
815  lhs.Set(tmp);
816  return lhs;
817 }
818 
820 template <typename T, typename U>
821 TracedValue<T>&
822 operator-=(TracedValue<T>& lhs, const U& rhs)
823 {
824  TRACED_VALUE_DEBUG("x-=");
825  T tmp = lhs.Get();
826  tmp -= rhs;
827  lhs.Set(tmp);
828  return lhs;
829 }
830 
832 template <typename T, typename U>
833 TracedValue<T>&
834 operator*=(TracedValue<T>& lhs, const U& rhs)
835 {
836  TRACED_VALUE_DEBUG("x*=");
837  T tmp = lhs.Get();
838  tmp *= rhs;
839  lhs.Set(tmp);
840  return lhs;
841 }
842 
844 template <typename T, typename U>
845 TracedValue<T>&
846 operator/=(TracedValue<T>& lhs, const U& rhs)
847 {
848  TRACED_VALUE_DEBUG("x/=");
849  T tmp = lhs.Get();
850  tmp /= rhs;
851  lhs.Set(tmp);
852  return lhs;
853 }
854 
856 template <typename T, typename U>
857 TracedValue<T>&
858 operator%=(TracedValue<T>& lhs, const U& rhs)
859 {
860  TRACED_VALUE_DEBUG("x%=");
861  T tmp = lhs.Get();
862  tmp %= rhs;
863  lhs.Set(tmp);
864  return lhs;
865 }
866 
868 template <typename T, typename U>
869 TracedValue<T>&
870 operator<<=(TracedValue<T>& lhs, const U& rhs)
871 {
872  TRACED_VALUE_DEBUG("x<<=");
873  T tmp = lhs.Get();
874  tmp <<= rhs;
875  lhs.Set(tmp);
876  return lhs;
877 }
878 
880 template <typename T, typename U>
881 TracedValue<T>&
882 operator>>=(TracedValue<T>& lhs, const U& rhs)
883 {
884  TRACED_VALUE_DEBUG("x>>=");
885  T tmp = lhs.Get();
886  tmp >>= rhs;
887  lhs.Set(tmp);
888  return lhs;
889 }
890 
892 template <typename T, typename U>
893 TracedValue<T>&
894 operator&=(TracedValue<T>& lhs, const U& rhs)
895 {
896  TRACED_VALUE_DEBUG("x&=");
897  T tmp = lhs.Get();
898  tmp &= rhs;
899  lhs.Set(tmp);
900  return lhs;
901 }
902 
904 template <typename T, typename U>
905 TracedValue<T>&
906 operator|=(TracedValue<T>& lhs, const U& rhs)
907 {
908  TRACED_VALUE_DEBUG("x|=");
909  T tmp = lhs.Get();
910  tmp |= rhs;
911  lhs.Set(tmp);
912  return lhs;
913 }
914 
916 template <typename T, typename U>
917 TracedValue<T>&
918 operator^=(TracedValue<T>& lhs, const U& rhs)
919 {
920  TRACED_VALUE_DEBUG("x^=");
921  T tmp = lhs.Get();
922  tmp ^= rhs;
923  lhs.Set(tmp);
924  return lhs;
925 }
926 
935 template <typename T>
936 TracedValue<T>
938 {
939  TRACED_VALUE_DEBUG("(+x)");
940  return TracedValue<T>(+lhs.Get());
941 }
942 
944 template <typename T>
945 TracedValue<T>
947 {
948  TRACED_VALUE_DEBUG("(-x)");
949  return TracedValue<T>(-lhs.Get());
950 }
951 
953 template <typename T>
954 TracedValue<T>
956 {
957  TRACED_VALUE_DEBUG("(~x)");
958  return TracedValue<T>(~lhs.Get());
959 }
960 
962 template <typename T>
963 TracedValue<T>
965 {
966  TRACED_VALUE_DEBUG("(!x)");
967  return TracedValue<T>(!lhs.Get());
968 }
969  // \ingroup tracing
971 
972 } // namespace ns3
973 
974 #endif /* TRACED_VALUE_H */
ns3::BooleanValue attribute value declarations.
Base class for Callback class.
Definition: callback.h:360
void Disconnect(const CallbackBase &callback, std::string path)
Remove from the chain a Callback which was connected with a context.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
void DisconnectWithoutContext(const CallbackBase &callback)
Remove from the chain a Callback which was connected without a context.
void Connect(const CallbackBase &callback, std::string path)
Append a Callback to the chain with a context.
Trace classes with value semantics.
Definition: traced-value.h:116
TracedValue(const T &v)
Construct from an explicit variable.
Definition: traced-value.h:137
void DisconnectWithoutContext(const CallbackBase &cb)
Disconnect a Callback which was connected without context.
Definition: traced-value.h:214
TracedCallback< T, T > m_cb
The connected Callback.
Definition: traced-value.h:305
T m_v
The underlying value.
Definition: traced-value.h:303
void Connect(const CallbackBase &cb, std::string path)
Connect a Callback with a context string.
Definition: traced-value.h:204
void Disconnect(const CallbackBase &cb, std::string path)
Disconnect a Callback which was connected with context.
Definition: traced-value.h:225
TracedValue operator--(int)
Pre/post- increment/decrement operator.
Definition: traced-value.h:289
TracedValue & operator--()
Pre/post- increment/decrement operator.
Definition: traced-value.h:270
TracedValue(const TracedValue &o)
Copy constructor.
Definition: traced-value.h:128
void ConnectWithoutContext(const CallbackBase &cb)
Connect a Callback (without context.)
Definition: traced-value.h:190
T Get() const
Get the underlying value.
Definition: traced-value.h:249
TracedValue()
Default constructor.
Definition: traced-value.h:119
TracedValue & operator++()
Pre/post- increment/decrement operator.
Definition: traced-value.h:261
TracedValue(const U &other)
Copy from a variable type compatible with this underlying type.
Definition: traced-value.h:180
void Set(const T &v)
Set the value of the underlying variable.
Definition: traced-value.h:236
TracedValue operator++(int)
Pre/post- increment/decrement operator.
Definition: traced-value.h:279
TracedValue(const TracedValue< U > &other)
Copy from a TracedValue of a compatible type.
Definition: traced-value.h:169
TracedValue & operator=(const TracedValue &o)
Assignment.
Definition: traced-value.h:156
ns3::DoubleValue attribute value declarations and template implementations.
ns3::EnumValue attribute value declarations.
int64x64_t operator/(const int64x64_t &lhs, const int64x64_t &rhs)
Division operator.
Definition: int64x64.h:133
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:174
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:161
int64x64_t operator-(const int64x64_t &lhs, const int64x64_t &rhs)
Subtraction operator.
Definition: int64x64.h:103
int64x64_t operator+(const int64x64_t &lhs, const int64x64_t &rhs)
Addition operator.
Definition: int64x64.h:88
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition: int64x64.h:118
bool operator>(const Length &left, const Length &right)
Check if left has a value greater than right.
Definition: length.cc:421
TracedValue< T > & operator|=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:906
TracedValue< T > & operator>>=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:882
TracedValue< T > & operator^=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:918
TracedValue< T > operator~(const TracedValue< T > &lhs)
Unary arithmetic operator for TracedValue.
Definition: traced-value.h:955
auto operator^(const TracedValue< T > &lhs, const TracedValue< U > &rhs) -> TracedValue< decltype(lhs.Get() ^ rhs.Get())>
Infix arithmetic operator for TracedValue.
Definition: traced-value.h:657
TracedValue< T > & operator%=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:858
auto operator|(const TracedValue< T > &lhs, const TracedValue< U > &rhs) -> TracedValue< decltype(lhs.Get()|rhs.Get())>
Infix arithmetic operator for TracedValue.
Definition: traced-value.h:685
TracedValue< T > & operator<<=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:870
TracedValue< T > operator!(const TracedValue< T > &lhs)
Unary arithmetic operator for TracedValue.
Definition: traced-value.h:964
TracedValue< T > & operator*=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:834
TracedValue< T > & operator&=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:894
TracedValue< T > & operator/=(TracedValue< T > &lhs, const U &rhs)
Operator assignment for TracedValue.
Definition: traced-value.h:846
auto operator&(const TracedValue< T > &lhs, const TracedValue< U > &rhs) -> TracedValue< decltype(lhs.Get() &rhs.Get())>
Infix arithmetic operator for TracedValue.
Definition: traced-value.h:713
ns3::IntegerValue attribute value declarations and template implementations.
void(* Uint16)(uint16_t oldValue, uint16_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:86
void(* Bool)(bool oldValue, bool newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:82
void(* Int8)(int8_t oldValue, int8_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:83
void(* Void)()
TracedValue Callback signature for void.
Definition: traced-value.h:94
void(* Int16)(int16_t oldValue, int16_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:85
void(* Uint8)(uint8_t oldValue, uint8_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:84
void(* Int64)(int64_t oldValue, int64_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:89
void(* Uint32)(uint32_t oldValue, uint32_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:88
void(* Uint64)(uint64_t oldValue, uint64_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:90
void(* Int32)(int32_t oldValue, int32_t newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:87
void(* Double)(double oldValue, double newValue)
TracedValue Callback signature for POD.
Definition: traced-value.h:91
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition: callback.h:678
Time operator%(const Time &lhs, const Time &rhs)
Remainder (modulus) from the quotient of two Times.
Definition: nstime.h:1127
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:157
Time & operator+=(Time &lhs, const Time &rhs)
Compound addition assignment for Time.
Definition: nstime.h:1173
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:170
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:183
Time & operator-=(Time &lhs, const Time &rhs)
Compound subtraction assignment for Time.
Definition: nstime.h:1186
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
ns3::TracedCallback declaration and template implementation.
#define TRACED_VALUE_DEBUG(x)
Logging macro for TracedValue.
Definition: traced-value.h:46
ns3::UintegerValue attribute value declarations and template implementations.