Changeset 372 for cpp/frams/model


Ignore:
Timestamp:
04/22/15 04:14:59 (10 years ago)
Author:
sz
Message:

Renamed some classes and functions to make their purpose more obvious:

All MessageHandlers? must now be given the explicit "Enable" argument if you want them to automatically become active. This makes side effects clearly visible.

Location:
cpp/frams/model
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/geometry/geometryutils.cpp

    r286 r372  
    8282                        break;
    8383        }
    84         FMprintf("GeometryUtils", "isPointInsidePart", FMLV_ERROR, "Part shape=%d not supported", part->shape);
     84        Hprintf("GeometryUtils", "isPointInsidePart", HMLV_ERROR, "Part shape=%d not supported", part->shape);
    8585        return false;
    8686}
     
    102102                        break;
    103103        }
    104         FMprintf("GeometryUtils", "isPointStrictlyInsidePart", FMLV_ERROR, "Part shape=%d not supported", part->shape);
     104        Hprintf("GeometryUtils", "isPointStrictlyInsidePart", HMLV_ERROR, "Part shape=%d not supported", part->shape);
    105105        return false;
    106106}
  • cpp/frams/model/geometry/meshbuilder.cpp

    r322 r372  
    639639
    640640                default:
    641                         FMprintf("MeshBuilder::PartSurface", "initialize", FMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);
     641                        Hprintf("MeshBuilder::PartSurface", "initialize", HMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);
    642642        }
    643643}
     
    725725
    726726                default:
    727                         FMprintf("MeshBuilder::PartApices", "initialize", FMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);
     727                        Hprintf("MeshBuilder::PartApices", "initialize", HMLV_WARN, "Part shape=%d not supported, skipping...", part->shape);
    728728        }
    729729}
  • cpp/frams/model/geometry/modelgeometryinfo.cpp

    r286 r372  
    1616        if (points.size() < 1) //maybe 1 or 2 points are also not enough for findSizesAndAxesOfPointsGroup() to work...
    1717        {
    18                 FMprintf("ModelGeometryInfo", "findSizesAndAxesOfModel", FMLV_ERROR, "Empty points sample for model with %d part(s)", model.getPartCount());
     18                Hprintf("ModelGeometryInfo", "findSizesAndAxesOfModel", HMLV_ERROR, "Empty points sample for model with %d part(s)", model.getPartCount());
    1919                sizes = Pt3D_0;
    2020                axes = Orient_1;
     
    116116                        return externalAreaOfCylinder(model, partIndex, density);
    117117        }
    118         FMprintf("ModelGeometryInfo", "externalAreaOfPart", FMLV_ERROR, "Part shape=%d not supported", part->shape);
     118        Hprintf("ModelGeometryInfo", "externalAreaOfPart", HMLV_ERROR, "Part shape=%d not supported", part->shape);
    119119        return 0;
    120120}
  • cpp/frams/model/model.cpp

    r348 r372  
    55#include <common/nonstd_math.h>
    66#include "model.h"
    7 #include <common/framsg.h>
     7#include <common/hmessage.h>
    88#include <frams/util/multimap.h>
    9 #include <frams/errmgr/errmanager.h>
     9#include <frams/mhandlers/mhandlers.h>
    1010
    1111Model::Model()
     
    317317SString line;
    318318MultiRange frommap;
    319 ErrorHandler err(ErrorHandler::DontBlock);
     319MessageHandlerToMemory mh(MessageHandlerBase::Enable | MessageHandlerBase::DontBlock);
    320320for (;f0txt.getNextToken(pos,line,'\n');lnum++)
    321321        {
     
    325325                frommap.add(lastpos,pos-1);
    326326                }
    327         err.reset();
     327        mh.reset();
    328328        if (singleStepBuild(line,autobuildmaps ? (&frommap) : 0)==-1)
    329329                {
    330330                buildstatus=invalid;
    331                 FMprintf("Model","build",FMLV_ERROR,
     331                Hprintf("Model","build",HMLV_ERROR,
    332332                         geno.getName().len()?"illegal f0 code at line %d (%s)":"illegal f0 code at line %d",
    333333                         lnum,geno.getName().c_str());
     
    336336                return;
    337337                }
    338         if (err.getWarningCount())
     338        if (mh.getWarningCount())
    339339                {if (f0warnposition<0) f0warnposition=lastpos;}
    340340        lastpos=pos;
    341341        }
    342 err.disable();
     342mh.disable();
    343343close();
    344344if (convmap)
     
    513513{
    514514if (buildstatus!=building)
    515         FMprintf("Model","close",FMLV_WARN,"unexpected close() - no open()");
     515        Hprintf("Model","close",HMLV_WARN,"unexpected close() - no open()");
    516516if (internalcheck(1)>0)
    517517        {
     
    609609                {
    610610                delete j;
    611                 FMprintf("Model","build",FMLV_ERROR,
     611                Hprintf("Model","build",HMLV_ERROR,
    612612                         "invalid part reference for joint #%d",getJointCount()-1);
    613613                return -1;
     
    694694                return 0;
    695695                }
    696         FMprintf("Model","build",FMLV_ERROR,
     696        Hprintf("Model","build",HMLV_ERROR,
    697697                 "invalid neuron connection #%d <- #%d",c.n1_refno,c.n2_refno);
    698698        return -1;
     
    782782                        else
    783783                                {
    784                                 FMprintf("Model","internalCheck",FMLV_ERROR,
     784                                Hprintf("Model","internalCheck",HMLV_ERROR,
    785785                                         "illegal N-N connection #%d (reference to #%d) (%s)",
    786786                                         i,n->conn_refno,(const char*)geno.getName());
     
    853853if (var -> field < getMin ## template () . field) \
    854854        { var->field= getMin ## template () . field; \
    855         FMprintf("Model","internalCheck",FMLV_WARN,# field " too small in " # template "#%d (adjusted)",i);} \
     855        Hprintf("Model","internalCheck",HMLV_WARN,# field " too small in " # template "#%d (adjusted)",i);} \
    856856else if (var -> field > getMax ## template () . field) \
    857857        { var->field= getMax ## template ()  . field; \
    858         FMprintf("Model","internalCheck",FMLV_WARN,# field " too big in " # template "#%d (adjusted)",i);}
     858        Hprintf("Model","internalCheck",HMLV_WARN,# field " too big in " # template "#%d (adjusted)",i);}
    859859
    860860#define LINKFLAG 0x8000000
     
    912912                        {
    913913                        shape=SHAPE_ILLEGAL;
    914                         FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent part shapes (mixed old and new shapes)");
     914                        Hprintf("Model","internalCheck",HMLV_WARN,"Inconsistent part shapes (mixed old and new shapes)");
    915915                        }
    916916                }
     
    941941                                {
    942942                                ret=0;
    943                                 FMprintf("Model","internalCheck",FMLV_ERROR,
     943                                Hprintf("Model","internalCheck",HMLV_ERROR,
    944944                                         "delta joint cycle detected at joint#%d (%s)",
    945945                                         i,geno.getName().c_str());
     
    978978                        {
    979979                        ret=0;
    980                         FMprintf("Model","internalCheck",FMLV_ERROR,"delta too big in joint #%d (%s)",
     980                        Hprintf("Model","internalCheck",HMLV_ERROR,"delta too big in joint #%d (%s)",
    981981                                 i,geno.getName().c_str());
    982982                        }
     
    984984                        {
    985985                        ret=0;
    986                         FMprintf("Model","internalCheck",FMLV_ERROR,"delta too small in joint #%d (%s)",
     986                        Hprintf("Model","internalCheck",HMLV_ERROR,"delta too small in joint #%d (%s)",
    987987                                 i,geno.getName().c_str());
    988988                        }
     
    992992        else
    993993                {
    994                 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal part references in joint #%d (%s)",
     994                Hprintf("Model","internalCheck",HMLV_ERROR,"illegal part references in joint #%d (%s)",
    995995                         i,geno.getName().c_str());
    996996                ret=0;
     
    10011001                        {
    10021002                        shape=SHAPE_ILLEGAL;
    1003                         FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent joint shapes (mixed old and new shapes)");
     1003                        Hprintf("Model","internalCheck",HMLV_WARN,"Inconsistent joint shapes (mixed old and new shapes)");
    10041004                        }
    10051005                }
     
    10711071                if (!(p->flags&LINKFLAG))
    10721072                        {
    1073                         FMprintf("Model","internalCheck",FMLV_ERROR,"not all parts connected (eg.#0-#%d) (%s)",
     1073                        Hprintf("Model","internalCheck",HMLV_ERROR,"not all parts connected (eg.#0-#%d) (%s)",
    10741074                                 i,geno.getName().c_str());
    10751075                        ret=0;
     
    10841084        if (j->p1_refno==j->p2_refno)
    10851085                {
    1086                 FMprintf("Model","internalCheck",FMLV_ERROR,"illegal self connection, joint #%d (%s)",
     1086                Hprintf("Model","internalCheck",HMLV_ERROR,"illegal self connection, joint #%d (%s)",
    10871087                         i,geno.getName().c_str());
    10881088                ret=0;
     
    10951095                    || ((j->p1_refno==j2->p2_refno)&&(j->p2_refno==j2->p1_refno)))
    10961096                        {
    1097                         FMprintf("Model","internalCheck",FMLV_ERROR,"illegal duplicate joints #%d and #%d (%s)",
     1097                        Hprintf("Model","internalCheck",HMLV_ERROR,"illegal duplicate joints #%d and #%d (%s)",
    10981098                                 i,k,geno.getName().c_str());
    10991099                        ret=0;
     
    11251125{
    11261126if (buildstatus==building)
    1127         FMprintf("Model","getGeno",FMLV_WARN,"model was not completed - missing close()");
     1127        Hprintf("Model","getGeno",HMLV_WARN,"model was not completed - missing close()");
    11281128if (buildstatus!=valid)
    11291129        return Geno("",'0',"","invalid");
Note: See TracChangeset for help on using the changeset viewer.