Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Dimension.hh
Go to the documentation of this file.
1 #ifndef INCLUDED_ObjexxFCL_Dimension_hh
2 #define INCLUDED_ObjexxFCL_Dimension_hh
3 
4 
5 // Dimension: Dynamic Dimension
6 //
7 // Project: Objexx Fortran Compatibility Library (ObjexxFCL)
8 //
9 // Version: 3.0.0
10 //
11 // Language: C++
12 //
13 // Copyright (c) 2000-2009 Objexx Engineering, Inc. All Rights Reserved.
14 // Use of this source code or any derivative of it is restricted by license.
15 // Licensing is available from Objexx Engineering, Inc.: http://objexx.com Objexx@objexx.com
16 
17 
18 // ObjexxFCL Headers
22 
23 // C++ Headers
24 #include <cassert>
25 #include <iosfwd>
26 
27 #ifdef CXX11
28 #include <utility>
29 #include <type_traits> // for swap
30 #else
31 #include <algorithm>
32 #endif
33 
34 namespace ObjexxFCL {
35 
36 
37 /// @brief Dimension: Dynamic Dimension
38 class Dimension :
39  public ObserverMulti
40 {
41 
42 
43 private: // Friend
44 
45 
46  friend class DynamicIndexRange;
47 
48 
49 public: // Types
50 
51 
53 
54 
55 public: // Creation
56 
57 
58  /// @brief Default Constructor
59  inline
61  exp_p_( 0 ),
62  initialized_( false ),
63  value_( 0 )
64  {}
65 
66 
67  /// @brief Copy Constructor
68  /// @note Copy creates a reference to the passed Dimension: Not intended for pass-by-value
69  explicit
70  Dimension( Dimension const & dim );
71 
72 
73  /// @brief int Constructor
74  explicit
75  Dimension( int const i );
76 
77 
78  /// @brief double Constructor
79  explicit
80  Dimension( double const d );
81 
82 
83  /// @brief Expression Constructor
84  inline
85  explicit
86  Dimension( Expression const & exp ) :
87  exp_p_( exp.clone() ),
89  value_( initialized_ ? exp_p_->ivalue() : 0 )
90  {
92  }
93 
94 
95  /// @brief Expression Pointer Constructor (Ownership Transfer)
96  inline
97  explicit
98  Dimension( Expression * exp_p_a ) :
99  exp_p_( exp_p_a ),
100  initialized_( exp_p_ ? exp_p_->initialized() : false ),
101  value_( initialized_ ? exp_p_->ivalue() : 0 )
102  {
105  }
106 
107 
108  /// @brief Clone
109  inline
110  Dimension *
111  clone() const
112  {
113  return new Dimension( exp_clone() );
114  }
115 
116 
117  /// @brief Reference Copy
118  inline
119  Dimension *
121  {
122  return new Dimension( *this );
123  }
124 
125 
126  /// @brief Destructor
127  inline
128  virtual
130  {
132  delete exp_p_;
133  }
134 
135 
136 public: // Conversion
137 
138 
139  /// @brief int Conversion
140  inline
141  operator int() const
142  {
143  assert( initialized_ );
144  return value_;
145  }
146 
147 
148  /// @brief double Conversion
149  inline
150  operator double() const
151  {
152  assert( initialized_ );
153  return static_cast< double >( value_ );
154  }
155 
156 
157 public: // Assignment
158 
159 
160  /// @brief Copy Assignment: Creates a reference to the passed Dimension
161  Dimension &
162  operator =( Dimension const & dim );
163 
164 
165  /// @brief Expression Assignment
166  inline
167  Dimension &
169  {
170  assert( exp_p_ != &exp );
172  delete exp_p_; exp_p_ = exp.clone( *this );
174  update_notify();
175  return *this;
176  }
177 
178 
179  /// @brief int Assignment
180  Dimension &
181  operator =( int const i );
182 
183 
184  /// @brief double Assignment
185  Dimension &
186  operator =( double const d );
187 
188 
189  /// @brief += Dimension
190  Dimension &
191  operator +=( Dimension const & dim );
192 
193 
194  /// @brief += Expression
195  Dimension &
196  operator +=( Expression const & exp );
197 
198 
199  /// @brief += int
200  Dimension &
201  operator +=( int const i );
202 
203 
204  /// @brief += double
205  Dimension &
206  operator +=( double const d );
207 
208 
209  /// @brief -= Dimension
210  Dimension &
211  operator -=( Dimension const & dim );
212 
213 
214  /// @brief -= Expression
215  Dimension &
216  operator -=( Expression const & exp );
217 
218 
219  /// @brief -= int
220  Dimension &
221  operator -=( int const i );
222 
223 
224  /// @brief -= double
225  Dimension &
226  operator -=( double const d );
227 
228 
229  /// @brief *= Dimension
230  Dimension &
231  operator *=( Dimension const & dim );
232 
233 
234  /// @brief *= Expression
235  Dimension &
236  operator *=( Expression const & exp );
237 
238 
239  /// @brief *= int
240  Dimension &
241  operator *=( int const i );
242 
243 
244  /// @brief *= double
245  Dimension &
246  operator *=( double const d );
247 
248 
249  /// @brief /= Dimension
250  Dimension &
251  operator /=( Dimension const & dim );
252 
253 
254  /// @brief /= Expression
255  Dimension &
256  operator /=( Expression const & exp );
257 
258 
259  /// @brief /= int
260  Dimension &
261  operator /=( int const i );
262 
263 
264  /// @brief /= double
265  Dimension &
266  operator /=( double const d );
267 
268 
269  /// @brief Dimension Value-Semantics Assignment
270  inline
271  Dimension &
272  assign_value_of( Dimension const & dim )
273  {
274  if ( this != &dim ) {
276  delete exp_p_; exp_p_ = dim.exp_clone();
278  update();
279  }
280  notify();
281  return *this;
282  }
283 
284 
285  /// @brief int Assignment if Bigger than Value or Smaller than Multiplier * Value
286  Dimension &
287  assign_if( int const i, double const m = 1.0 );
288 
289 
290  /// @brief double Assignment if Bigger than Value or Smaller than Multiplier * Value
291  Dimension &
292  assign_if( double const d, double const m = 1.0 );
293 
294 
295  /// @brief int Assignment if Bigger than Value or Smaller than Half Value
296  Dimension &
297  assign_if_half( int const i );
298 
299 
300  /// @brief double Assignment if Bigger than Value or Smaller than Half Value
301  Dimension &
302  assign_if_half( double const d );
303 
304 
305  /// @brief int Assignment if Bigger than Value
306  Dimension &
307  assign_if_bigger( int const i );
308 
309 
310  /// @brief double Assignment if Bigger than Value
311  Dimension &
312  assign_if_bigger( double const d );
313 
314 
315  /// @brief int Assignment if Bigger than Value or Smaller than Multiplier * Value: Notify if Changed
316  Dimension &
317  assign_if_nic( int const i, double const m = 1.0 );
318 
319 
320  /// @brief double Assignment if Bigger than Value or Smaller than Multiplier * Value: Notify if Changed
321  Dimension &
322  assign_if_nic( double const d, double const m = 1.0 );
323 
324 
325  /// @brief int Assignment if Bigger than Value or Smaller than Half Value: Notify if Changed
326  Dimension &
327  assign_if_half_nic( int const i );
328 
329 
330  /// @brief double Assignment if Bigger than Value or Smaller than Half Value: Notify if Changed
331  Dimension &
332  assign_if_half_nic( double const d );
333 
334 
335  /// @brief int Assignment if Bigger than Value: Notify if Changed
336  Dimension &
337  assign_if_bigger_nic( int const i );
338 
339 
340  /// @brief double Assignment if Bigger than Value: Notify if Changed
341  Dimension &
342  assign_if_bigger_nic( double const d );
343 
344 
345 public: // Incrememt/Decrement
346 
347 
348  /// @brief ++Dimension
349  Dimension &
350  operator ++();
351 
352 
353  /// @brief Dimension++
354  Dimension const
355  operator ++( int );
356 
357 
358  /// @brief --Dimension
359  Dimension &
360  operator --();
361 
362 
363  /// @brief Dimension--
364  Dimension const
365  operator --( int );
366 
367 
368 public: // Inspector
369 
370 
371  /// @brief Initialized?
372  inline
373  bool
374  initialized() const
375  {
376  return initialized_;
377  }
378 
379 
380  /// @brief Constant?
381  inline
382  bool
383  constant() const
384  {
385  return ( exp_p_ ? exp_p_->constant() : false );
386  }
387 
388 
389  /// @brief Reference?
390  inline
391  bool
392  reference() const
393  {
394  return ( exp_p_ ? exp_p_->reference() : false );
395  }
396 
397 
398  /// @brief Reducible?
399  inline
400  bool
401  reducible() const
402  {
403  return ( exp_p_ ? exp_p_->reducible() : false );
404  }
405 
406 
407  /// @brief Value
408  inline
409  int
410  operator ()() const
411  {
412  assert( initialized_ );
413  return value_;
414  }
415 
416 
417  /// @brief Value
418  inline
419  int
420  value() const
421  {
422  assert( initialized_ );
423  return value_;
424  }
425 
426 
427  /// @brief Value: Zero if Uninitialized
428  inline
429  int
430  zvalue() const
431  {
432  return value_;
433  }
434 
435 
436  /// @brief Expression Pointer
437  inline
438  Expression const *
439  exp_p() const
440  {
441  return exp_p_;
442  }
443 
444 
445  /// @brief Expression
446  inline
447  Expression const &
448  exp() const
449  {
450  assert( exp_p_ );
451  return *exp_p_;
452  }
453 
454 
455  /// @brief Expression Clone
456  inline
457  Expression *
458  exp_clone() const
459  {
460  return ( exp_p_ ? exp_p_->clone() : static_cast< Expression * >( 0 ) );
461  }
462 
463 
464 public: // Modifier
465 
466 
467  /// @brief Clear the Dimension
468  inline
469  Dimension &
471  {
472  if ( exp_p_ ) {
474  delete exp_p_; exp_p_ = 0;
475  initialized_ = false;
476  value_ = 0;
477  }
478  notify();
479  return *this;
480  }
481 
482 
483  /// @brief Clear the Dimension Without Notification
484  inline
485  Dimension &
487  {
488  if ( exp_p_ ) {
490  delete exp_p_; exp_p_ = 0;
491  initialized_ = false;
492  value_ = 0;
493  }
494  return *this;
495  }
496 
497 
498  /// @brief Swap
499  inline
500  Dimension &
501  swap( Dimension & dim )
502  {
503  if ( this != &dim ) {
505  dim.remove_as_observer();
506  std::swap( exp_p_, dim.exp_p_ );
508  std::swap( value_, dim.value_ );
510  dim.insert_as_observer();
511  notify();
512  }
513  return *this;
514  }
515 
516 
517  /// @brief Swap Without Notification
518  inline
519  Dimension &
521  {
522  if ( this != &dim ) {
524  dim.remove_as_observer();
525  std::swap( exp_p_, dim.exp_p_ );
527  std::swap( value_, dim.value_ );
529  dim.insert_as_observer();
530  }
531  return *this;
532  }
533 
534 
535 public: // Observer Modifier
536 
537 
538  /// @brief Update
539  inline
540  void
542  {
543  initialized_ = ( exp_p_ ? exp_p_->initialized() : false );
544  value_ = ( initialized_ ? exp_p_->ivalue() : 0 );
545  }
546 
547 
548  /// @brief Update for Destruction of a Subject
549  inline
550  void
551  destructed( Subject const & subject )
552  {
553  if ( exp_p_ ) exp_p_->destructed( subject );
554  }
555 
556 
557 public: // Friend
558 
559 
560  /// @brief Swap
561  friend
562  inline
563  void
565  {
566  a.swap( b );
567  }
568 
569 
570  /// @brief Swap
571  friend
572  inline
573  void
575  {
576  a.swap_no_notify( b );
577  }
578 
579 
580 private: // Functions
581 
582 
583  /// @brief Reduce Expression
584  inline
585  void
587  {
588  if ( reducible() ) {
589  Expression * reduced_exp_p = exp_p_->clone();
590  delete exp_p_; exp_p_ = reduced_exp_p;
591  }
592  }
593 
594 
595  /// @brief Insert as Observer of an Expression's Referenced Dimensions
596  inline
597  void
599  {
600  dim.insert_observer( *this );
601  }
602 
603 
604  /// @brief Insert as Observer of an Expression's Referenced Dimensions
605  inline
606  void
608  {
609  exp.insert_observer( *this );
610  }
611 
612 
613  /// @brief Insert as Observer of the Expression's Referenced Dimensions
614  inline
615  void
617  {
618  if ( exp_p_ ) exp_p_->insert_observer( *this );
619  }
620 
621 
622  /// @brief Remove as Observer of the Expression's Referenced Dimensions
623  inline
624  void
626  {
627  if ( exp_p_ ) exp_p_->remove_observer( *this );
628  }
629 
630 
631  /// @brief Update and Notify
632  inline
633  void
635  {
636  initialized_ = ( exp_p_ ? exp_p_->initialized() : false );
637  value_ = ( initialized_ ? exp_p_->ivalue() : 0 );
638  notify();
639  }
640 
641 
642  /// @brief Update and Notify if External State Changed
643  inline
644  void
646  {
647  bool const now_initialized = ( exp_p_ ? exp_p_->initialized() : false );
648  int const now_value = ( now_initialized ? exp_p_->ivalue() : 0 );
649  if ( ( initialized_ != now_initialized ) || ( value_ != now_value ) ) {
650  initialized_ = now_initialized;
651  value_ = now_value;
652  notify();
653  }
654  }
655 
656 
657 private: // Data
658 
659 
660  /// @brief Expression pointer (owned)
662 
663  /// @brief Cached initialization state
665 
666  /// @brief Cached value: Kept in synch with expression value (0 if uninitialized)
667  int value_;
668 
669 
670 }; // Dimension
671 
672 
673 /// @brief Swap
674 void
675 swap( Dimension & a, Dimension & b );
676 
677 
678 /// @brief Swap
679 void
681 
682 
683 /// @brief Dimension == Dimension
684 inline
685 bool
686 operator ==( Dimension const & dim1, Dimension const & dim2 )
687 {
688  return ( ( dim1.initialized() ) && ( dim2.initialized() ) && ( dim1.value() == dim2.value() ) );
689 }
690 
691 
692 /// @brief Dimension != Dimension
693 inline
694 bool
695 operator !=( Dimension const & dim1, Dimension const & dim2 )
696 {
697  return !( dim1 == dim2 );
698 }
699 
700 
701 /// @brief Dimension < Dimension
702 inline
703 bool
704 operator <( Dimension const & dim1, Dimension const & dim2 )
705 {
706  return ( ( dim1.initialized() ) && ( dim2.initialized() ) && ( dim1.value() < dim2.value() ) );
707 }
708 
709 
710 /// @brief Dimension <= Dimension
711 inline
712 bool
713 operator <=( Dimension const & dim1, Dimension const & dim2 )
714 {
715  return ( ( dim1.initialized() ) && ( dim2.initialized() ) && ( dim1.value() <= dim2.value() ) );
716 }
717 
718 
719 /// @brief Dimension > Dimension
720 inline
721 bool
722 operator >( Dimension const & dim1, Dimension const & dim2 )
723 {
724  return ( ( dim1.initialized() ) && ( dim2.initialized() ) && ( dim1.value() > dim2.value() ) );
725 }
726 
727 
728 /// @brief Dimension >= Dimension
729 inline
730 bool
731 operator >=( Dimension const & dim1, Dimension const & dim2 )
732 {
733  return ( ( dim1.initialized() ) && ( dim2.initialized() ) && ( dim1.value() >= dim2.value() ) );
734 }
735 
736 
737 /// @brief int == Dimension
738 inline
739 bool
740 operator ==( int const i, Dimension const & dim )
741 {
742  return ( ( dim.initialized() ) && ( i == dim.value() ) );
743 }
744 
745 
746 /// @brief int != Dimension
747 inline
748 bool
749 operator !=( int const i, Dimension const & dim )
750 {
751  return !( i == dim );
752 }
753 
754 
755 /// @brief int < Dimension
756 inline
757 bool
758 operator <( int const i, Dimension const & dim )
759 {
760  return ( ( dim.initialized() ) && ( i < dim.value() ) );
761 }
762 
763 
764 /// @brief int <= Dimension
765 inline
766 bool
767 operator <=( int const i, Dimension const & dim )
768 {
769  return ( ( dim.initialized() ) && ( i <= dim.value() ) );
770 }
771 
772 
773 /// @brief int > Dimension
774 inline
775 bool
776 operator >( int const i, Dimension const & dim )
777 {
778  return ( ( dim.initialized() ) && ( i > dim.value() ) );
779 }
780 
781 
782 /// @brief int >= Dimension
783 inline
784 bool
785 operator >=( int const i, Dimension const & dim )
786 {
787  return ( ( dim.initialized() ) && ( i >= dim.value() ) );
788 }
789 
790 
791 /// @brief Dimension == int
792 inline
793 bool
794 operator ==( Dimension const & dim, int const i )
795 {
796  return ( ( dim.initialized() ) && ( dim.value() == i ) );
797 }
798 
799 
800 /// @brief Dimension != int
801 inline
802 bool
803 operator !=( Dimension const & dim, int const i )
804 {
805  return !( dim == i );
806 }
807 
808 
809 /// @brief Dimension < int
810 inline
811 bool
812 operator <( Dimension const & dim, int const i )
813 {
814  return ( ( dim.initialized() ) && ( dim.value() < i ) );
815 }
816 
817 
818 /// @brief Dimension <= int
819 inline
820 bool
821 operator <=( Dimension const & dim, int const i )
822 {
823  return ( ( dim.initialized() ) && ( dim.value() <= i ) );
824 }
825 
826 
827 /// @brief Dimension > int
828 inline
829 bool
830 operator >( Dimension const & dim, int const i )
831 {
832  return ( ( dim.initialized() ) && ( dim.value() > i ) );
833 }
834 
835 
836 /// @brief Dimension >= int
837 inline
838 bool
839 operator >=( Dimension const & dim, int const i )
840 {
841  return ( ( dim.initialized() ) && ( dim.value() >= i ) );
842 }
843 
844 
845 /// @brief double == Dimension
846 inline
847 bool
848 operator ==( double const d, Dimension const & dim )
849 {
850  return ( ( dim.initialized() ) && ( d == dim.value() ) );
851 }
852 
853 
854 /// @brief double != Dimension
855 inline
856 bool
857 operator !=( double const d, Dimension const & dim )
858 {
859  return !( d == dim );
860 }
861 
862 
863 /// @brief double < Dimension
864 inline
865 bool
866 operator <( double const d, Dimension const & dim )
867 {
868  return ( ( dim.initialized() ) && ( d < dim.value() ) );
869 }
870 
871 
872 /// @brief double <= Dimension
873 inline
874 bool
875 operator <=( double const d, Dimension const & dim )
876 {
877  return ( ( dim.initialized() ) && ( d <= dim.value() ) );
878 }
879 
880 
881 /// @brief double > Dimension
882 inline
883 bool
884 operator >( double const d, Dimension const & dim )
885 {
886  return ( ( dim.initialized() ) && ( d > dim.value() ) );
887 }
888 
889 
890 /// @brief double >= Dimension
891 inline
892 bool
893 operator >=( double const d, Dimension const & dim )
894 {
895  return ( ( dim.initialized() ) && ( d >= dim.value() ) );
896 }
897 
898 
899 /// @brief Dimension == double
900 inline
901 bool
902 operator ==( Dimension const & dim, double const d )
903 {
904  return ( ( dim.initialized() ) && ( dim.value() == d ) );
905 }
906 
907 
908 /// @brief Dimension != double
909 inline
910 bool
911 operator !=( Dimension const & dim, double const d )
912 {
913  return !( dim == d );
914 }
915 
916 
917 /// @brief Dimension < double
918 inline
919 bool
920 operator <( Dimension const & dim, double const d )
921 {
922  return ( ( dim.initialized() ) && ( dim.value() < d ) );
923 }
924 
925 
926 /// @brief Dimension <= double
927 inline
928 bool
929 operator <=( Dimension const & dim, double const d )
930 {
931  return ( ( dim.initialized() ) && ( dim.value() <= d ) );
932 }
933 
934 
935 /// @brief Dimension > double
936 inline
937 bool
938 operator >( Dimension const & dim, double const d )
939 {
940  return ( ( dim.initialized() ) && ( dim.value() > d ) );
941 }
942 
943 
944 /// @brief Dimension >= double
945 inline
946 bool
947 operator >=( Dimension const & dim, double const d )
948 {
949  return ( ( dim.initialized() ) && ( dim.value() >= d ) );
950 }
951 
952 
953 /// @brief Stream Input
954 std::istream &
955 operator >>( std::istream & stream, Dimension & dim );
956 
957 
958 /// @brief Stream Output
959 std::ostream &
960 operator <<( std::ostream & stream, Dimension const & dim );
961 
962 
963 } // namespace ObjexxFCL
964 
965 
966 #ifndef NO_STD_SWAP_OVERLOADS
967 
968 
969 // std::swap Overloads for Efficiency
970 //
971 // Technically you cannot add functions overloads to namespace std
972 // but this works with most compilers and makes it much faster if someone uses
973 // std::swap instead of swap or ObjexxFCL::swap.
974 
975 
976 namespace std {
977 
978 
979 /// @brief std::swap( Dimension, Dimension )
980 inline
981 void
983 {
984  a.swap( b );
985 }
986 
987 
988 } // namespace std
989 
990 
991 #endif // NO_STD_SWAP_OVERLOADS
992 
993 
994 #endif // INCLUDED_ObjexxFCL_Dimension_HH
std::istream & operator>>(std::istream &stream, byte &b)
Stream Input.
Definition: byte.hh:409
bool constant() const
Constant?
Definition: Dimension.hh:383
bool reference() const
Reference?
Definition: Dimension.hh:392
virtual DimensionExpression * clone() const =0
Clone.
void update()
Update.
Definition: Dimension.hh:541
Dimension(Expression const &exp)
Expression Constructor.
Definition: Dimension.hh:86
Dimension & assign_if_bigger_nic(int const i)
int Assignment if Bigger than Value: Notify if Changed
Definition: Dimension.cc:481
Dimension * clone() const
Clone.
Definition: Dimension.hh:111
bool operator!=(byte const &i, byte const &j)
byte != byte
Definition: byte.hh:356
void destructed(Subject const &subject)
Update for Destruction of a Subject.
Definition: Dimension.hh:551
Dimension & swap_no_notify(Dimension &dim)
Swap Without Notification.
Definition: Dimension.hh:520
void reduce_expression()
Reduce Expression.
Definition: Dimension.hh:586
void update_notify_if_changed()
Update and Notify if External State Changed.
Definition: Dimension.hh:645
bool operator>=(byte const &i, byte const &j)
byte >= byte
Definition: byte.hh:396
virtual bool initialized() const =0
Initialized?
static void swap(T &x, T &y)
Definition: Svm.cc:21
Dimension & operator-=(Dimension const &dim)
-= Dimension
Definition: Dimension.cc:163
Dimension & operator*=(Dimension const &dim)
*= Dimension
Definition: Dimension.cc:223
virtual int ivalue() const
Integer Value.
Dimension & assign_if_half_nic(int const i)
int Assignment if Bigger than Value or Smaller than Half Value: Notify if Changed ...
Definition: Dimension.cc:455
bool operator<=(byte const &i, byte const &j)
byte <= byte
Definition: byte.hh:376
void remove_as_observer()
Remove as Observer of the Expression's Referenced Dimensions.
Definition: Dimension.hh:625
Expression * exp_p_
Expression pointer (owned)
Definition: Dimension.hh:661
Dimension & operator++()
++Dimension
Definition: Dimension.cc:507
Dimension & assign_if(int const i, double const m=1.0)
int Assignment if Bigger than Value or Smaller than Multiplier * Value
Definition: Dimension.cc:345
virtual bool reference() const =0
Reference?
Dimension & clear_no_notify()
Clear the Dimension Without Notification.
Definition: Dimension.hh:486
Dimension & operator/=(Dimension const &dim)
/= Dimension
Definition: Dimension.cc:283
Dimension & assign_value_of(Dimension const &dim)
Dimension Value-Semantics Assignment.
Definition: Dimension.hh:272
virtual void insert_observer(Observer &) const =0
Insert an Observer.
Dimension & assign_if_bigger(int const i)
int Assignment if Bigger than Value
Definition: Dimension.cc:401
Dimension & operator=(Dimension const &dim)
Copy Assignment: Creates a reference to the passed Dimension.
Definition: Dimension.cc:66
int value_
Cached value: Kept in synch with expression value (0 if uninitialized)
Definition: Dimension.hh:667
void swap_no_notify(Dimension &a, Dimension &b)
Swap.
Definition: Dimension.hh:574
ObserverMulti: Combined Subject + Multi Observer Abstract Base Class.
virtual bool reducible() const =0
Reducible?
virtual bool constant() const =0
Constant?
virtual void destructed(Subject const &)=0
Update for Destruction of a Subject.
void insert_as_observer_of(Dimension const &dim)
Insert as Observer of an Expression's Referenced Dimensions.
Definition: Dimension.hh:598
Dimension & assign_if_nic(int const i, double const m=1.0)
int Assignment if Bigger than Value or Smaller than Multiplier * Value: Notify if Changed ...
Definition: Dimension.cc:429
Dimension * reference_copy() const
Reference Copy.
Definition: Dimension.hh:120
bool initialized() const
Initialized?
Definition: Dimension.hh:374
Dimension(Expression *exp_p_a)
Expression Pointer Constructor (Ownership Transfer)
Definition: Dimension.hh:98
DynamicIndexRange: Dynamic Index Range.
int operator()() const
Value.
Definition: Dimension.hh:410
void insert_observer(Observer &observer) const
Insert an Observer.
void notify() const
Notify Observers That This Subject Has Changed.
Definition: Observer.cc:27
Observer: Combined Subject + Observer Abstract Base Class.
Definition: Observer.hh:26
Dimension & operator--()
–Dimension
Definition: Dimension.cc:520
int zvalue() const
Value: Zero if Uninitialized.
Definition: Dimension.hh:430
DimensionExpression Expression
Definition: Dimension.hh:52
virtual ~Dimension()
Destructor.
Definition: Dimension.hh:129
DimensionExpression: DimensionExpression Interface Class.
Dimension & clear()
Clear the Dimension.
Definition: Dimension.hh:470
Dimension & operator+=(Dimension const &dim)
+= Dimension
Definition: Dimension.cc:103
virtual void remove_observer(Observer &) const =0
Remove an Observer.
bool operator>(byte const &i, byte const &j)
byte > byte
Definition: byte.hh:386
Expression const & exp() const
Expression.
Definition: Dimension.hh:448
int value() const
Value.
Definition: Dimension.hh:420
Dimension: Dynamic Dimension.
Definition: Dimension.hh:38
bool operator<(byte const &i, byte const &j)
byte < byte
Definition: byte.hh:366
void swap(CArray< T > &a, CArray< T > &b)
Swap.
Definition: CArray.hh:1403
Expression * exp_clone() const
Expression Clone.
Definition: Dimension.hh:458
std::ostream & operator<<(std::ostream &stream, CArray< T > const &a)
stream << CArray
Definition: CArray.io.hh:33
Dimension & assign_if_half(int const i)
int Assignment if Bigger than Value or Smaller than Half Value
Definition: Dimension.cc:373
bool operator==(byte const &i, byte const &j)
byte == byte
Definition: byte.hh:346
bool initialized_
Cached initialization state.
Definition: Dimension.hh:664
Dimension()
Default Constructor.
Definition: Dimension.hh:60
bool reducible() const
Reducible?
Definition: Dimension.hh:401
void update_notify()
Update and Notify.
Definition: Dimension.hh:634
void insert_as_observer_of(Expression const &exp)
Insert as Observer of an Expression's Referenced Dimensions.
Definition: Dimension.hh:607
Expression const * exp_p() const
Expression Pointer.
Definition: Dimension.hh:439
Dimension & swap(Dimension &dim)
Swap.
Definition: Dimension.hh:501
void insert_as_observer()
Insert as Observer of the Expression's Referenced Dimensions.
Definition: Dimension.hh:616