Ignore:
Timestamp:
01/19/18 19:37:43 (7 years ago)
Author:
Maciej Komosinski
Message:
  • Changed Model::singleStepBuild() to Model::addFromString() to create model elements; the latter requires explicit indication of element type (P/J/N/C)
  • Removed old compatibility source (#ifdef MODEL_V1_COMPATIBLE) from f1->f0 converter and neuron definitions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/model.h

    r660 r726  
    7575        SList parts, joints, neurons;
    7676        char partmappingchanged;
    77 
    78 #ifdef MODEL_V1_COMPATIBLE
    79         /** NeuroCount value.
    80                 compatibility_neurocount = -1 if its value is unknown and the layout is not compatible
    81                 @see reorderToOldLayout()
    82                 */
    83         int oldneurocount;
    84         char oldconnections;
    85 
    86         /** calculate oldNeuroCount */
    87         void calcOldNeuroCount();
    88         /** some new calls can invalidate old compatibility data */
    89         void invalidateOldNeuroCount() {oldneurocount=-1;}
    90         /**
    91            for compatibility with old NeuroClass the layout of Neurons
    92            is changed when old 'Neuro' accessing methods are in use.
    93            Neurons:
    94            0 .. compatibility_neurocount-1                : old Neurons (class "N")
    95            compatibility_neurocount .. neurons.size()-1   : other units
    96            */
    97         int reorderToOldLayout();
    98 
    99         /** check if compatibility should be preserved */
    100         int hasOldNeuroLayout() {return oldneurocount>=0;}
    101 
    102         /** add inputs to the old "-" units.
    103                 @return 1=ok, 0=invalid input detected  */
    104         int addOldConnectionsInputs();
    105 #endif
    10677
    10778        void internalCopy(const Model &mod);
     
    284255        void clear();
    285256
     257        enum ItemType { UnknownType,ModelType,PartType,JointType,NeuronType,NeuronConnectionType };
     258        static ItemType itemTypeFromLinePrefix(const char* line);
    286259        /** Execute single line of <B>f0</B> genotype.
    287260                Return value is non-negative reference number of the created item,
     
    291264                @param srcrange source genotype range which will be mapped to this element
    292265                */
    293         int singleStepBuild(const SString &singleline, int line_num, const MultiRange* srcrange = NULL);
     266        int addFromString(ItemType item_type,const SString &singleline, int line_num, const MultiRange* srcrange = NULL);
    294267        /** Execute single line of <B>f0</B> genotype - compatiblity variant */
    295         int singleStepBuild(const SString &singleline, const MultiRange* srcrange = NULL);
     268        int addFromString(ItemType item_type,const SString &singleline, const MultiRange* srcrange = NULL);
    296269        /** Execute single line of <B>f0</B> genotype - low level variant, used by Model::build(), error messages returned as string instead of calling logger */
    297         int singleStepBuildNoLog(const SString &singleline, SString& error_message, const MultiRange* srcrange = 0);
     270        int addFromStringNoLog(ItemType item_type,const SString &singleline, SString& error_message, const MultiRange* srcrange = 0);
    298271
    299272        /// separate build stages (for future use)
     
    346319        /// you can access neurons 0 .. getNeuroCount()-1.
    347320        Neuro *getNeuro(int i) const;
    348 
    349 #ifdef MODEL_V1_COMPATIBLE
    350         /* compatibility calls for accessing old Neuro objects */
    351 
    352         /// @deprecated Neuro class will be removed soon
    353         /// @see compat
    354         int old_getNeuroCount();
    355         /// you can access neurons 0 .. getNeuroCount()-1.
    356         /// @deprecated Neuro class will be removed soon
    357         Neuro *old_getNeuro(int i);
    358         /// @see addNewNeuro, addNeuro
    359         /// @deprecated Neuro class will be removed soon
    360         Neuro *old_addNewNeuro();
    361         /// @return neuro index or -1 if not found
    362         /// @deprecated Neuro class will be removed soon
    363         int old_findNeuro(Neuro* n);
    364 #endif
    365321
    366322        /** create new Part and add it to the model. @see addPart()  */
Note: See TracChangeset for help on using the changeset viewer.