00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef OMC_AFFINE_CIRCUITS_H
00016 #define OMC_AFFINE_CIRCUITS_H
00017
00018 #include "Circuits.h"
00019 #include "AffineObject.h"
00020 #include "Permutation.h"
00021 #include <iostream>
00022
00023 namespace omc
00024 {
00025 class AffineCircuits : public Circuits, public AffineObject
00026 {
00027 public:
00028 AffineCircuits (int, int, int);
00029 AffineCircuits (const Circuits&, int);
00030 AffineCircuits (const AffineCircuits &);
00031
00032 void setInfinityElement (index_t);
00033
00034 void relabel (const Permutation &);
00035
00036 bool operator== (const AffineCircuits &) const;
00037
00038 };
00039
00040
00042 inline AffineCircuits::AffineCircuits (int rank, int numElements,
00043 int infinityElement)
00044 : Circuits (rank, numElements), AffineObject (infinityElement)
00045 {}
00046
00048 inline AffineCircuits::AffineCircuits (const Circuits & C, int infinityElement)
00049 : Circuits (C), AffineObject (infinityElement)
00050 {}
00051
00053 inline AffineCircuits::AffineCircuits (const AffineCircuits & AC)
00054 : Circuits (AC), AffineObject (AC.m_infinityElement)
00055 {}
00056
00058 inline void AffineCircuits::setInfinityElement (index_t infinityElement) {
00059 if (infinityElement >= m_numElements)
00060 throw OMCException ("Index out of bound!",
00061 "AffineCircuits::setIninityElement");
00062 m_infinityElement = infinityElement;
00063 }
00064
00066 inline void AffineCircuits::relabel (const Permutation & pi) {
00067 Circuits::relabel (pi);
00068 m_infinityElement = pi (m_infinityElement);
00069 }
00070
00072 inline bool AffineCircuits::operator== (const AffineCircuits & AC) const {
00073 return (m_infinityElement == AC.m_infinityElement &&
00074 (Circuits&)(*this) == (Circuits&) AC);
00075 }
00076
00078 inline std::ostream & operator<< (std::ostream & os, AffineCircuits & AC) {
00079 os << (Circuits&) AC << std::endl;
00080 os << "Infinity Element: " << AC.getInfinityElement();
00081 return os;
00082 }
00083
00085 inline std::istream & operator>> (std::istream & is, AffineCircuits & AC) {
00086 index_t infinityElement;
00087 is >> infinityElement;
00088 AC.setInfinityElement (infinityElement);
00089
00090 is >> (Circuits&) AC;
00091 return is;
00092 }
00093
00094 }
00095
00096 #endif