oaComplex.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaComplex.h
00004 //
00005 // This file contains definitions for the oaComplex and oaComplexArray template
00006 // classes.  oaComplex represents a complex number, while oaComplexArray
00007 // represents an array of complex numbers.
00008 //
00009 // *****************************************************************************
00010 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00011 // Integration Initiative, this material may not be copied, modified,
00012 // re-published, uploaded, executed, or distributed in any way, in any medium,
00013 // in whole or in part, without prior written permission from Cadence.
00014 //
00015 //                Copyright 2002-2005 Cadence Design Systems, Inc.
00016 //                           All Rights Reserved.
00017 //
00018 //  $Author: icftcm $
00019 //  $Revision: #1 $
00020 //  $Date: 2010/08/09 $
00021 //  $State: Exp $
00022 // *****************************************************************************
00023 // *****************************************************************************
00024 
00025 
00026 
00027 #if !defined(oaComplex_P)
00028 #define oaComplex_P
00029 
00030 
00031 
00032 // *****************************************************************************
00033 // Nested includes
00034 // *****************************************************************************
00035 #include "oaArray.h"
00036 
00037 
00038 
00039 // *****************************************************************************
00040 // Declare and define types in the OpenAccess namespace.
00041 // *****************************************************************************
00042 BEGIN_OA_NAMESPACE
00043 
00044 
00045 
00046 // *****************************************************************************
00047 // Forward Class Declarations
00048 // *****************************************************************************
00049 template <class T>
00050 class oaChecker;
00051 
00052 
00053 
00054 // *****************************************************************************
00055 // oaComplex
00056 // *****************************************************************************
00057 template <class obj>
00058 class oaComplex {
00059 public:
00060                             oaComplex();
00061                             oaComplex(obj   realIn,
00062                                       obj   imagIn);
00063                             oaComplex(const oaComplex &c);
00064 
00065     obj                     &real();
00066     obj                     &imag();
00067     obj                     real() const;
00068     obj                     imag() const;
00069 
00070     oaComplex               &operator+=(const oaComplex &c);
00071     oaComplex               &operator-=(const oaComplex &c);
00072     oaComplex               &operator*=(const oaComplex &c);
00073     oaComplex               &operator/=(const oaComplex &c);
00074     oaComplex               &operator=(const oaComplex &c);
00075     oaComplex               operator-() const;
00076 
00077     oaBoolean               operator==(const oaComplex &c);
00078     oaBoolean               operator!=(const oaComplex &c);
00079     oaBoolean               operator==(const oaComplex &c) const;
00080     oaBoolean               operator!=(const oaComplex &c) const;
00081 
00082 private:
00083     obj                     r;
00084     obj                     i;
00085 
00086     friend class oaChecker<oaComplex<obj> >;
00087 };
00088 
00089 
00090 
00091 // *****************************************************************************
00092 // oaComplexArray
00093 // *****************************************************************************
00094 template <class obj>
00095 class oaComplexArray : public oaArray<oaComplex<obj> > {
00096 public:
00097                             oaComplexArray(const oaUInt4 sizeIn = 0);
00098                             oaComplexArray(const oaComplexArray &array);
00099 };
00100 
00101 
00102 
00103 // *****************************************************************************
00104 // Operators for oaComplex
00105 // *****************************************************************************
00106 template <class obj>
00107 inline oaComplex<obj>
00108     operator+(const oaComplex<obj>  &c1,
00109               const oaComplex<obj>  &c2);
00110 
00111 template <class obj>
00112 inline oaComplex<obj>
00113     operator-(const oaComplex<obj>  &c1,
00114               const oaComplex<obj>  &c2);
00115 
00116 template <class obj>
00117 inline oaComplex<obj>
00118     operator*(const oaComplex<obj>  &c1,
00119               const oaComplex<obj>  &c2);
00120 
00121 template <class obj>
00122 inline oaComplex<obj>
00123     operator/(const oaComplex<obj>  &c1,
00124               const oaComplex<obj>  &c2);
00125 
00126 
00127 
00128 END_OA_NAMESPACE
00129 
00130 
00131 
00132 #endif

Return to top of page