00001 #include<TMuiKeyGen.h>
00002 #include<MUIOO.h>
00003
00004 using namespace MUIOO;
00005
00006 PHKey::object_key_type TMuiKeyGen::get_key(UShort_t i_arm,
00007 UShort_t i_plane,
00008 UShort_t i_panel,
00009 UShort_t i_orientation,
00010 UShort_t i_index){
00011
00012
00013 return ((ARM_MASK & i_arm) << ARM_SHIFT) |
00014 ((PLANE_MASK & i_plane) << PLANE_SHIFT) |
00015 ((PANEL_MASK & i_panel) << PANEL_SHIFT) |
00016 ((ORIENTATION_MASK & i_orientation) << ORIENTATION_SHIFT) |
00017 ((INDEX_MASK & i_index) << INDEX_SHIFT);
00018 }
00019
00020 PHKey::object_key_type TMuiKeyGen::get_hash_key(UShort_t i_arm,
00021 UShort_t i_plane,
00022 UShort_t i_panel,
00023 UShort_t i_orientation)
00024 {
00025 return i_arm*(MAX_PLANE*MAX_PANEL*MAX_ORIENTATION) +
00026 i_plane*(MAX_PANEL*MAX_ORIENTATION) +
00027 i_panel*(MAX_ORIENTATION) +
00028 i_orientation;
00029 }
00030
00031 TMuiKeyGen::key_range TMuiKeyGen::get_key_range(UShort_t i_arm,
00032 UShort_t i_plane,
00033 UShort_t i_panel,
00034 UShort_t i_orientation){
00035
00036 return std::make_pair(get_key(i_arm,
00037 i_plane,
00038 i_panel,
00039 i_orientation,
00040 0),
00041 get_key(i_arm,
00042 i_plane,
00043 i_panel,
00044 i_orientation+1,
00045 0)-1);
00046 }
00047
00048
00049 PHKey::object_key_type TMuiKeyGen::get_key(UShort_t i_arm,
00050 UShort_t i_plane,
00051 UShort_t index){
00052
00053
00054 return ((ARM_MASK & i_arm) << ARM_SHIFT) |
00055 ((PLANE_MASK & i_plane) << PLANE_SHIFT) |
00056 ((INDEX_MASK & index) << INDEX_SHIFT);
00057 }
00058 TMuiKeyGen::key_range TMuiKeyGen::get_key_range(UShort_t i_arm,
00059 UShort_t i_plane){
00060
00061
00062
00063 return std::make_pair(get_key(i_arm,
00064 i_plane,
00065 0),
00066 get_key(i_arm,
00067 i_plane+1,
00068 0)-1);
00069 }
00070
00071
00072 PHKey::object_key_type TMuiKeyGen::get_key(UShort_t i_arm,
00073 UShort_t i_index)
00074 {
00075
00076
00077 return ((ARM_MASK & i_arm) << ARM_SHIFT) |
00078 ((INDEX_MASK & i_index) << INDEX_SHIFT);
00079 }
00080
00081 TMuiKeyGen::key_range TMuiKeyGen::get_key_range(UShort_t i_arm){
00082 return std::make_pair(get_key(i_arm,
00083 0),
00084 get_key(i_arm+1,
00085 0)-1);
00086 }
00087
00088 int TMuiKeyGen::get_index(PHKey::object_key_type tmpKey)
00089 {
00090 return (INDEX_MASK&tmpKey);
00091 }