00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 #ifndef KVL_T_H
00031 #define KVL_T_H
00032 
00033 #include "w_defines.h"
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 #ifdef __GNUG__
00042 #pragma interface
00043 #endif
00044 
00045 #ifndef STID_T_H
00046 #include "stid_t.h"
00047 #endif
00048 #ifndef VEC_T_H
00049 #include "vec_t.h"
00050 #endif
00051 
00052 
00053 
00054 
00055 
00056 
00057 struct kvl_t {
00058     stid_t            stid;
00059     w_base_t::uint4_t        h;
00060     w_base_t::uint4_t        g;
00061 
00062     static const cvec_t eof;
00063     static const cvec_t bof;
00064 
00065     
00066     NORET            kvl_t();
00067     
00068     NORET            kvl_t(stid_t id, const cvec_t& v);
00069     
00070     NORET            kvl_t(
00071         stid_t                _stid,
00072         const cvec_t&         v1, 
00073         const cvec_t&         v2);
00074 
00075     NORET            ~kvl_t();
00076     
00077     NORET            kvl_t(const kvl_t& k);
00078 
00079     kvl_t&             operator=(const kvl_t& k);
00080 
00081     kvl_t&             set(stid_t s, const cvec_t& v);
00082     kvl_t&             set(stid_t s,
00083         const cvec_t&         v1,
00084         const cvec_t&         v2);
00085     bool operator==(const kvl_t& k) const;
00086     bool operator!=(const kvl_t& k) const;
00087     friend ostream& operator<<(ostream&, const kvl_t& k);
00088     friend istream& operator>>(istream&, kvl_t& k);
00089 };
00090 
00091 inline NORET
00092 kvl_t::kvl_t()
00093     : stid(stid_t::null), h(0), g(0)
00094 {
00095 }
00096 
00097 inline NORET
00098 kvl_t::kvl_t(stid_t id, const cvec_t& v)
00099     : stid(id)
00100 {
00101     v.calc_kvl(h), g = 0;
00102 }
00103 
00104 inline NORET
00105 kvl_t::kvl_t(stid_t id, const cvec_t& v1, const cvec_t& v2)
00106     : stid(id)  
00107 {
00108     v1.calc_kvl(h); v2.calc_kvl(g);
00109 }
00110 
00111 inline NORET
00112 kvl_t::~kvl_t()
00113 {
00114 }
00115 
00116 inline NORET
00117 kvl_t::kvl_t(const kvl_t& k)
00118     : stid(k.stid), h(k.h), g(k.g)
00119 {
00120 }
00121 
00122 inline kvl_t& 
00123 kvl_t::operator=(const kvl_t& k)
00124 {
00125     stid = k.stid;
00126     h = k.h, g = k.g;
00127     return *this;
00128 }
00129     
00130 
00131 inline kvl_t&
00132 kvl_t::set(stid_t s, const cvec_t& v)
00133 {
00134     stid = s, v.calc_kvl(h), g = 0;
00135     return *this;
00136 }
00137 
00138 inline kvl_t& 
00139 kvl_t::set(stid_t s, const cvec_t& v1, const cvec_t& v2)
00140 {
00141     stid = s, v1.calc_kvl(h), v2.calc_kvl(g);
00142     return *this;
00143 }
00144 
00145 inline bool
00146 kvl_t::operator==(const kvl_t& k) const
00147 {
00148     return h == k.h && g == k.g;
00149 }
00150 
00151 inline bool
00152 kvl_t::operator!=(const kvl_t& k) const
00153 {
00154     return ! (*this == k);
00155 }
00156 
00157 
00158 
00159 #endif