MultiO3dThingComponent.cpp

Go to the documentation of this file.
00001 /*
00002 SagaEngine library
00003 Copyright (c) 2002-2006 Skalden Studio AS
00004 
00005 This software is provided 'as-is', without any express or implied 
00006 warranty. In no event will the authors be held liable for any 
00007 damages arising from the use of this software.
00008 
00009 Permission is granted to distribute the library under the terms of the 
00010 Q Public License version 1.0. Be sure to read and understand the license
00011 before using the library. It should be included here, or you may read it
00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl
00013 
00014 The original version of this library can be located at:
00015 http://www.sagaengine.com/
00016 
00017 Rune Myrland
00018 rune@skalden.com
00019 */
00020 
00021 
00022 #include "MultiO3dThingComponent.hpp"
00023 #include <cstdio>
00024 
00025 using namespace se_core;
00026 
00027 namespace se_ogre {
00028 
00029     MultiO3dThingComponent
00030     ::MultiO3dThingComponent()
00031         : firstNode_(CompSchema::VoidList::end()) {
00032     }
00033 
00034 
00035     MultiO3dThingComponent
00036     ::~MultiO3dThingComponent() {
00037         CompSchema::voidList.removeChain(firstNode_);
00038         firstNode_ = CompSchema::VoidList::end();
00039     }
00040 
00041 
00042     void MultiO3dThingComponent
00043     ::add(O3dThingComponent& value) {
00044         Assert(&value);
00045         //LogWarning(value.owner()->name() << "(" << value.type() << ") added.");
00046         CompSchema::voidList.add(&value, firstNode_);
00047     }
00048 
00049 
00050     void MultiO3dThingComponent
00051     ::remove(O3dThingComponent& value) {
00052         //LogWarning(value.owner()->name() << "(" << value.type() << ") removed.");
00053         CompSchema::voidList.remove(&value, firstNode_);
00054     }
00055 
00056 
00057     bool MultiO3dThingComponent
00058     ::contains(O3dThingComponent& value) const {
00059         CompSchema::VoidList::iterator_type it = iterator();
00060         while(it != CompSchema::VoidList::end()) {
00061             if(CompSchema::voidList.next(it) == &value)
00062                 return true;
00063         }
00064         return false;
00065     }
00066 
00067 
00068     bool MultiO3dThingComponent
00069     ::contains(MultiO3dThingComponent& msc) const {
00070         CompSchema::VoidList::iterator_type it = msc.iterator();
00071         while(it != CompSchema::VoidList::end()) {
00072             if(!contains(*static_cast<O3dThingComponent*>(CompSchema::voidList.next(it))))
00073                 return false;
00074         }
00075         return true;
00076     }
00077 
00078 
00079     bool MultiO3dThingComponent
00080     ::sharesAny(MultiO3dThingComponent& msc) const {
00081         CompSchema::VoidList::iterator_type it = msc.iterator();
00082         while(it != CompSchema::VoidList::end()) {
00083             if(contains(*static_cast<O3dThingComponent*>(CompSchema::voidList.next(it)))) {
00084                 return true;
00085             }
00086         }
00087         return false;
00088     }
00089 
00090 
00091     void MultiO3dThingComponent
00092     ::add(MultiO3dThingComponent& msc) {
00093         Assert(&msc);
00094         CompSchema::VoidList::iterator_type it = msc.iterator();
00095         while(it != CompSchema::VoidList::end()) {
00096             add(*static_cast<O3dThingComponent*>(CompSchema::voidList.next(it)));
00097         }
00098     }
00099 
00100 
00101     void MultiO3dThingComponent
00102     ::destroyMembersAndClear() {
00103         CompSchema::VoidList::iterator_type it = iterator();
00104         while(it != CompSchema::VoidList::end()) {
00105             delete static_cast<O3dThingComponent*>(CompSchema::voidList.next(it));
00106         }
00107         clear();
00108     }
00109 
00110 
00111     void MultiO3dThingComponent
00112     ::initIterator(CompSchema::VoidList::iterator_type& iterator) const {
00113         iterator = firstNode_;
00114     }
00115 
00116 
00117     bool MultiO3dThingComponent
00118     ::isEmpty() const {
00119         return (firstNode_ == CompSchema::VoidList::end());
00120     }
00121 
00122 
00123     void MultiO3dThingComponent
00124     ::clear() {
00125         CompSchema::voidList.removeChain(firstNode_);
00126     }
00127 
00128 
00129     int MultiO3dThingComponent
00130     ::size() const {
00131         return CompSchema::voidList.size(firstNode_);
00132     }
00133 
00134 
00135 
00136     MultiO3dThingComponent::Iterator
00137     ::Iterator()
00138         : it_(CompSchema::VoidList::end()) {
00139     }
00140 
00141 
00142     MultiO3dThingComponent::Iterator
00143     ::Iterator(MultiO3dThingComponent& msc) {
00144         (*this).init(msc);
00145     }
00146 
00147 
00148     void MultiO3dThingComponent::Iterator
00149 	::init(MultiO3dThingComponent& msc) {
00150         msc.initIterator(it_);
00151     }
00152 
00153 
00154     void MultiO3dThingComponent::Iterator
00155 	::init(short firstNode) {
00156         it_ = firstNode;
00157     }
00158 
00159 
00160 }

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:08 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo