Reinforcement Learning Toolbox 2.0
last updated:
General
Documentation
Manual
Tutorial
Class Reference
Master Thesis
Examples
Related Papers
Downloads
Links
News
mailto:webmaster
Main Page     Class Hierarchy   Compound List   File List   Compound Members   File Members

cstatecollection.h

Go to the documentation of this file.
00001 // Copyright (C) 2003
00002 // 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_toolbox
00007 //
00008 // All rights reserved.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions
00012 // are met:
00013 // 1. Redistributions of source code must retain the above copyright
00014 //    notice, this list of conditions and the following disclaimer.
00015 // 2. Redistributions in binary form must reproduce the above copyright
00016 //    notice, this list of conditions and the following disclaimer in the
00017 //    documentation and/or other materials provided with the distribution.
00018 // 3. The name of the author may not be used to endorse or promote products
00019 //    derived from this software without specific prior written permission.
00020 // 
00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00023 // 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, BUT
00026 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00027 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00030 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 
00032 #ifndef C_STATECOLLECTION_H
00033 #define C_STATECOLLECTION_H
00034 
00035 
00036 #include "cbaseobjects.h"
00037 #include "cstate.h"
00038 
00039 #include <list>
00040 #include <map>
00041 
00043 
00055 class CStateCollectionImpl : public CStateModifiersObject, public CStateCollection
00056 {
00057 protected:
00059         CState *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         void calculateModifiedStates();
00077         void setState(CState *state);
00078         
00079         void setStateCollection(CStateCollection *stateCollection);
00080 
00082         virtual CState *getState(CStateProperties *properties);
00084         virtual CState *getState();
00086         virtual void addStateModifier(CStateModifier *modifier);
00088         virtual void removeStateModifier(CStateModifier *modfier);
00089 
00091         virtual bool isStateCalculated(CStateModifier *);
00092 
00094         virtual void setIsStateCalculated(CStateModifier *modifier, bool isCalculated);
00095 
00097 //      virtual CState *returnStateForExternSetting(CStateProperties *);
00098 
00100         virtual bool isMember(CStateProperties *stateModifier);
00101 
00103         void newModelState();
00104         
00105         virtual void setResetState(bool reset);
00106 };
00107 
00109 
00118 class CStateCollectionList : public CStateModifiersObject
00119 {
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         void clearStateLists();
00134 
00136 
00137         void addStateCollection(CStateCollection *stateCollection);
00139 
00141         void getStateCollection(int index, CStateCollectionImpl *stateCollection);
00142 
00143         void removeLastStateCollection();
00144         
00145         CStateList *getStateList(CStateProperties *properties);
00146 
00148         void getState(int index, CState *state);
00149 
00151 
00152         virtual void addStateModifier(CStateModifier *modifier);
00154         virtual void removeStateModifier(CStateModifier *modifier);
00155 
00156         void loadASCII(FILE *stream);
00157         void saveASCII(FILE *stream);
00158         
00159         void loadBIN(FILE *stream);
00160         void saveBIN(FILE *stream);
00161 
00162         int getNumStateCollections();
00163 };
00164 
00165 #endif
00166