Changeset 104 for cpp/gdk/gdktest.cpp
- Timestamp:
- 07/23/13 18:15:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/gdktest.cpp
r81 r104 28 28 " ########################################\n",title); 29 29 } 30 void printProperties(Param Interface&pi)30 void printProperties(Param &pi) 31 31 { 32 32 printf(" # id type name group (%d properties)\n",pi.getPropCount()); … … 39 39 } 40 40 41 void changeOneProperty(ParamInterface &pi) 41 #define PRINT_PROPERTIES(p) {Param tmp_param(p); printProperties(tmp_param);} 42 43 void changeOneProperty(Param &pi) 42 44 { 43 45 if (pi.getPropCount()<=0) return; … … 54 56 } 55 57 58 #define CHANGE_ONE_PROPERTY(p) {Param tmp_param(p); changeOneProperty(tmp_param);} 59 56 60 void moreAboutPart(Part* p) 57 61 { … … 61 65 "and should be handled with care, because they influence other elements of the model.\n\n" 62 66 " [this data is provided by Part::properties() ]\n"); 63 printProperties(p->properties());67 PRINT_PROPERTIES(p->properties()); 64 68 printf("\nHowever, there is a subset of properties which may be modified more freely.\n" 65 69 "Properties on this list are related only to this part and can be changed\n" … … 67 71 "will be silently repaired.\n" 68 72 "\n [this data is provided by Part::extraProperties() ]\n"); 69 printProperties(p->extraProperties());73 PRINT_PROPERTIES(p->extraProperties()); 70 74 printf("\nThis set of properties can vary from release to release,\n" 71 75 "but can be safely accessed by using extraProperties() call.\n" … … 74 78 "Now we will try to change some of properties:\n\n"); 75 79 p->getModel().open(); 76 changeOneProperty(p->extraProperties());80 CHANGE_ONE_PROPERTY(p->extraProperties()); 77 81 p->getModel().close(); 78 82 printf("\nLet's see f0... (check out part #%d !)\n\n%s\n", p->refno, (const char*)p->getModel().getF0Geno().getGene()); … … 127 131 { 128 132 printf("Similarly as with Part, the full list of properties comes first:\n\n"); 129 printProperties(j->properties());133 CHANGE_ONE_PROPERTY(j->properties()); 130 134 printf("\nActually, there are two kinds of Joints: delta and absolute.\n" 131 135 "For this object, Joint::isDelta() returns %d, so this is the %s Joint.\n", … … 147 151 "The other properties are available from Joint::extraProperties()\n" 148 152 "and at the moment are defined as follows:\n\n"); 149 printProperties(j->extraProperties());153 PRINT_PROPERTIES(j->extraProperties()); 150 154 printf("\nThey can be changed just like Part's extra properties:\n"); 151 155 j->getModel().open(); 152 changeOneProperty(j->extraProperties());156 CHANGE_ONE_PROPERTY(j->extraProperties()); 153 157 j->getModel().close(); 154 158 printf("And after that we have this genotype:\n\n%s\n", (const char*)j->getModel().getF0Geno().getGene()); … … 161 165 printf("Basic features of Neuro object are similar to those of Part and Joint.\n" 162 166 "We can request a property list:\n\n"); 163 printProperties(n->properties());167 PRINT_PROPERTIES(n->properties()); 164 168 printf("\n...and extra properties (which are designed to be always valid and easy to change):\n\n"); 165 printProperties(n->extraProperties());169 PRINT_PROPERTIES(n->extraProperties()); 166 170 printf("\nAs usual, we will change something:\n"); 167 171 n->getModel().open(); 168 changeOneProperty(n->extraProperties());172 CHANGE_ONE_PROPERTY(n->extraProperties()); 169 173 n->getModel().close(); 170 174 printf("Each neuron can have any number of inputs = weighted connections\n with other neurons.\n"
Note: See TracChangeset
for help on using the changeset viewer.