| Polaris: SimEdgeKernel.cc Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
SimEdgeKernel.ccGo to the documentation of this file.00001 /// 00002 /// \file SimEdgeKernel.cc 00003 /// 00004 #ifdef POLARIS_GNU_PRAGMAS 00005 #pragma implementation 00006 #endif 00007 /// 00008 #include "SimEdgeKernel.h" 00009 00010 /// Create an empty edge 00011 SimEdgeKernel::SimEdgeKernel( ) { 00012 #ifdef CLASS_INSTANCE_REGISTRY 00013 register_instance(SIM_EDGE_KERNEL, sizeof(SimEdgeKernel), this); 00014 #endif 00015 00016 _type = SIM_UNKNOWN; 00017 _spanmatch = 0; 00018 _stridematch = 0; 00019 } 00020 00021 /// Supply type 00022 void 00023 SimEdgeKernel::type( SimilarityType type) 00024 { 00025 _type = type; 00026 } 00027 00028 /// Return type 00029 SimilarityType 00030 SimEdgeKernel::type( ) const 00031 { 00032 return _type; 00033 } 00034 00035 char * 00036 SimEdgeKernel::type_name() const 00037 { 00038 switch (_type) { 00039 case SIM_UNKNOWN: 00040 return "SIM_UNKNOWN"; 00041 case SIM_EQUIV: 00042 return "SIM_EQUIV"; 00043 case SIM_DIM_EQUIV: 00044 return "SIM_DIM_EQUIV"; 00045 case SIM_STRIDE_EQUIV: 00046 return "SIM_STRIDE_EQUIV"; 00047 case SIM_NOT_SIMILAR: 00048 return "SIM_NOT_SIMILAR"; 00049 case SIM_DIM_EQUIV_UP: 00050 return "SIM_DIM_EQUIV_UP"; 00051 case SIM_STRIDE_EQUIV_UP: 00052 return "SIM_STRIDE_EQUIV_UP"; 00053 case SIM_EQUIV_SEMI: 00054 return "SIM_EQUIV_SEMI"; 00055 case SIM_STRIDE_EQUIV_SEMI: 00056 return "SIM_STRIDE_EQUIV_SEMI"; 00057 case SIM_DIM_EQUIV_SEMI: 00058 return "SIM_DIM_EQUIV_SEMI"; 00059 default: 00060 return "UNKNOWN SimilarityType VALUE"; 00061 } 00062 } 00063 00064 /// dump_in_match 00065 void 00066 SimEdgeKernel::dump_in_match(SimilarityType type, 00067 Array<int> * stridematch, 00068 Array<bool> * spanmatch) 00069 { 00070 _type = type; 00071 00072 if (_stridematch) delete _stridematch; 00073 _stridematch = stridematch; 00074 00075 if (_spanmatch) delete _spanmatch; 00076 _spanmatch = spanmatch; 00077 } 00078 00079 /// supply span match 00080 void 00081 SimEdgeKernel::spanmatch( Array<bool> * match ) 00082 { 00083 if (_spanmatch) delete _spanmatch; 00084 _spanmatch = match; 00085 } 00086 00087 /// supply stride match 00088 void 00089 SimEdgeKernel::stridematch( Array<int> * match ) 00090 { 00091 if (_stridematch) delete _stridematch; 00092 _stridematch = match; 00093 } 00094 00095 /// return span match 00096 Array<bool> * 00097 SimEdgeKernel::spanmatch( ) const 00098 { 00099 return _spanmatch; 00100 } 00101 00102 /// return stride match 00103 Array<int> * 00104 SimEdgeKernel::stridematch( ) const 00105 { 00106 return _stridematch; 00107 } 00108 00109 SimEdgeKernel * 00110 SimEdgeKernel::clone() const 00111 { 00112 return new SimEdgeKernel( *this ); 00113 } 00114 00115 Listable * 00116 SimEdgeKernel::listable_clone() const 00117 { 00118 return (Listable *) clone(); 00119 } 00120 00121 /// Delete an edge 00122 SimEdgeKernel::~SimEdgeKernel( ) 00123 { 00124 #ifdef CLASS_INSTANCE_REGISTRY 00125 unregister_instance(SIM_EDGE_KERNEL, this); 00126 #endif 00127 00128 if (_spanmatch) delete _spanmatch; 00129 if (_stridematch) delete _stridematch; 00130 } 00131 00132 void 00133 SimEdgeKernel::print(ostream & o) const 00134 { 00135 o << "{" << _type << ", SPAN-match: " << *_spanmatch << ", STRIDE-match: " << *_stridematch << "}"; 00136 } 00137 00138 ostream & 00139 operator << (ostream & o, const SimEdgeKernel & edge) 00140 { 00141 edge.print(o); 00142 return o; 00143 } |
||
|