Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

abktempl.h

Go to the documentation of this file.
00001 /**************************************************************************
00002 ***    
00003 *** Copyright (c) 1995-2000 Regents of the University of California,
00004 ***               Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan,
00006 ***               Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov
00007 ***
00008 ***  Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
00009 ***  Original Affiliation:   UCLA, Computer Science Department,
00010 ***                          Los Angeles, CA 90095-1596 USA
00011 ***
00012 ***  Permission is hereby granted, free of charge, to any person obtaining 
00013 ***  a copy of this software and associated documentation files (the
00014 ***  "Software"), to deal in the Software without restriction, including
00015 ***  without limitation 
00016 ***  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00017 ***  and/or sell copies of the Software, and to permit persons to whom the 
00018 ***  Software is furnished to do so, subject to the following conditions:
00019 ***
00020 ***  The above copyright notice and this permission notice shall be included
00021 ***  in all copies or substantial portions of the Software.
00022 ***
00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00030 ***
00031 ***
00032 ***************************************************************************/
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00045 
00046 /*
00047  This file to be included into all projects in the group
00048  CHANGES
00049  970820   ilm included templated function clear(Sequence&) by msm
00050              moved "string stuff" into abkcommon.h
00051 */
00052 #ifndef  _ABKTEMPL_H_
00053 #define  _ABKTEMPL_H_
00054 
00055 /*
00056  #ifdef __GNUC__
00057  #if ( __GNUC__ >= 3)
00058   #include <iostream>
00059  #else
00060   #include <iostream>
00061  #endif
00062 #else
00063   #include <iostream>
00064 #endif
00065 */
00066 #include <iostream>
00067 #include <utility>
00068 //#include <pair.h>
00069 #include <vector>
00070 
00071 //: Use this class as template argument
00072 class Empty { };
00073 //  when you mean "nothing" (or "no user informathing")
00074 
00075 inline std::ostream& operator<<(std::ostream& out, const Empty&) 
00076 { return out; }
00077 inline std::istream& operator>>(std::istream& in,        Empty&) 
00078 { return in;  }
00079 
00080 const Empty empty=Empty();
00081 
00082 template <class T>
00083 inline T abs(const T& a) {
00084     return  (0 <= a) ? a : -a;
00085 }
00086 
00087 template <class T>
00088 inline T square(const T& a) {
00089     return  a*a;
00090 }
00091 
00092 template <class Sequence>
00093 void  deleteAllPointersIn(Sequence& s)
00094 {
00095    for (typename Sequence::iterator it=s.begin();it!=s.end();it++)
00096    delete *it; 
00097 }
00098 
00099 template <class Iterator>
00100 Iterator next(Iterator i)
00101 {
00102       return ++i;
00103 }
00104 
00105 template <class T>
00106 T clone(const T& t)
00107 {
00108       return T(t);
00109 }
00110 
00111 
00112 
00113 #endif 

Generated on Mon Apr 25 01:09:23 2005 for Parquete by doxygen 1.3.2