Ignore:
Timestamp:
11/30/19 02:13:25 (4 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

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

    r844 r899  
    2424class MultiRange;
    2525
    26 typedef UserTags<Model, void*, 5> ModelUserTags;
     26typedef UserTags<Model, void *, 5> ModelUserTags;
    2727
    2828/** Common base for model elements. */
     
    3131public:
    3232        SString vis_style;
    33         PartBase(const SString& s) :vis_style(s), mapped(0) {}
     33        PartBase(const SString &s) :vis_style(s), mapped(0) {}
    3434        ~PartBase();
    35         static SString getDefaultStyle(){ return SString("none"); }
     35        static SString getDefaultStyle() { return SString("none"); }
    3636        MultiRange *mapped;
    3737        enum PartBaseFlags { Selected = 1 };
     
    4848
    4949        void clearMapping();
    50         MultiRange* getMapping() { return mapped; }
     50        MultiRange *getMapping() { return mapped; }
    5151        void setMapping(const IRange &mr);
    5252        void addMapping(const IRange &mr);
     
    5454        void addMapping(const MultiRange &mr);
    5555
    56         void setInfo(const SString& name, const SString& value);
    57         void setInfo(const SString& name, int value);
    58         void setInfo(const SString& name, double value);
    59         SString getInfo(const SString& name);
     56        void setInfo(const SString &name, const SString &value);
     57        void setInfo(const SString &name, int value);
     58        void setInfo(const SString &name, double value);
     59        SString getInfo(const SString &name);
    6060};
    6161
     
    9494
    9595        Part(enum Shape s = SHAPE_BALL_AND_STICK);
    96         Part(const Part& src) :PartBase(getDefaultStyle()) { operator=(src); }
    97         void operator=(const Part& src);
     96        Part(const Part &src) :PartBase(getDefaultStyle()) { operator=(src); }
     97        void operator=(const Part &src);
    9898
    9999        void setPositionAndRotationFromAxis(const Pt3D &p1, const Pt3D &p2);
     
    101101        void setRot(const Pt3D &r);///< set part.rot (rotation angles) and calculate part.o
    102102
    103         static Param& getStaticParam();
     103        static Param &getStaticParam();
    104104};
    105105
     
    128128
    129129        Joint();
    130         Joint(const Joint& src) :PartBase(getDefaultStyle()) { operator=(src); }
    131         void operator=(const Joint& src);
     130        Joint(const Joint &src) :PartBase(getDefaultStyle()) { operator=(src); }
     131        void operator=(const Joint &src);
    132132
    133133        /** connect two parts with this joint.
     
    135135                @see isDelta()
    136136                */
    137         void attachToParts(Part* p1, Part* p2);
     137        void attachToParts(Part *p1, Part *p2);
    138138        /// @see attachToParts(Part*,Part*)
    139139        void attachToParts(int p1, int p2);
     
    168168        Pt3D vcolor;
    169169
    170         static Param& getStaticParam();
     170        static Param &getStaticParam();
    171171};
    172172
    173173#define JOINT_DELTA_MARKER 99999.0
    174174
    175 ////////////////// NN /////////////////
     175
     176
     177////////////////// Neural Network /////////////////
    176178
    177179class NeuroClass;
    178180
    179 typedef UserTags<NeuroClass, void*, 5> NeuroClassUserTags;
     181typedef UserTags<NeuroClass, void *, 5> NeuroClassUserTags;
    180182
    181183/** Information about neuron class.
     
    184186{
    185187        bool ownedvectordata;
    186         void operator=(const NeuroClass& nosuchthich){}
     188        void operator=(const NeuroClass &nosuchthich) {}
    187189public:
    188190        SString name, longname, description;
     
    207209        /** class name for use in Neuro::setClassName(), Neuro::setDetails() (former 'moredata' field),
    208210                eg. "N","-",G" */
    209         const SString& getName() { return name; }
     211        const SString &getName() { return name; }
    210212        /** human friendly name, eg. "Neuron","Link","Gyroscope"  */
    211         const SString& getLongName() { return longname; }
     213        const SString &getLongName() { return longname; }
    212214        /** long description */
    213         const SString& getDescription() { return description; }
    214         ParamEntry* getParamTab() { return props; }
     215        const SString &getDescription() { return description; }
     216        ParamEntry *getParamTab() { return props; }
    215217
    216218        /** NeuroClass specific properties, recognized by all neurons of this class */
     
    240242                }
    241243                */
    242         int* getSymbolGlyph()
     244        int *getSymbolGlyph()
    243245        {
    244246                return vectordata;
     
    246248        void setSymbolGlyph(int *data, bool owned = 1)
    247249        {
    248                 if (vectordata&&ownedvectordata) delete[]vectordata;
     250                if (vectordata && ownedvectordata) delete[]vectordata;
    249251                vectordata = data; ownedvectordata = owned;
    250252        }
     
    282284
    283285        static void resetActive(); ///< set default values of active and genactive for all classes
    284         static void setGenActive(const char* classes[]); ///< set genactive for specified classes
    285 };
    286 
    287 class Neuro;
    288 
    289 /** Single processing unit in Framsticks NN.  */
     286        static void setGenActive(const char *classes[]); ///< set genactive for specified classes
     287};
     288
     289
     290
     291
     292
     293
     294/** Single processing unit in Framsticks neural network.  */
    290295class Neuro : public PartBase
    291296{
     
    305310        /** set myclass and make knownclass=true */
    306311        void checkClass();
    307         SString** inputInfo(int i);
     312        SString **inputInfo(int i);
    308313        void defassign();
    309314
     
    313318        Param extraProperties();
    314319
    315         void setInputInfo(int i, const SString& name, const SString &value);
    316         void setInputInfo(int i, const SString& name, int value);
    317         void setInputInfo(int i, const SString& name, double value);
     320        void setInputInfo(int i, const SString &name, const SString &value);
     321        void setInputInfo(int i, const SString &name, int value);
     322        void setInputInfo(int i, const SString &name, double value);
    318323        SString getInputInfo(int i);
    319         SString getInputInfo(int i, const SString& name);
    320 
    321         NeuroClass* getClass();
    322         void setClass(NeuroClass*);
     324        SString getInputInfo(int i, const SString &name);
     325
     326        NeuroClass *getClass();
     327        void setClass(NeuroClass *);
    323328
    324329        SString getClassParams() { return myclassparams; }
    325         void setClassParams(const SString& cp) { myclassparams = cp; }
     330        void setClassParams(const SString &cp) { myclassparams = cp; }
    326331
    327332        SString getClassName();
    328         void setClassName(const SString& clazz);
     333        void setClassName(const SString &clazz);
    329334
    330335        /** return neuro unit details encoded as <CLASS> ":" <PROPERTIES>
     
    351356                @see getDetails()
    352357                */
    353         void setDetails(const SString&);
     358        void setDetails(const SString &);
    354359
    355360#define STATRICKCLASS Neuro
     
    377382        Neuro();
    378383        Neuro(double _state, double _inertia, double _force, double _sigmo);
    379         Neuro(const Neuro& src) :PartBase(getDefaultStyle()) { operator=(src); }
     384        Neuro(const Neuro &src) :PartBase(getDefaultStyle()) { operator=(src); }
    380385
    381386        ~Neuro();
    382387
    383         void operator=(const Neuro& src);
     388        void operator=(const Neuro &src);
    384389
    385390        /** Attach this Neuro to the specified Part or detach it from the body if p==NULL.
     
    387392                @see getPart()
    388393                */
    389         void attachToPart(Part* p) { part = p; joint = 0; }
     394        void attachToPart(Part *p) { part = p; joint = 0; }
    390395
    391396        /** Attach this Neuro to the specified Joint or detach it from the body if p==NULL.
     
    393398                @see getJoint()
    394399                */
    395         void attachToJoint(Joint* j) { joint = j; part = 0; }
     400        void attachToJoint(Joint *j) { joint = j; part = 0; }
    396401
    397402        void attachToPart(int i);
     
    422427
    423428        /** @return the Neuro connected as i-th input */
    424         Neuro* getInput(int i) const { return (i >= inputs.size()) ? 0 : inputs(i).n; }
     429        Neuro *getInput(int i) const { return (i >= inputs.size()) ? 0 : inputs(i).n; }
    425430        /** @return the Neuro connected as i-th input.
    426431                @param weight
    427432                */
    428         Neuro* getInput(int i, double &weight) const;
     433        Neuro *getInput(int i, double &weight) const;
    429434        /** @return connectin weight for i-th input */
    430435        double getInputWeight(int i) const;
     
    432437        void setInputWeight(int i, double weight);
    433438        /** connect i-th input with another neuron */
    434         void setInput(int i, Neuro*n);
     439        void setInput(int i, Neuro *n);
    435440        /** connect i-th input with another neuron */
    436         void setInput(int i, Neuro*n, double weight);
     441        void setInput(int i, Neuro *n, double weight);
    437442        /** add new input. @return its reference number */
    438         int addInput(Neuro* child, double weight = 1.0, const SString* info = 0);
     443        int addInput(Neuro *child, double weight = 1.0, const SString *info = 0);
    439444        /** @return reference number [0..InputCount-1] of the input
    440445           or -1 if 'child' is not connected with this Neuro.*/
    441         int findInput(Neuro* child) const;
     446        int findInput(Neuro *child) const;
    442447        void removeInput(paInt refno);
    443448        /**    @return reference number of the child connection, like findInput() */
    444         int removeInput(Neuro* child);
    445 
    446         int findInputs(SList& result, const char* classname = 0, const Part* part = 0, const Joint* joint = 0) const;
    447         int findOutputs(SList& result, const char* classname = 0, const Part* part = 0, const Joint* joint = 0) const;
     449        int removeInput(Neuro *child);
     450
     451        int findInputs(SList &result, const char *classname = 0, const Part *part = 0, const Joint *joint = 0) const;
     452        int findOutputs(SList &result, const char *classname = 0, const Part *part = 0, const Joint *joint = 0) const;
    448453
    449454        /* class database retrieval */
     
    453458                */
    454459        static SString getClassName(int classindex);
    455         static NeuroClass* getClass(int classindex);
    456         static NeuroClass* getClass(const SString& classname);
    457         static int getClassIndex(const NeuroClass*nc);
     460        static NeuroClass *getClass(int classindex);
     461        static NeuroClass *getClass(const SString &classname);
     462        static int getClassIndex(const NeuroClass *nc);
    458463
    459464        // not really private, but you should not access those directly
     
    468473        Orient o;       ///< rotation matrix calculated from "rot"
    469474        static ParamEntry emptyParamTab[];
    470         static Param& getStaticParam();
     475        static Param &getStaticParam();
    471476};
    472477
Note: See TracChangeset for help on using the changeset viewer.