Changeset 804
- Timestamp:
- Feb 12, 2008, 3:49:41 AM (17 years ago)
- Location:
- code/branches/core/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core/src/orxonox/Orxonox.cc
r797 r804 76 76 #include "GraphicsEngine.h" 77 77 78 #include "core/ClassTreeMask.h" 78 79 #include "objects/WorldEntity.h" 79 80 #include "core/BaseObject.h" … … 717 718 std::cout << "13\n"; 718 719 */ 720 /* 719 721 std::cout << "Test 11\n"; 720 /*721 722 std::cout << "1\n"; 722 723 count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; } … … 736 737 Test2* test11_2 = new Test2; 737 738 */ 738 739 /* 739 740 std::cout << "3\n"; 740 741 Test3* test11_3 = new Test3; … … 742 743 743 744 std::cout << "4\n"; 745 */ 744 746 /* 745 747 std::cout << "Test 12\n"; … … 752 754 std::cout << "2\n"; 753 755 */ 756 std::cout << "Test 13\n"; 757 758 #define BoolToYesNo(bool) \ 759 if (bool) \ 760 std::cout << "yes "; \ 761 else \ 762 std::cout << "no " 763 764 #define TestClassTreeMask(mask) \ 765 std::cout << "========== ClassTreeMask-Test ===========" << std::endl; \ 766 std::cout << " "; \ 767 BoolToYesNo(mask.isIncluded(Class(BaseObject))); \ 768 std::cout << std::endl; \ 769 \ 770 std::cout << " "; \ 771 BoolToYesNo(mask.isIncluded(Class(A1))); \ 772 std::cout << " "; \ 773 BoolToYesNo(mask.isIncluded(Class(A2))); \ 774 std::cout << " "; \ 775 BoolToYesNo(mask.isIncluded(Class(A3))); \ 776 std::cout << std::endl; \ 777 \ 778 std::cout << " "; \ 779 BoolToYesNo(mask.isIncluded(Class(A1B1))); \ 780 std::cout << " "; \ 781 BoolToYesNo(mask.isIncluded(Class(A1B2))); \ 782 std::cout << " "; \ 783 BoolToYesNo(mask.isIncluded(Class(A2B1))); \ 784 std::cout << " "; \ 785 BoolToYesNo(mask.isIncluded(Class(A2B2))); \ 786 std::cout << " "; \ 787 BoolToYesNo(mask.isIncluded(Class(A3B1))); \ 788 std::cout << " "; \ 789 BoolToYesNo(mask.isIncluded(Class(A3B2))); \ 790 std::cout << std::endl; \ 791 \ 792 BoolToYesNo(mask.isIncluded(Class(A1B1C1))); \ 793 BoolToYesNo(mask.isIncluded(Class(A1B1C2))); \ 794 BoolToYesNo(mask.isIncluded(Class(A1B2C1))); \ 795 std::cout << " "; \ 796 BoolToYesNo(mask.isIncluded(Class(A2B1C1))); \ 797 std::cout << " "; \ 798 BoolToYesNo(mask.isIncluded(Class(A2B2C1))); \ 799 std::cout << " "; \ 800 BoolToYesNo(mask.isIncluded(Class(A3B1C1))); \ 801 BoolToYesNo(mask.isIncluded(Class(A3B1C2))); \ 802 BoolToYesNo(mask.isIncluded(Class(A3B2C1))); \ 803 BoolToYesNo(mask.isIncluded(Class(A3B2C2))); \ 804 std::cout << std::endl; \ 805 std::cout << "=========================================" << std::endl 806 807 std::cout << "1\n"; 808 809 ClassTreeMask test13_1; 810 // test13_1.include(Class(BaseObject)); 811 test13_1.exclude(Class(A1B1)); 812 test13_1.exclude(Class(A2)); 813 test13_1.include(Class(A2B2)); 814 test13_1.exclude(Class(A2B2C1)); 815 test13_1.exclude(Class(A3B1)); 816 test13_1.include(Class(A3B1C2)); 817 test13_1.exclude(Class(A3B2C1)); 818 test13_1.exclude(Class(A3B2C2)); 819 820 ClassTreeMask test13_2; 821 test13_2.exclude(Class(BaseObject)); 822 test13_2.include(Class(A1)); 823 test13_2.exclude(Class(A1B2)); 824 test13_2.exclude(Class(A1B1C2)); 825 test13_2.include(Class(A2)); 826 test13_2.exclude(Class(A2B2)); 827 test13_2.include(Class(A3B1)); 828 test13_2.include(Class(A3B2)); 829 test13_2.exclude(Class(A3B2C2)); 830 831 // TestClassTreeMask(test13_1); 832 std::cout << "1_0: " << ClassIdentifier<BaseObject>::getIdentifier() << std::endl; 833 834 TestClassTreeMask(test13_2); 835 836 std::cout << "2\n"; 837 838 std::cout << "3\n"; 754 839 755 840 // startRenderLoop(); -
code/branches/core/src/orxonox/core/ClassTreeMask.cc
r803 r804 237 237 bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const 238 238 { 239 std::cout << "1_0: " << ClassIdentifier<BaseObject>::getIdentifier() << std::endl; 240 std::cout << "1_1: " << subclass->getName() << " (" << subclass << ") / " << node->getClass()->getName() << " (" << node->getClass() << ")" << std::endl; 239 241 // Check if the searched subclass is of the same type as the class in the current node or a derivative 240 242 if (subclass->isA(node->getClass())) 241 243 { 244 std::cout << "1_2\n"; 242 245 // Check for the special case 243 246 if (subclass == node->getClass()) 247 { 248 std::cout << "1_3\n"; 244 249 return node->isIncluded(); 245 250 } 251 252 std::cout << "1_4\n"; 246 253 // Go through the list of subnodes and look for a node containing the searched subclass 247 254 for (std::list<ClassTreeMaskNode*>::iterator it = node->subnodes_.begin(); it != node->subnodes_.end(); ++it) … … 249 256 return isIncluded(*it, subclass); 250 257 258 std::cout << "1_5\n"; 251 259 // There is no subnode containing our class -> the rule of the current node takes in effect 252 260 return node->isIncluded(); … … 254 262 else 255 263 { 264 std::cout << "1_6\n"; 256 265 // The class is not included in the mask: return false 257 266 return false;
Note: See TracChangeset
for help on using the changeset viewer.