00001 // Copyright (C) 200300002 // Gerhard Neumann (gneumann@gmx.net)00003 // Stephan Neumann (sneumann@gmx.net)00004 // 00005 // This file is part of RL Toolbox.00006 // http://www.igi.tugraz.at/ril_toolbox00007 //00008 // All rights reserved.00009 //00010 // Redistribution and use in source and binary forms, with or without00011 // modification, are permitted provided that the following conditions00012 // are met:00013 // 1. Redistributions of source code must retain the above copyright00014 // notice, this list of conditions and the following disclaimer.00015 // 2. Redistributions in binary form must reproduce the above copyright00016 // notice, this list of conditions and the following disclaimer in the00017 // documentation and/or other materials provided with the distribution.00018 // 3. The name of the author may not be used to endorse or promote products00019 // derived from this software without specific prior written permission.00020 //00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES00023 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.00024 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,00025 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT00026 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF00030 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.00031
00032 #ifndef C_STATECOLLECTION_H00033 #define C_STATECOLLECTION_H00034
00035
00036 #include "cbaseobjects.h"00037 #include "cstate.h"00038
00039 #include <list>00040 #include <map>00041
00043
00055classCStateCollectionImpl : publicCStateModifiersObject, publicCStateCollection00056 {
00057 protected:
00059CState *modelState;
00061 std::map<CStateModifier *, CState *> *modifiedStates;
00063 std::map<CStateModifier *, bool> *stateCalculated;
00064
00065 public:
00067 CStateCollectionImpl(CStateProperties *modelProperties);
00069 CStateCollectionImpl(CStateCollectionImpl *stateCollection);
00071 CStateCollectionImpl(CStateProperties *properties, std::list<CStateModifier *> *modifiers);
00072 virtual~CStateCollectionImpl();
00073
00075 voidcalculateModifiedStates();
00077 voidsetState(CState *state);
00078
00079 voidsetStateCollection(CStateCollection *stateCollection);
00080
00082 virtualCState *getState(CStateProperties *properties);
00084 virtualCState *getState();
00086 virtualvoidaddStateModifier(CStateModifier *modifier);
00088 virtualvoidremoveStateModifier(CStateModifier *modfier);
00089
00091 virtualboolisStateCalculated(CStateModifier *);
00092
00094 virtualvoidsetIsStateCalculated(CStateModifier *modifier, bool isCalculated);
00095
00097 // virtual CState *returnStateForExternSetting(CStateProperties *);00098
00100 virtualboolisMember(CStateProperties *stateModifier);
00101
00103 voidnewModelState();
00104
00105 virtualvoidsetResetState(bool reset);
00106 };
00107
00109
00118classCStateCollectionList : publicCStateModifiersObject00119 {
00120 protected:
00122 std::list<CStateList *> *stateLists;
00123
00124
00125 public:
00127 CStateCollectionList(CStateProperties *model);
00129 CStateCollectionList(CStateProperties *model, std::list<CStateModifier *> *modifier);
00130
00131 virtual~CStateCollectionList();
00133 voidclearStateLists();
00134
00136
00137 voidaddStateCollection(CStateCollection *stateCollection);
00139
00141 voidgetStateCollection(int index, CStateCollectionImpl *stateCollection);
00142
00143 voidremoveLastStateCollection();
00144
00145 CStateList *getStateList(CStateProperties *properties);
00146
00148 voidgetState(int index, CState *state);
00149
00151
00152 virtualvoidaddStateModifier(CStateModifier *modifier);
00154 virtualvoidremoveStateModifier(CStateModifier *modifier);
00155
00156 voidloadASCII(FILE *stream);
00157 voidsaveASCII(FILE *stream);
00158
00159 voidloadBIN(FILE *stream);
00160 voidsaveBIN(FILE *stream);
00161
00162 intgetNumStateCollections();
00163 };
00164
00165 #endif00166