Changeset 8311 for trunk

Show
Ignore:
Timestamp:
20/12/11 14:33:05 (5 months ago)
Author:
westram
Message:
  • splitted pseudo-module ps_pg_tree_functions.cxx into two headers
  • some functions inline instead of static
Location:
trunk/PROBE_SET
Files:
5 modified
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/PROBE_SET/Makefile

    r7623 r8311  
    127127ps_arb2asciipaths.o: ps_defs.hxx 
    128128ps_arb2asciipaths.o: ps_filebuffer.hxx 
    129 ps_arb2asciipaths.o: ps_pg_tree_functions.cxx 
     129ps_arb2asciipaths.o: ps_pg_tree_functions.hxx 
    130130ps_arb2asciipaths.o: $(ARBHOME)/INCLUDE/ad_prot.h 
    131131ps_arb2asciipaths.o: $(ARBHOME)/INCLUDE/arb_assert.h 
     
    146146ps_convert_db.o: ps_filebuffer.hxx 
    147147ps_convert_db.o: ps_node.hxx 
    148 ps_convert_db.o: ps_pg_tree_functions.cxx 
     148ps_convert_db.o: ps_pg_specmap.hxx 
     149ps_convert_db.o: ps_pg_tree_functions.hxx 
    149150ps_convert_db.o: ps_tools.hxx 
    150151ps_convert_db.o: $(ARBHOME)/INCLUDE/ad_prot.h 
     
    222223ps_get_probes.o: ps_defs.hxx 
    223224ps_get_probes.o: ps_filebuffer.hxx 
    224 ps_get_probes.o: ps_pg_tree_functions.cxx 
     225ps_get_probes.o: ps_pg_tree_functions.hxx 
    225226ps_get_probes.o: $(ARBHOME)/INCLUDE/ad_prot.h 
    226227ps_get_probes.o: $(ARBHOME)/INCLUDE/arb_assert.h 
  • trunk/PROBE_SET/ps_arb2asciipaths.cxx

    r8309 r8311  
    1111 
    1212#include "ps_filebuffer.hxx" 
    13 #include "ps_pg_tree_functions.cxx" 
     13#include "ps_pg_tree_functions.hxx" 
    1414 
    1515static IDVector *__PATH = new IDVector; 
  • trunk/PROBE_SET/ps_convert_db.cxx

    r8309 r8311  
    1212#include "ps_tools.hxx" 
    1313#include "ps_database.hxx" 
    14 #include "ps_pg_tree_functions.cxx" 
     14#include "ps_pg_tree_functions.hxx" 
     15#include "ps_pg_specmap.hxx" 
    1516 
    1617#include <sys/times.h> 
  • trunk/PROBE_SET/ps_detect_weak_differences.cxx

    r8309 r8311  
    3333static SpeciesID          __ONEMATCH_MAX_ID; 
    3434 
     35#if defined(DEBUG) 
    3536static void PS_print_path() { 
    3637    printf("__PATH %3zu :", __PATH->size()); 
     
    5253    printf("\n"); 
    5354} 
    54  
     55#endif 
    5556 
    5657static void PS_detect_weak_differences_stepdown(const PS_NodePtr _ps_node, 
  • trunk/PROBE_SET/ps_get_probes.cxx

    r8309 r8311  
    1010// =============================================================== // 
    1111 
    12 #include "ps_pg_tree_functions.cxx" 
     12#include "ps_pg_tree_functions.hxx" 
    1313#include "ps_filebuffer.hxx" 
    1414 
  • trunk/PROBE_SET/ps_pg_specmap.hxx

    r8309 r8311  
    1 #ifndef PS_PG_TREE_FUNCTIONS_CXX 
    2 #define PS_PG_TREE_FUNCTIONS_CXX 
     1#ifndef PS_PG_SPECMAP_HXX 
     2#define PS_PG_SPECMAP_HXX 
    33 
    4 #ifndef PS_DEFS_HXX 
    5 #include "ps_defs.hxx" 
    6 #endif 
    7  
    8 #ifndef ARBDB_H 
    9 #include <arbdb.h> 
    10 #endif 
    11  
    12 using namespace std; 
    13  
    14 // API for Probe-Group-Database format 
    15  
    16 // -------------------------------------------------------------------------------- 
    17 // mapping shortname <-> SpeciesID 
     4// ----------------------------------------- 
     5//      mapping shortname <-> SpeciesID 
    186 
    197static Name2IDMap __NAME2ID_MAP; 
     
    6149} 
    6250 
    63 static const string& PG_SpeciesID2SpeciesName(SpeciesID num) { 
     51inline const string& PG_SpeciesID2SpeciesName(SpeciesID num) { 
    6452  ps_assert(__MAPS_INITIALIZED); // you didn't call PG_initSpeciesMaps 
    6553  return __ID2NAME_MAP[num]; 
     
    7058} 
    7159 
    72 // db-structure of group_tree: 
    73 // 
    74 //                  <root> 
    75 //                  | 
    76 //                  | 
    77 //                  "group_tree" 
    78 //                  | 
    79 //                  | 
    80 //                  "node" <more nodes...> 
    81 //                  | | | 
    82 //                  | | | 
    83 //                  | | "group" (contains all probes for this group; may be missing) 
    84 //                  | | 
    85 //                  | "num" (contains species-number (created by PG_SpeciesName2SpeciesID)) 
    86 //                  | 
    87 //                  "node" <more nodes...> 
    88 // 
    89 //  Notes:  - the "node"s contained in the path from "group_tree" to any "group" 
    90 //            describes the members of the group 
    91  
    92  
    93  
    94 static GBDATA *PG_get_first_probe(GBDATA *pb_group) { 
    95     return GB_entry(pb_group, "probe"); 
    96 } 
    97  
    98 static GBDATA *PG_get_next_probe(GBDATA *pb_probe) { 
    99     ps_assert(GB_has_key(pb_probe, "probe")); 
    100     return GB_nextEntry(pb_probe); 
    101 } 
    102  
    103 static const char *PG_read_probe(GBDATA *pb_probe) { 
    104     return GB_read_char_pntr(pb_probe); 
    105 } 
    106  
    107 static GBDATA *PS_get_first_node(GBDATA *pb_nodecontainer) { 
    108     return GB_entry(pb_nodecontainer, "node"); 
    109 } 
    110  
    111 static GBDATA *PS_get_next_node(GBDATA *pb_node) { 
    112     ps_assert(GB_has_key(pb_node, "node")); 
    113     return GB_nextEntry(pb_node); 
    114 } 
    115  
    11660#else 
    117 #error ps_pg_tree_functions.cxx included twice 
    118 #endif 
     61#error ps_pg_specmap.hxx included twice 
     62#endif // PS_PG_SPECMAP_HXX 
  • trunk/PROBE_SET/ps_pg_tree_functions.hxx

    r8309 r8311  
    1 #ifndef PS_PG_TREE_FUNCTIONS_CXX 
    2 #define PS_PG_TREE_FUNCTIONS_CXX 
     1#ifndef PS_PG_TREE_FUNCTIONS_HXX 
     2#define PS_PG_TREE_FUNCTIONS_HXX 
    33 
    44#ifndef PS_DEFS_HXX 
    55#include "ps_defs.hxx" 
    66#endif 
    7  
    87#ifndef ARBDB_H 
    98#include <arbdb.h> 
    109#endif 
    1110 
    12 using namespace std; 
    13  
    1411// API for Probe-Group-Database format 
    15  
    16 // -------------------------------------------------------------------------------- 
    17 // mapping shortname <-> SpeciesID 
    18  
    19 static Name2IDMap __NAME2ID_MAP; 
    20 static ID2NameMap __ID2NAME_MAP; 
    21 static bool       __MAPS_INITIALIZED = false; 
    22  
    23 static GB_ERROR PG_initSpeciesMaps(GBDATA *pb_main) { 
    24  
    25   GB_transaction pb_dummy(pb_main); 
    26  
    27   ps_assert(!__MAPS_INITIALIZED); 
    28  
    29   // look for existing mapping in pb-db: 
    30   GBDATA *pb_mapping = GB_entry(pb_main, "species_mapping"); 
    31   if (!pb_mapping) {  // error 
    32     GB_export_error("No species mapping"); 
    33   } 
    34   else { 
    35     // retrieve mapping from string 
    36     const char *mapping = GB_read_char_pntr(pb_mapping); 
    37     if (!mapping) return GB_export_error("Can't read mapping"); 
    38  
    39     while (mapping[0]) { 
    40       const char *comma     = strchr(mapping, ',');   if (!comma) break; 
    41       const char *semicolon = strchr(comma, ';');     if (!semicolon) break; 
    42       string      name(mapping, comma-mapping); 
    43       comma+=1; 
    44       string idnum(comma, semicolon-comma); 
    45       SpeciesID   id        = atoi(idnum.c_str()); 
    46  
    47       __NAME2ID_MAP[name] = id; 
    48       __ID2NAME_MAP[id]   = name; 
    49  
    50       mapping = semicolon+1; 
    51     } 
    52   } 
    53  
    54   __MAPS_INITIALIZED = true; 
    55   return 0; 
    56 } 
    57  
    58 SpeciesID PG_SpeciesName2SpeciesID(const string& shortname) { 
    59   ps_assert(__MAPS_INITIALIZED); // you didn't call PG_initSpeciesMaps 
    60   return __NAME2ID_MAP[shortname]; 
    61 } 
    62  
    63 static const string& PG_SpeciesID2SpeciesName(SpeciesID num) { 
    64   ps_assert(__MAPS_INITIALIZED); // you didn't call PG_initSpeciesMaps 
    65   return __ID2NAME_MAP[num]; 
    66 } 
    67  
    68 static int PG_NumberSpecies() { 
    69     return __ID2NAME_MAP.size(); 
    70 } 
    7112 
    7213// db-structure of group_tree: 
     
    9233 
    9334 
    94 static GBDATA *PG_get_first_probe(GBDATA *pb_group) { 
     35inline GBDATA *PG_get_first_probe(GBDATA *pb_group) { 
    9536    return GB_entry(pb_group, "probe"); 
    9637} 
    9738 
    98 static GBDATA *PG_get_next_probe(GBDATA *pb_probe) { 
     39inline GBDATA *PG_get_next_probe(GBDATA *pb_probe) { 
    9940    ps_assert(GB_has_key(pb_probe, "probe")); 
    10041    return GB_nextEntry(pb_probe); 
    10142} 
    10243 
    103 static const char *PG_read_probe(GBDATA *pb_probe) { 
     44inline const char *PG_read_probe(GBDATA *pb_probe) { 
    10445    return GB_read_char_pntr(pb_probe); 
    10546} 
    10647 
    107 static GBDATA *PS_get_first_node(GBDATA *pb_nodecontainer) { 
     48inline GBDATA *PS_get_first_node(GBDATA *pb_nodecontainer) { 
    10849    return GB_entry(pb_nodecontainer, "node"); 
    10950} 
    11051 
    111 static GBDATA *PS_get_next_node(GBDATA *pb_node) { 
     52inline GBDATA *PS_get_next_node(GBDATA *pb_node) { 
    11253    ps_assert(GB_has_key(pb_node, "node")); 
    11354    return GB_nextEntry(pb_node); 
     
    11556 
    11657#else 
    117 #error ps_pg_tree_functions.cxx included twice 
    118 #endif 
     58#error ps_pg_tree_functions.hxx included twice 
     59#endif // PS_PG_TREE_FUNCTIONS_HXX