Changeset 783 for cpp/frams


Ignore:
Timestamp:
05/16/18 21:20:31 (7 years ago)
Author:
Maciej Komosinski
Message:

Removed the unused "info" field and fixed a bug with incorrect pointers to content stored in a vector

Location:
cpp/frams/genetics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/f4/f4_conv.cpp

    r779 r783  
    4242GenoConv_F41_TestOnly::GenoConv_F41_TestOnly()
    4343{
    44         name = "test-only approximate f4 -> f1 converter";
     44        name = "Only for testing, approximate f4->f1 converter"; //Do not use in production! (adam)
    4545        in_format = '4';
    4646        out_format = '1';
    4747        mapsupport = 0;
    48         info = "This is for testing.  Do not use in production! (adam)";
    4948}
    5049
  • cpp/frams/genetics/genoconv.cpp

    r732 r783  
    5050        tab[0].name = "gkparam:";
    5151        gcnames.clear();
     52        gcnames.reserve(gcm->converters.size()); //avoid reallocations in the loop below, since we externally store pointers to objects saved in this vector
    5253        for (i = 0, pe = tab + 1; gk = (GenoConverter *)gcm->converters(i); pe++, i++)
    5354        {
     
    5758                std::string descr = "f";
    5859                descr += gk->in_format;
    59                 descr += " -> f";
     60                descr += " --> f";
    6061                descr += gk->out_format;
    61                 descr += " : ";
     62                descr += "  : ";
    6263                descr += gk->name;
    6364                gcnames.push_back(descr);
    64                 pe->name = descr.c_str();
     65                pe->name = gcnames.back().c_str(); //externally store a pointer to the object just saved in the vector
    6566                pe->type = "d 0 1";
    66                 pe->help = gk->info;
    6767        }
    6868        pe->id = 0;
  • cpp/frams/genetics/genoconv.h

    r735 r783  
    2020{
    2121        GenoConvManager *gcm;
    22         std::vector<std::string> gcnames;
     22        std::vector<std::string> gcnames; //stores names of converters so that these names persist and pointers to these names can be safely used externally
    2323        char tmp_id[20];
    2424        void freetab();
     
    4545        char in_format,         //< input format, eg. '1'
    4646                out_format;     //< output format, eg. '0'
    47         const char *info;       //< detailed info about converter, format or copyright
    4847        paInt enabled;  //< don't touch this! (used by configuration module)
    4948        paInt mapsupport; //< set to 1 if your converter supports genotype mapping
     
    5756        virtual ~GenoConverter() {}
    5857        /// Don't forget to set public fields in your constructor
    59         GenoConverter() :name(""), in_format(-1), out_format('0'), info(""), enabled(1), mapsupport(0) {}
     58        GenoConverter() :name(""), in_format(-1), out_format('0'), enabled(1), mapsupport(0) {}
    6059};
    6160
Note: See TracChangeset for help on using the changeset viewer.