Changeset 3196 for code/trunk/src/core
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 3 deleted
- 85 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/core/ArgumentCompletionFunctions.cc
r2759 r3196 29 29 #include "ArgumentCompletionFunctions.h" 30 30 31 #include <iostream>32 31 #include <map> 33 32 #include <boost/version.hpp> 34 33 #include <boost/filesystem.hpp> 35 34 36 #include "CoreIncludes.h" 35 #include "util/Convert.h" 36 #include "util/String.h" 37 37 #include "Identifier.h" 38 38 #include "ConfigValueContainer.h" 39 39 #include "TclThreadManager.h" 40 #include "util/Convert.h"41 #include "util/String.h"42 40 43 41 // Boost 1.36 has some issues with deprecated functions that have been omitted -
code/trunk/src/core/ArgumentCompletionListElement.h
r1784 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include <list> 34 35 #include <string> 35 #include <list>36 37 36 38 37 namespace orxonox -
code/trunk/src/core/BaseObject.cc
r2710 r3196 36 36 #include <tinyxml/tinyxml.h> 37 37 38 #include "util/String.h" 38 39 #include "CoreIncludes.h" 40 #include "Event.h" 39 41 #include "EventIncludes.h" 40 42 #include "Functor.h" 41 #include "XMLPort.h" 43 #include "Iterator.h" 44 #include "Template.h" 42 45 #include "XMLFile.h" 43 46 #include "XMLNameListener.h" 44 #include "Template.h" 45 #include "util/String.h" 46 #include "util/mbool.h" 47 #include "XMLPort.h" 47 48 48 49 namespace orxonox … … 293 294 void BaseObject::processEvent(Event& event) 294 295 { 295 SetEvent(BaseObject, "activity", setActive, event);296 SetEvent(BaseObject, "visibility", setVisible, event);296 ORXONOX_SET_EVENT(BaseObject, "activity", setActive, event); 297 ORXONOX_SET_EVENT(BaseObject, "visibility", setVisible, event); 297 298 } 298 299 -
code/trunk/src/core/BaseObject.h
r2662 r3196 44 44 } 45 45 46 47 #include "CorePrereqs.h" 48 46 49 #include <map> 47 48 #include "CorePrereqs.h" 49 50 #include <list> 51 52 #include "util/mbool.h" 53 #include "OrxonoxClass.h" 50 54 #include "Super.h" 51 #include "OrxonoxClass.h"52 #include "XMLIncludes.h"53 #include "Event.h"54 #include "util/mbool.h"55 55 56 56 namespace orxonox -
code/trunk/src/core/CMakeLists.txt
r3036 r3196 63 63 ) 64 64 ADD_SUBDIRECTORY(input) 65 GET_ALL_HEADER_FILES(CORE_HDR_FILES)66 SET(CORE_FILES ${CORE_SRC_FILES} ${CORE_HDR_FILES})67 65 68 GENERATE_SOURCE_GROUPS(${CORE_FILES}) 69 GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h Game.h) 70 71 ADD_LIBRARY(core SHARED ${CORE_FILES}) 72 73 SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD") 74 TARGET_LINK_LIBRARIES(core 75 ${OGRE_LIBRARY} 76 ${Boost_THREAD_LIBRARY} 77 ${Boost_FILESYSTEM_LIBRARY} 78 ${Boost_SYSTEM_LIBRARY} 79 ${Boost_DATE_TIME_LIBRARY} # MSVC only 80 ${LUA_LIBRARIES} 81 cpptcl_orxonox 82 ois_orxonox 83 tinyxml++_orxonox 84 tolua++_orxonox 85 util 66 ORXONOX_ADD_LIBRARY(core 67 FIND_HEADER_FILES 68 TOLUA_FILES 69 CommandExecutor.h 70 Game.h 71 LuaBind.h 72 DEFINE_SYMBOL 73 "CORE_SHARED_BUILD" 74 PCH_FILE 75 CorePrecompiledHeaders.h 76 LINK_LIBRARIES 77 ${OGRE_LIBRARY} 78 ${Boost_THREAD_LIBRARY} 79 ${Boost_FILESYSTEM_LIBRARY} 80 ${Boost_SYSTEM_LIBRARY} 81 ${Boost_DATE_TIME_LIBRARY} # MSVC only 82 ${LUA_LIBRARIES} 83 cpptcl_orxonox 84 ois_orxonox 85 tinyxml++_orxonox 86 tolua++_orxonox 87 util 88 SOURCE_FILES 89 ${CORE_SRC_FILES} 86 90 ) 87 88 ORXONOX_INSTALL(core) -
code/trunk/src/core/ClassFactory.h
r2171 r3196 41 41 #include <string> 42 42 43 #include "util/Debug.h" 43 44 #include "Factory.h" 44 45 #include "Identifier.h" 45 #include "util/Debug.h"46 46 47 47 namespace orxonox … … 88 88 */ 89 89 template <class T> 90 BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)90 inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator) 91 91 { 92 92 return ClassFactory<T>::createNewObject(creator); … … 98 98 */ 99 99 template <class T> 100 T* ClassFactory<T>::createNewObject(BaseObject* creator)100 inline T* ClassFactory<T>::createNewObject(BaseObject* creator) 101 101 { 102 102 return new T(creator); -
code/trunk/src/core/ClassTreeMask.cc
r2171 r3196 34 34 #include "ClassTreeMask.h" 35 35 #include "Identifier.h" 36 #include "BaseObject.h"37 36 38 37 namespace orxonox -
code/trunk/src/core/ClassTreeMask.h
r2171 r3196 75 75 #include <list> 76 76 #include <stack> 77 77 #include "BaseObject.h" 78 78 #include "Iterator.h" 79 #include "BaseObject.h"80 79 81 80 namespace orxonox -
code/trunk/src/core/Clock.cc
r1755 r3196 57 57 tickTime_ = storedTime_ + timersTime; 58 58 tickDt_ = timersTime - lastTimersTime_; 59 tickDtFloat_ = (float)tickDt_/ 1000000.0f;59 tickDtFloat_ = static_cast<float>(tickDt_) / 1000000.0f; 60 60 61 61 if (timersTime > 0x7FFFFFF0) -
code/trunk/src/core/Clock.h
r2896 r3196 39 39 40 40 #include "CorePrereqs.h" 41 #include <OgrePrerequisites.h>41 #include "util/OgreForwardRefs.h" 42 42 43 43 namespace orxonox … … 53 53 unsigned long long getMicroseconds() const { return tickTime_; } 54 54 unsigned long long getMilliseconds() const { return tickTime_ / 1000; } 55 int getSeconds() const { return tickTime_ / 1000000; }56 float getSecondsPrecise() const { return (float)tickTime_ / 1000000.0f; }55 unsigned long getSeconds() const { return static_cast<long> (tickTime_ / 1000000); } 56 float getSecondsPrecise() const { return static_cast<float>(tickTime_ / 1000000.0f); } 57 57 58 58 float getDeltaTime() const { return tickDtFloat_; } 59 intgetDeltaTimeMicroseconds() const { return tickDt_; }59 long getDeltaTimeMicroseconds() const { return tickDt_; } 60 60 61 61 unsigned long long getRealMicroseconds() const; … … 67 67 unsigned long long storedTime_; 68 68 unsigned long long tickTime_; 69 inttickDt_;69 long tickDt_; 70 70 float tickDtFloat_; 71 71 unsigned long lastTimersTime_; -
code/trunk/src/core/CommandEvaluation.cc
r2087 r3196 28 28 29 29 #include "CommandEvaluation.h" 30 31 #include "util/Debug.h" 32 #include "util/String.h" 30 33 #include "ConsoleCommand.h" 31 34 #include "Identifier.h" 32 #include "util/Debug.h"33 #include "util/String.h"34 35 35 36 namespace orxonox -
code/trunk/src/core/CommandExecutor.cc
r3035 r3196 28 28 29 29 #include "CommandExecutor.h" 30 31 #include "util/Debug.h" 32 #include "util/String.h" 30 33 #include "ConsoleCommand.h" 31 #include "util/String.h"32 #include "util/Debug.h"33 34 #include "Identifier.h" 34 35 #include "Language.h" -
code/trunk/src/core/CommandExecutor.h
r3035 r3196 33 33 34 34 #include <map> 35 #include <set> 36 #include <string> 35 37 38 #include "util/MultiType.h" 36 39 #include "CommandEvaluation.h" 37 40 -
code/trunk/src/core/CommandLine.cc
r2759 r3196 30 30 31 31 #include <boost/filesystem.hpp> 32 33 #include "util/Convert.h" 34 #include "util/Debug.h" 35 #include "util/Exception.h" 32 36 #include "util/String.h" 33 37 #include "util/SubString.h" -
code/trunk/src/core/CommandLine.h
r2662 r3196 31 31 32 32 #include "CorePrereqs.h" 33 33 34 #include <map> 34 #include "util/Convert.h" 35 #include "util/Debug.h" 36 #include "util/Exception.h" 35 #include "util/OrxAssert.h" 37 36 #include "util/MultiType.h" 38 37 -
code/trunk/src/core/ConfigFileManager.cc
r2896 r3196 29 29 #include "ConfigFileManager.h" 30 30 31 #include <cassert>32 31 #include <boost/filesystem.hpp> 33 32 34 33 #include "util/Convert.h" 34 #include "util/Math.h" 35 35 #include "util/String.h" 36 36 #include "ConsoleCommand.h" … … 312 312 // There might be an array index 313 313 unsigned int index = 0; 314 if ( ConvertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))314 if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1))) 315 315 { 316 316 // New array -
code/trunk/src/core/ConfigFileManager.h
r2662 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include < iostream>34 #include <cassert> 35 35 #include <string> 36 36 #include <list> 37 37 #include <map> 38 38 39 #include "util/Math.h"40 39 #include "util/OrxEnum.h" 41 40 -
code/trunk/src/core/ConfigValueContainer.cc
r2662 r3196 34 34 #include "ConfigValueContainer.h" 35 35 36 #include <fstream> 37 36 #include "util/Convert.h" 38 37 #include "util/SubString.h" 39 #include "util/Convert.h"40 38 #include "Language.h" 41 #include "Identifier.h"42 43 44 39 45 40 namespace orxonox … … 303 298 304 299 if (token.size() > 0) 305 success = ConvertValue(&index, token[0]);300 success = convertValue(&index, token[0]); 306 301 307 302 if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX) -
code/trunk/src/core/ConfigValueContainer.h
r2662 r3196 49 49 #include <vector> 50 50 51 #include "util/Math.h"52 51 #include "util/MultiType.h" 53 52 #include "ConfigFileManager.h" -
code/trunk/src/core/ConsoleCommand.h
r2662 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include "ArgumentCompletionFunctions.h" 35 #include "CommandExecutor.h" 34 36 #include "Executor.h" 35 37 #include "Identifier.h" 36 #include "CommandExecutor.h"37 #include "ArgumentCompletionFunctions.h"38 38 39 39 -
code/trunk/src/core/ConsoleCommandCompilation.cc
r1747 r3196 28 28 29 29 #include "ConsoleCommandCompilation.h" 30 #include "ConsoleCommand.h" 30 31 #include <fstream> 32 #include <set> 33 #include <string> 34 31 35 #include "util/Debug.h" 32 36 #include "util/ExprParser.h" 37 #include "ConsoleCommand.h" 33 38 34 39 namespace orxonox … … 165 170 COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << "'" << std::endl; 166 171 } 167 return expr.getResult();172 return static_cast<float>(expr.getResult()); 168 173 } 169 174 else -
code/trunk/src/core/ConsoleCommandCompilation.h
r1505 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include <string>35 36 34 namespace orxonox 37 35 { -
code/trunk/src/core/Core.cc
r3103 r3196 29 29 30 30 /** 31 @file 32 @brief Implementation of the Core class. 31 @file 32 @brief 33 Implementation of the Core singleton with its global variables (avoids boost include) 33 34 */ 34 35 … … 81 82 static boost::filesystem::path logPath_g; //!< Path to the log file folder 82 83 84 //! Static pointer to the singleton 83 85 Core* Core::singletonRef_s = 0; 84 86 … … 365 367 if (!bInitialized && this->bInitializeRandomNumberGenerator_) 366 368 { 367 srand( time(0));369 srand(static_cast<unsigned int>(time(0))); 368 370 rand(); 369 371 bInitialized = true; … … 472 474 If found it means that this is not an installed run, hence we 473 475 don't write the logs and config files to ~/.orxonox 476 @throws 477 GeneralException 474 478 */ 475 479 void Core::checkDevBuild() … … 532 536 Checks for the log and the config directory and creates them 533 537 if necessary. Otherwise me might have problems opening those files. 538 @throws 539 orxonox::GeneralException if the directory to be created is a file. 534 540 */ 535 541 void Core::createDirectories() 536 542 { 537 543 std::vector<std::pair<boost::filesystem::path, std::string> > directories; 538 directories.push_back(std::pair<boost::filesystem::path, std::string> 539 (boost::filesystem::path(configPath_g), "config")); 540 directories.push_back(std::pair<boost::filesystem::path, std::string> 541 (boost::filesystem::path(logPath_g), "log")); 544 directories.push_back(std::make_pair(boost::filesystem::path(configPath_g), "config")); 545 directories.push_back(std::make_pair(boost::filesystem::path(logPath_g), "log")); 542 546 543 547 for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin(); -
code/trunk/src/core/Core.h
r2896 r3196 29 29 30 30 /** 31 @file 32 @brief Declaration of the Core class. 33 31 @file 32 @brief 33 Declaration of the Core class. 34 @details 34 35 The Core class is a singleton, only used to configure some variables 35 36 in the core through the config-file. … … 45 46 #include "util/OutputHandler.h" 46 47 47 // boost::filesystem header has quite a large tail, use forward declaration48 namespace boost { namespace filesystem49 {50 struct path_traits;51 template<class String, class Traits> class basic_path;52 typedef basic_path< std::string, path_traits> path;53 } }54 55 48 namespace orxonox 56 49 { 57 //! The Core class is a singleton, only used to configure some config-values. 50 /** 51 @brief 52 The Core class is a singleton used to configure the program basics. 53 @details 54 The class provides information about the media, config and log path. 55 It determines those by the use of platform specific functions. 56 */ 58 57 class _CoreExport Core : public OrxonoxClass 59 58 { 60 59 public: 60 /** 61 @brief 62 Determines the executable path, checks for build directory runs, creates 63 the output directories and sets up the other core library singletons. 64 @throws 65 GeneralException 66 */ 61 67 Core(); 62 68 ~Core(); … … 76 82 static void tsetMediaPath(const std::string& path) 77 83 { assert(singletonRef_s); singletonRef_s->_tsetMediaPath(path); } 84 //! Returns the path to the config files as boost::filesystem::path 78 85 static const boost::filesystem::path& getMediaPath(); 86 //! Returns the path to the config files as boost::filesystem::path 79 87 static const boost::filesystem::path& getConfigPath(); 88 //! Returns the path to the log files as boost::filesystem::path 80 89 static const boost::filesystem::path& getLogPath(); 90 //! Returns the path to the data files as std::string 81 91 static std::string getMediaPathString(); 92 //! Returns the path to the config files as std::string 82 93 static std::string getConfigPathString(); 94 //! Returns the path to the log files as std::string 83 95 static std::string getLogPathString(); 84 96 85 97 private: 86 Core(const Core&); 98 Core(const Core&); //!< Don't use (undefined symbol) 87 99 88 100 void checkDevBuild(); -
code/trunk/src/core/CoreIncludes.h
r2171 r3196 43 43 #include "CorePrereqs.h" 44 44 45 #include "util/Debug.h" 45 46 #include "Identifier.h" 46 47 #include "Factory.h" 47 48 #include "ClassFactory.h" 48 #include "Functor.h" 49 #include "util/Debug.h" 49 #include "ObjectList.h" 50 50 51 51 … … 129 129 orxonox::Factory::getIdentifier(networkID) 130 130 131 /**132 @brief Registers a member function as callback when an object of 'type' is created.133 @param134 */135 #define RegisterConstructionCallback(ThisClassName, TargetClassName, FunctionName) \136 orxonox::ClassIdentifier<TargetClassName>::getIdentifier()->addConstructionCallback( \137 orxonox::createFunctor(&ThisClassName::FunctionName)->setObject(this))138 139 131 #endif /* _CoreIncludes_H__ */ -
code/trunk/src/core/CorePrereqs.h
r2896 r3196 36 36 37 37 #include "OrxonoxConfig.h" 38 39 #include <string>40 38 41 39 //----------------------------------------------------------------------- … … 64 62 namespace orxonox 65 63 { 66 namespace XMLPort 67 { 68 enum Mode 64 namespace XMLPort 69 65 { 70 LoadObject, 71 SaveObject, 72 ExpandObject 66 enum Mode 67 { 68 LoadObject, 69 SaveObject, 70 ExpandObject 71 }; 72 } 73 74 namespace KeybindMode 75 { 76 enum Enum 77 { 78 OnPress, 79 OnHold, 80 OnRelease, 81 None 82 }; 73 83 }; 74 } 75 76 namespace KeybindMode 77 { 78 enum Enum 79 { 80 OnPress, 81 OnHold, 82 OnRelease, 83 None 84 }; 85 }; 86 87 typedef std::string LanguageEntryLabel; 88 89 class ArgumentCompleter; 90 class ArgumentCompletionListElement; 91 class BaseFactory; 92 class BaseMetaObjectListElement; 93 class BaseObject; 94 template <class T> 95 class ClassFactory; 96 template <class T> 97 class ClassIdentifier; 98 class ClassTreeMask; 99 class ClassTreeMaskIterator; 100 class ClassTreeMaskNode; 101 class ClassTreeMaskObjectIterator; 102 class Clock; 103 class CommandEvaluation; 104 class CommandExecutor; 105 class CommandLine; 106 class CommandLineArgument; 107 class ConfigFile; 108 class ConfigFileEntry; 109 class ConfigFileEntryComment; 110 class ConfigFileEntryValue; 111 class ConfigFileManager; 112 class ConfigFileSection; 113 class ConfigValueContainer; 114 class ConsoleCommand; 115 class Core; 116 struct Event; 117 class EventContainer; 118 class Executor; 119 template <class T> 120 class ExecutorMember; 121 class ExecutorStatic; 122 class Factory; 123 class Functor; 124 template <class T> 125 class FunctorMember; 126 class FunctorStatic; 127 class Identifier; 128 class IRC; 129 template <class T> 130 class Iterator; 131 class IteratorBase; 132 class Language; 133 class LanguageEntry; 134 class Loader; 135 class LuaBind; 136 class MetaObjectList; 137 class MetaObjectListElement; 138 class Namespace; 139 class NamespaceNode; 140 template <class T> 141 class ObjectList; 142 class ObjectListBase; 143 class ObjectListBaseElement; 144 template <class T> 145 class ObjectListElement; 146 template <class T> 147 class ObjectListIterator; 148 class OrxonoxClass; 149 class Shell; 150 class ShellListener; 151 template <class T> 152 class SubclassIdentifier; 153 class TclBind; 154 struct TclInterpreterBundle; 155 class TclThreadManager; 156 class Template; 157 class Tickable; 158 class XMLFile; 159 class XMLNameListener; 160 template <class T, class O> 161 class XMLPortClassObjectContainer; 162 template <class T> 163 class XMLPortClassParamContainer; 164 class XMLPortObjectContainer; 165 class XMLPortParamContainer; 166 167 // game states 168 class Game; 169 class GameState; 170 struct GameStateTreeNode; 171 172 // input 173 class BaseCommand; 174 class BufferedParamCommand; 175 class Button; 176 class CalibratorCallback; 177 class ExtendedInputState; 178 class HalfAxis; 179 class InputBuffer; 180 class InputManager; 181 class InputState; 182 class JoyStickHandler; 183 class MouseHandler; 184 class KeyBinder; 185 class KeyDetector; 186 class KeyHandler; 187 class ParamCommand; 188 class SimpleCommand; 189 class SimpleInputState; 190 } 84 85 typedef std::string LanguageEntryLabel; 86 87 class ArgumentCompleter; 88 class ArgumentCompletionListElement; 89 class BaseFactory; 90 class BaseMetaObjectListElement; 91 class BaseObject; 92 template <class T> 93 class ClassFactory; 94 template <class T> 95 class ClassIdentifier; 96 class ClassTreeMask; 97 class ClassTreeMaskIterator; 98 class ClassTreeMaskNode; 99 class ClassTreeMaskObjectIterator; 100 class Clock; 101 class CommandEvaluation; 102 class CommandExecutor; 103 class CommandLine; 104 class CommandLineArgument; 105 class ConfigFile; 106 class ConfigFileEntry; 107 class ConfigFileEntryComment; 108 class ConfigFileEntryValue; 109 class ConfigFileManager; 110 class ConfigFileSection; 111 class ConfigValueContainer; 112 class ConsoleCommand; 113 class Core; 114 struct Event; 115 class EventContainer; 116 class Executor; 117 template <class T> 118 class ExecutorMember; 119 class ExecutorStatic; 120 class Factory; 121 class Functor; 122 template <class T> 123 class FunctorMember; 124 class FunctorStatic; 125 class Identifier; 126 class IRC; 127 template <class T> 128 class Iterator; 129 class IteratorBase; 130 class Language; 131 class LanguageEntry; 132 class Loader; 133 class LuaBind; 134 class MetaObjectList; 135 class MetaObjectListElement; 136 class Namespace; 137 class NamespaceNode; 138 template <class T> 139 class ObjectList; 140 class ObjectListBase; 141 class ObjectListBaseElement; 142 template <class T> 143 class ObjectListElement; 144 template <class T> 145 class ObjectListIterator; 146 class OrxonoxClass; 147 class Shell; 148 class ShellListener; 149 template <class T> 150 class SubclassIdentifier; 151 class TclBind; 152 struct TclInterpreterBundle; 153 class TclThreadManager; 154 class Template; 155 class Tickable; 156 class XMLFile; 157 class XMLNameListener; 158 template <class T, class O> 159 class XMLPortClassObjectContainer; 160 template <class T> 161 class XMLPortClassParamContainer; 162 class XMLPortObjectContainer; 163 class XMLPortParamContainer; 164 165 // game states 166 class Game; 167 class GameState; 168 struct GameStateTreeNode; 169 170 // input 171 class BaseCommand; 172 class BufferedParamCommand; 173 class Button; 174 class CalibratorCallback; 175 class ExtendedInputState; 176 class HalfAxis; 177 class InputBuffer; 178 class InputManager; 179 class InputState; 180 class JoyStickHandler; 181 class MouseHandler; 182 class KeyBinder; 183 class KeyDetector; 184 class KeyHandler; 185 class ParamCommand; 186 class SimpleCommand; 187 class SimpleInputState; 188 } 189 190 // CppTcl 191 namespace Tcl 192 { 193 class interpreter; 194 class object; 195 } 196 197 // Boost 198 namespace boost { namespace filesystem 199 { 200 struct path_traits; 201 template <class String, class Traits> class basic_path; 202 typedef basic_path<std::string, path_traits> path; 203 } } 204 205 // TinyXML and TinyXML++ 206 class TiXmlString; 207 class TiXmlOutStream; 208 class TiXmlNode; 209 class TiXmlHandle; 210 class TiXmlDocument; 211 class TiXmlElement; 212 class TiXmlComment; 213 class TiXmlUnknown; 214 class TiXmlAttribute; 215 class TiXmlText; 216 class TiXmlDeclaration; 217 class TiXmlParsingData; 218 namespace ticpp 219 { 220 class Document; 221 class Element; 222 class Declaration; 223 class StylesheetReference; 224 class Text; 225 class Comment; 226 class Attribute; 227 } 228 namespace orxonox 229 { 230 using ticpp::Document; 231 using ticpp::Element; 232 using ticpp::Declaration; 233 using ticpp::StylesheetReference; 234 using ticpp::Text; 235 using ticpp::Comment; 236 using ticpp::Attribute; 237 } 238 191 239 192 240 #endif /* _CorePrereqs_H__ */ -
code/trunk/src/core/Event.cc
r2087 r3196 28 28 29 29 #include "Event.h" 30 30 31 #include "BaseObject.h" 31 32 #include "Executor.h" -
code/trunk/src/core/Event.h
r2087 r3196 31 31 32 32 #include "CorePrereqs.h" 33 #include <string> 33 34 34 35 namespace orxonox -
code/trunk/src/core/EventIncludes.h
r2087 r3196 33 33 #include "Executor.h" 34 34 35 #define SetEvent(classname, eventname, functionname, event) \36 SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject)35 #define ORXONOX_SET_EVENT(classname, eventname, functionname, event) \ 36 ORXONOX_SET_EVENT_GENERIC(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject) 37 37 38 #define SetEventTemplate(classname, eventname, functionname, event, ...) \39 SetEventGenericTemplate(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject, __VA_ARGS__)38 #define ORXONOX_SET_EVENT_TEMPLATE(classname, eventname, functionname, event, ...) \ 39 ORXONOX_SET_EVENT_GENERIC_TEMPLATE(eventcontainer##classname##functionname, classname, eventname, functionname, event, BaseObject, __VA_ARGS__) 40 40 41 #define SetSubclassEvent(classname, eventname, functionname, event, subclassname) \42 SetEventGeneric(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname)41 #define ORXONOX_SET_SUBCLASS_EVENT(classname, eventname, functionname, event, subclassname) \ 42 ORXONOX_SET_EVENT_GENERIC(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname) 43 43 44 #define SetSubclassEventTemplate(classname, eventname, functionname, event, subclassname, ...) \45 SetEventGenericTemplate(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname, __VA_ARGS__)44 #define ORXONOX_SET_SUBCLASS_EVENT_TEMPLATE(classname, eventname, functionname, event, subclassname, ...) \ 45 ORXONOX_SET_EVENT_GENERIC_TEMPLATE(eventcontainer##classname##functionname, classname, eventname, functionname, event, subclassname, __VA_ARGS__) 46 46 47 #define SetEventGeneric(containername, classname, eventname, functionname, event, subclassname) \47 #define ORXONOX_SET_EVENT_GENERIC(containername, classname, eventname, functionname, event, subclassname) \ 48 48 orxonox::EventContainer* containername = this->getEventContainer(eventname); \ 49 49 if (!containername) \ … … 57 57 containername->process(this, event) 58 58 59 #define SetEventGenericTemplate(containername, classname, eventname, functionname, event, subclassname, ...) \59 #define ORXONOX_SET_EVENT_GENERIC_TEMPLATE(containername, classname, eventname, functionname, event, subclassname, ...) \ 60 60 orxonox::EventContainer* containername = this->getEventContainer(eventname); \ 61 61 if (!containername) \ -
code/trunk/src/core/Executor.cc
r1879 r3196 29 29 30 30 #include "Executor.h" 31 #include "util/Math.h" 31 32 32 #include "util/Convert.h" 33 33 #include "Language.h" -
code/trunk/src/core/Executor.h
r1889 r3196 33 33 #include "CorePrereqs.h" 34 34 35 #include "util/Debug.h" 36 #include "util/Math.h" 37 #include "util/String.h" 35 38 #include "util/SubString.h" 36 #include "util/String.h"37 #include "util/Math.h"38 39 #include "Functor.h" 39 #include "util/Debug.h"40 40 41 41 -
code/trunk/src/core/Factory.cc
r2761 r3196 33 33 34 34 #include "Factory.h" 35 36 #include "util/Debug.h" 35 37 #include "Identifier.h" 36 38 #include "BaseObject.h" 37 #include "util/Debug.h"38 39 39 40 namespace orxonox -
code/trunk/src/core/Functor.h
r2710 r3196 33 33 #include "CorePrereqs.h" 34 34 35 #include "util/Debug.h" 35 36 #include "util/MultiType.h" 36 37 #include "util/String.h" 37 #include "util/Debug.h"38 39 38 40 39 namespace orxonox -
code/trunk/src/core/Game.cc
r3084 r3196 36 36 37 37 #include <exception> 38 #include < cassert>38 #include <boost/weak_ptr.hpp> 39 39 40 40 #include "util/Debug.h" … … 51 51 namespace orxonox 52 52 { 53 using boost::shared_ptr; 54 using boost::weak_ptr; 55 53 56 static void stop_game() 54 57 { Game::getInstance().stop(); } … … 57 60 struct _CoreExport GameStateTreeNode 58 61 { 59 GameState* 60 GameStateTreeNode*parent_;61 std::vector< GameStateTreeNode*> children_;62 GameState* state_; 63 weak_ptr<GameStateTreeNode> parent_; 64 std::vector<shared_ptr<GameStateTreeNode> > children_; 62 65 }; 63 66 … … 73 76 assert(singletonRef_s == 0); 74 77 singletonRef_s = this; 75 76 this->rootStateNode_ = 0;77 this->activeStateNode_ = 0;78 78 79 79 this->abort_ = false; … … 105 105 // Destroy pretty much everyhting left 106 106 delete this->core_; 107 108 // Delete all the created nodes109 for (std::vector<GameStateTreeNode*>::const_iterator it = this->allStateNodes_.begin(); it != this->allStateNodes_.end(); ++it)110 delete *it;111 107 112 108 delete this->gameClock_; … … 172 168 { 173 169 // Note: this->requestedStateNodes_.front() is the currently active state node 174 std::vector< GameStateTreeNode*>::iterator it = this->requestedStateNodes_.begin() + 1;175 if (*it == this->activeStateNode_->parent_ )170 std::vector<shared_ptr<GameStateTreeNode> >::iterator it = this->requestedStateNodes_.begin() + 1; 171 if (*it == this->activeStateNode_->parent_.lock()) 176 172 this->unloadState(this->activeStateNode_->state_); 177 173 else // has to be child … … 194 190 195 191 if ((*it)->getCountTickTime()) 196 this->addTickTime( this->gameClock_->getRealMicroseconds() - timeBeforeTick);192 this->addTickTime(static_cast<uint32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick)); 197 193 } 198 194 … … 216 212 217 213 uint32_t framesPerPeriod = this->statisticsTickTimes_.size(); 218 this->avgFPS_ = (float)framesPerPeriod / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0;219 this->avgTickTime_ = (float)this->periodTickTime_ / framesPerPeriod / 1000.0;214 this->avgFPS_ = static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f; 215 this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f; 220 216 221 217 this->periodTime_ -= this->statisticsRefreshCycle_; … … 226 222 while (!this->activeStates_.empty()) 227 223 this->unloadState(this->activeStates_.back()); 228 this->activeStateNode_ = 0;224 this->activeStateNode_.reset(); 229 225 this->requestedStateNodes_.clear(); 230 226 } … … 251 247 return; 252 248 253 GameStateTreeNode* requestedNode = 0;249 shared_ptr<GameStateTreeNode> requestedNode; 254 250 255 251 // this->requestedStateNodes_.back() is the currently active state 256 GameStateTreeNode*lastRequestedNode = this->requestedStateNodes_.back();252 shared_ptr<GameStateTreeNode> lastRequestedNode = this->requestedStateNodes_.back(); 257 253 258 254 // Already the active node? … … 274 270 275 271 // Check parent and all its grand parents 276 GameStateTreeNode*currentNode = lastRequestedNode;272 shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode; 277 273 while (requestedNode == NULL && currentNode != NULL) 278 274 { 279 275 if (currentNode->state_ == state) 280 276 requestedNode = currentNode; 281 currentNode = currentNode->parent_ ;277 currentNode = currentNode->parent_.lock(); 282 278 } 283 279 … … 297 293 void Game::popState() 298 294 { 299 if (this->activeStateNode_ != NULL && this->requestedStateNodes_.back()->parent_ )300 this->requestState(this->requestedStateNodes_.back()->parent_ ->state_->getName());295 if (this->activeStateNode_ != NULL && this->requestedStateNodes_.back()->parent_.lock()) 296 this->requestState(this->requestedStateNodes_.back()->parent_.lock()->state_->getName()); 301 297 else 302 298 COUT(2) << "Warning: Could not pop GameState. Ignoring." << std::endl; … … 333 329 } 334 330 unsigned int currentLevel = 0; 335 GameStateTreeNode* currentNode = 0;331 shared_ptr<GameStateTreeNode> currentNode; 336 332 for (std::vector<std::pair<std::string, unsigned> >::const_iterator it = stateStrings.begin(); it != stateStrings.end(); ++it) 337 333 { … … 346 342 if (this->rootStateNode_ != NULL) 347 343 ThrowException(GameState, "No two root GameStates are allowed!"); 348 GameStateTreeNode* newNode = new GameStateTreeNode; 349 this->allStateNodes_.push_back(newNode); 344 shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode); 350 345 newNode->state_ = newState; 351 newNode->parent_ = 0;352 346 this->rootStateNode_ = newNode; 353 347 currentNode = this->rootStateNode_; … … 355 349 else if (currentNode) 356 350 { 357 GameStateTreeNode* newNode = new GameStateTreeNode; 358 this->allStateNodes_.push_back(newNode); 351 shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode); 359 352 newNode->state_ = newState; 360 353 if (newLevel < currentLevel) … … 362 355 // Get down the hierarchy 363 356 do 364 currentNode = currentNode->parent_ ;357 currentNode = currentNode->parent_.lock(); 365 358 while (newLevel < --currentLevel); 366 359 } … … 369 362 // same level 370 363 newNode->parent_ = currentNode->parent_; 371 newNode->parent_ ->children_.push_back(newNode);364 newNode->parent_.lock()->children_.push_back(newNode); 372 365 } 373 366 else if (newLevel == currentLevel + 1) -
code/trunk/src/core/Game.h
r3084 r3196 37 37 38 38 #include "CorePrereqs.h" 39 39 40 #include <cassert> 40 41 #include <list> 41 42 #include <map> 43 #include <string> 42 44 #include <vector> 45 #include <boost/shared_ptr.hpp> 46 #include <boost/preprocessor/cat.hpp> 47 43 48 #include "OrxonoxClass.h" 44 49 … … 49 54 */ 50 55 #define AddGameState(classname, ...) \ 51 static bool MACRO_CONCATENATE(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__))56 static bool BOOST_PP_CAT(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__)) 52 57 53 58 // tolua_begin … … 106 111 107 112 std::vector<GameState*> activeStates_; 108 GameStateTreeNode* rootStateNode_; 109 GameStateTreeNode* activeStateNode_; 110 std::vector<GameStateTreeNode*> requestedStateNodes_; 111 std::vector<GameStateTreeNode*> allStateNodes_; 113 boost::shared_ptr<GameStateTreeNode> rootStateNode_; 114 boost::shared_ptr<GameStateTreeNode> activeStateNode_; 115 std::vector<boost::shared_ptr<GameStateTreeNode> > requestedStateNodes_; 112 116 113 117 Core* core_; -
code/trunk/src/core/GameState.cc
r3084 r3196 34 34 35 35 #include "GameState.h" 36 #include <cassert> 36 37 37 #include "util/Debug.h" 38 38 #include "util/Exception.h" 39 #include " Clock.h"39 #include "util/OrxAssert.h" 40 40 41 41 namespace orxonox -
code/trunk/src/core/GameState.h
r3084 r3196 38 38 #include "CorePrereqs.h" 39 39 40 #include <map> 40 41 #include <string> 41 #include <map>42 #include "CorePrereqs.h"43 42 44 43 namespace orxonox -
code/trunk/src/core/IRC.cc
r1792 r3196 29 29 #include "IRC.h" 30 30 31 #include <boost/thread/thread.hpp> 31 #include <cpptcl/cpptcl.h> 32 33 #include "util/Convert.h" 32 34 #include "ConsoleCommand.h" 35 #include "CoreIncludes.h" 33 36 #include "TclThreadManager.h" 34 #include "CoreIncludes.h"35 #include "util/Convert.h"36 37 37 38 38 namespace orxonox -
code/trunk/src/core/IRC.h
r2710 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include < cpptcl/cpptcl.h>34 #include <string> 35 35 #include "OrxonoxClass.h" 36 36 -
code/trunk/src/core/Identifier.cc
r2662 r3196 36 36 #include <ostream> 37 37 38 #include " Factory.h"38 #include "util/String.h" 39 39 #include "ConfigValueContainer.h" 40 40 #include "ConsoleCommand.h" 41 #include " CommandExecutor.h"41 #include "Factory.h" 42 42 #include "XMLPort.h" 43 43 … … 63 63 this->bHasConfigValues_ = false; 64 64 this->bHasConsoleCommands_ = false; 65 this->bHasConstructionCallback_ = false;66 65 67 66 this->children_ = new std::set<const Identifier*>(); … … 93 92 for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it) 94 93 delete (it->second); 95 for (std::vector<Functor*>::iterator it = this->constructionCallbacks_.begin(); it != this->constructionCallbacks_.end(); ++it)96 delete *it;97 94 } 98 95 … … 519 516 520 517 /** 521 @brief Adds a construction callback functor that gets called every time an object is created.522 @param functor Functor pointer to any function with no argument.523 */524 void Identifier::addConstructionCallback(Functor* functor)525 {526 for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)527 {528 if (this->constructionCallbacks_[i] == functor)529 return;530 }531 this->constructionCallbacks_.push_back(functor);532 this->bHasConstructionCallback_ = true;533 }534 535 /**536 @brief Removes a construction callback functor that gets called every time an object is created.537 @param functor Functor pointer to any function with no argument.538 */539 void Identifier::removeConstructionCallback(Functor* functor)540 {541 for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)542 {543 if (this->constructionCallbacks_[i] == functor)544 {545 this->constructionCallbacks_.erase(this->constructionCallbacks_.begin() + i);546 }547 }548 if (constructionCallbacks_.empty())549 this->bHasConstructionCallback_ = false;550 }551 552 /**553 518 @brief Lists the names of all Identifiers in a std::set<const Identifier*>. 554 519 @param out The outstream -
code/trunk/src/core/Identifier.h
r2784 r3196 55 55 #include "CorePrereqs.h" 56 56 57 #include <cassert> 58 #include <map> 57 59 #include <set> 58 #include <map>59 #include <vector>60 60 #include <string> 61 #include <utility>62 61 #include <typeinfo> 63 #include <cstdlib> 64 #include <cassert> 65 62 63 #include "util/Debug.h" 66 64 #include "MetaObjectList.h" 67 #include "Iterator.h" 65 #include "ObjectList.h" 66 #include "ObjectListBase.h" 68 67 #include "Super.h" 69 #include "Functor.h"70 #include "util/Debug.h"71 #include "util/String.h"72 68 73 69 namespace orxonox … … 223 219 /** @brief Returns true if this class has at least one console command. @return True if this class has at least one console command */ 224 220 inline bool hasConsoleCommands() const { return this->bHasConsoleCommands_; } 225 /** @brief Returns true if this class has at least one construction callback Functor registered. */226 inline bool hasConstructionCallback() const { return this->bHasConstructionCallback_; }227 221 228 222 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ … … 251 245 ConsoleCommand* getConsoleCommand(const std::string& name) const; 252 246 ConsoleCommand* getLowercaseConsoleCommand(const std::string& name) const; 253 254 void addConstructionCallback(Functor* functor);255 void removeConstructionCallback(Functor* functor);256 247 257 248 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); … … 276 267 /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */ 277 268 inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); } 278 279 bool bHasConstructionCallback_; //!< True if at least one Functor is registered to get informed when an object of type T is created.280 std::vector<Functor*> constructionCallbacks_; //!< All construction callback Functors of this class.281 269 282 270 ObjectListBase* objects_; //!< The list of all objects of this class … … 383 371 */ 384 372 template <class T> 385 ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()373 inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier() 386 374 { 387 375 // check if the static field has already been filled … … 398 386 */ 399 387 template <class T> 400 ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)388 inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name) 401 389 { 402 390 ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); … … 435 423 */ 436 424 template <class T> 437 void ClassIdentifier<T>::addObject(T* object)425 inline void ClassIdentifier<T>::addObject(T* object) 438 426 { 439 427 COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl; 440 428 object->getMetaList().add(this->objects_, this->objects_->add(new ObjectListElement<T>(object))); 441 if (this->bHasConstructionCallback_)442 {443 // Call all registered callbacks that a new object of type T has been created.444 // Do NOT deliver a T* pointer here because it's way too risky (object not yet fully created).445 for (unsigned int i = 0; i < this->constructionCallbacks_.size(); ++i)446 (*constructionCallbacks_[i])();447 }448 429 } 449 430 -
code/trunk/src/core/Iterator.h
r2896 r3196 47 47 #include "CorePrereqs.h" 48 48 49 #include "Identifier.h" 49 50 #include "ObjectListBase.h" 50 #include "ObjectListIterator.h"51 #include "OrxonoxClass.h"52 51 53 52 namespace orxonox … … 305 304 } 306 305 307 // Include ObjectList.h so the user only has to include one file: Iterator.h308 #include "ObjectList.h"309 310 306 #endif /* _Iterator_H__ */ -
code/trunk/src/core/Language.cc
r2759 r3196 37 37 #include <boost/filesystem.hpp> 38 38 39 #include "util/Debug.h" 39 40 #include "Core.h" 40 #include "util/Debug.h"41 41 42 42 namespace orxonox -
code/trunk/src/core/Loader.cc
r3008 r3196 32 32 #include <boost/filesystem.hpp> 33 33 34 #include "XMLFile.h" 34 #include "util/Debug.h" 35 #include "util/Exception.h" 35 36 #include "BaseObject.h" 36 #include " Identifier.h"37 #include "Core.h" 37 38 #include "Iterator.h" 38 39 #include "ObjectList.h" 39 #include "CoreIncludes.h"40 40 #include "LuaBind.h" 41 41 #include "Namespace.h" 42 #include "util/Debug.h" 43 #include "util/Exception.h" 44 #include "Core.h" 42 #include "XMLFile.h" 45 43 46 44 namespace orxonox -
code/trunk/src/core/Loader.h
r3008 r3196 33 33 34 34 #include <vector> 35 36 35 #include "ClassTreeMask.h" 37 36 -
code/trunk/src/core/LuaBind.cc
r3068 r3196 31 31 #include <fstream> 32 32 #include <map> 33 34 33 extern "C" { 35 #include <lua.h>36 34 #include <lualib.h> 37 35 } … … 39 37 #include <boost/filesystem.hpp> 40 38 39 #include "util/Debug.h" 41 40 #include "util/String.h" 42 #include "util/Debug.h"43 41 #include "ToluaBindCore.h" 44 42 #include "Core.h" … … 72 70 } 73 71 74 void LuaBind::luaPrint( std::stringstr)72 void LuaBind::luaPrint(const std::string& str) 75 73 { 76 74 output_ += str; … … 84 82 @param luaTags if true, the loaded file gets stripped off luaTags 85 83 */ 86 void LuaBind::loadFile( std::stringfilename, bool luaTags)84 void LuaBind::loadFile(const std::string& filename, bool luaTags) 87 85 { 88 86 boost::filesystem::path filepath(filename); … … 117 115 } 118 116 119 void LuaBind::loadString( std::stringcode)117 void LuaBind::loadString(const std::string& code) 120 118 { 121 119 luaSource_ = code; -
code/trunk/src/core/LuaBind.h
r3068 r3196 38 38 #include "CorePrereqs.h" 39 39 40 #include <cassert> 41 #include <string> 40 42 extern "C" { 41 43 #include <lua.h> 42 44 } 43 44 #include <cassert>45 #include <list>46 #include <string>47 45 48 46 // tolua_begin … … 64 62 inline static LuaBind& getInstance() { assert(singletonRef_s); return *LuaBind::singletonRef_s; } // tolua_export 65 63 66 void loadFile( std::stringfilename, bool luaTags);67 void loadString( std::stringcode);64 void loadFile(const std::string& filename, bool luaTags); 65 void loadString(const std::string& code); 68 66 //void init(lua_State *state_); 69 67 //void xmlToLua(); 70 68 void run(); 71 void luaPrint( std::stringstr); // tolua_export69 void luaPrint(const std::string& str); // tolua_export 72 70 73 71 #if LUA_VERSION_NUM != 501 … … 76 74 77 75 inline lua_State* getLuaState() { return luaState_; }; 78 inline std::stringgetLuaOutput() { return output_; };76 inline const std::string& getLuaOutput() { return output_; }; 79 77 //inline std::string* getFileString() { return &fileString_; }; 80 78 inline void clearLuaOutput() { output_ = ""; } -
code/trunk/src/core/MetaObjectList.cc
r2171 r3196 33 33 34 34 #include "MetaObjectList.h" 35 36 #include "util/Debug.h" 37 #include "Identifier.h" 35 38 #include "ObjectListBase.h" 36 #include "Identifier.h"37 #include "util/Debug.h"38 39 39 40 namespace orxonox -
code/trunk/src/core/Namespace.cc
r2087 r3196 28 28 29 29 #include "Namespace.h" 30 31 #include <set> 32 30 33 #include "NamespaceNode.h" 31 34 #include "CoreIncludes.h" -
code/trunk/src/core/Namespace.h
r2087 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include <map> 35 36 #include "XMLIncludes.h" 34 #include <set> 35 #include <string> 37 36 #include "BaseObject.h" 38 37 -
code/trunk/src/core/ObjectListBase.cc
r2784 r3196 35 35 */ 36 36 37 #include "ObjectListBase.h" 38 37 39 #include <set> 38 39 #include "CorePrereqs.h"40 41 #include "ObjectListBase.h"42 40 #include "Identifier.h" 43 41 #include "Iterator.h" 42 #include "ObjectListIterator.h" 44 43 45 44 namespace orxonox -
code/trunk/src/core/ObjectListBase.h
r2896 r3196 38 38 #define _ObjectListBase_H__ 39 39 40 #include "CorePrereqs.h" 41 40 42 #include <vector> 41 42 #include "CorePrereqs.h" 43 #include "OrxonoxClass.h" 43 44 44 45 namespace orxonox … … 139 140 140 141 private: 141 Identifier* identifier_; //!< The Iterator owning this list142 ObjectListBaseElement* first_; //!< The first element in the list143 ObjectListBaseElement* last_; //!< The last element in the list142 Identifier* identifier_; //!< The Iterator owning this list 143 ObjectListBaseElement* first_; //!< The first element in the list 144 ObjectListBaseElement* last_; //!< The last element in the list 144 145 std::vector<void*> iterators_; //!< A list of Iterators pointing on an element in this list 145 146 std::vector<void*> objectListIterators_; //!< A list of ObjectListIterators pointing on an element in this list -
code/trunk/src/core/ObjectListIterator.h
r2784 r3196 28 28 29 29 /** 30 @file Iterator.h30 @file 31 31 @brief Definition and implementation of the Iterator class. 32 32 … … 47 47 48 48 #include "CorePrereqs.h" 49 #include "ObjectListBase.h" 49 #include "Identifier.h" 50 #include "ObjectList.h" 50 51 51 52 namespace orxonox … … 230 231 } 231 232 232 // Include ObjectList.h so the user only has to include one file: Iterator.h233 #include "ObjectList.h"234 235 233 #endif /* _ObjectListIterator_H__ */ -
code/trunk/src/core/OrxonoxClass.cc
r2171 r3196 33 33 34 34 #include "OrxonoxClass.h" 35 35 36 #include "MetaObjectList.h" 36 37 #include "Identifier.h" -
code/trunk/src/core/OrxonoxClass.h
r2171 r3196 39 39 40 40 #include "CorePrereqs.h" 41 42 41 #include <set> 43 #include <string>44 42 45 43 namespace orxonox -
code/trunk/src/core/Shell.cc
r2662 r3196 28 28 29 29 #include "Shell.h" 30 31 #include "util/OutputHandler.h" 30 32 #include "CommandExecutor.h" 31 33 #include "CoreIncludes.h" … … 33 35 #include "Core.h" 34 36 #include "ConsoleCommand.h" 35 #include "util/OutputHandler.h"36 37 37 38 #define SHELL_UPDATE_LISTENERS(function) \ -
code/trunk/src/core/Shell.h
r1792 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include <cassert> 34 35 #include <list> 36 #include <string> 35 37 #include <vector> 36 38 -
code/trunk/src/core/Super.h
r2662 r3196 67 67 #define _Super_H__ 68 68 69 #include <iostream>70 71 69 #include "CorePrereqs.h" 72 70 73 71 #include "util/Debug.h" 74 #include "XMLIncludes.h"75 72 #include "Event.h" 76 73 -
code/trunk/src/core/TclBind.cc
r2710 r3196 29 29 #include "TclBind.h" 30 30 31 #include < iostream>31 #include <exception> 32 32 #include <string> 33 #include "ConsoleCommand.h" 34 #include "CommandExecutor.h" 35 #include "TclThreadManager.h" 33 #include <cpptcl/cpptcl.h> 34 36 35 #include "util/Debug.h" 37 36 #include "util/String.h" 37 #include "CommandExecutor.h" 38 #include "ConsoleCommand.h" 39 #include "TclThreadManager.h" 38 40 39 41 namespace orxonox -
code/trunk/src/core/TclBind.h
r2710 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include <cpptcl/cpptcl.h> 34 #include <cassert> 35 #include <string> 35 36 36 37 namespace orxonox -
code/trunk/src/core/TclThreadManager.cc
r2896 r3196 29 29 #include "TclThreadManager.h" 30 30 31 #include <iostream>32 #include <string>33 #include <boost/thread/thread.hpp>34 31 #include <boost/bind.hpp> 35 32 #include <OgreTimer.h> 36 33 #include <cpptcl/cpptcl.h> 34 35 #include "util/Convert.h" 36 #include "util/Debug.h" 37 37 #include "Clock.h" 38 #include "CommandExecutor.h" 39 #include "ConsoleCommand.h" 38 40 #include "CoreIncludes.h" 39 #include "ConsoleCommand.h"40 #include "CommandExecutor.h"41 41 #include "TclBind.h" 42 #include "util/Debug.h"43 #include "util/Convert.h"44 45 42 46 43 namespace orxonox -
code/trunk/src/core/TclThreadManager.h
r2896 r3196 32 32 #include "CorePrereqs.h" 33 33 34 #include < queue>34 #include <list> 35 35 #include <map> 36 #include < list>37 36 #include <string> 37 #include <boost/thread/condition.hpp> 38 38 #include <boost/thread/mutex.hpp> 39 #include <boost/thread/condition.hpp>40 39 #include <boost/thread/thread.hpp> 41 40 42 #include <cpptcl/cpptcl.h>43 41 #include "core/OrxonoxClass.h" 44 42 -
code/trunk/src/core/Template.cc
r3068 r3196 29 29 #include "Template.h" 30 30 31 #include <tinyxml/tinyxml.h> 31 32 #include <tinyxml/ticpp.h> 32 33 34 #include "util/Debug.h" 33 35 #include "core/CoreIncludes.h" 34 36 #include "core/XMLPort.h" 35 #include "util/Debug.h"36 37 37 38 namespace orxonox … … 39 40 CreateFactory(Template); 40 41 41 Template::Template(BaseObject* creator) : BaseObject(creator) , xmlelement_("")42 Template::Template(BaseObject* creator) : BaseObject(creator) 42 43 { 44 this->xmlelement_ = new TiXmlElement(""); 45 43 46 RegisterObject(Template); 44 47 … … 52 55 { 53 56 Template::getTemplateMap().erase(this->getName()); 57 delete this->xmlelement_; 54 58 } 55 59 … … 90 94 } 91 95 96 void Template::setXMLElement(const TiXmlElement& xmlelement) 97 { 98 *this->xmlelement_ = xmlelement; 99 } 100 92 101 const TiXmlElement& Template::getXMLElement() const 93 102 { … … 115 124 } 116 125 117 return this->xmlelement_;126 return *this->xmlelement_; 118 127 } 119 128 -
code/trunk/src/core/Template.h
r3068 r3196 30 30 #define _Template_H__ 31 31 32 #include <map>33 34 32 #include "CorePrereqs.h" 35 33 36 #include <tinyxml/tinyxml.h> 34 #include <map> 35 #include <string> 37 36 #include "BaseObject.h" 38 37 … … 58 57 { return this->bLoadDefaults_; } 59 58 60 inline void setXMLElement(const TiXmlElement& xmlelement) 61 { this->xmlelement_ = xmlelement; } 59 void setXMLElement(const TiXmlElement& xmlelement); 62 60 const TiXmlElement& getXMLElement() const; 63 61 … … 75 73 76 74 private: 77 TiXmlElement xmlelement_;75 TiXmlElement* xmlelement_; 78 76 std::string link_; 79 77 std::string baseclass_; -
code/trunk/src/core/XMLFile.h
r3068 r3196 33 33 34 34 #include <string> 35 36 35 #include "ClassTreeMask.h" 37 36 -
code/trunk/src/core/XMLPort.cc
r1789 r3196 28 28 29 29 #include "XMLPort.h" 30 #include "Language.h" 30 31 31 #include "Loader.h" 32 32 #include "Namespace.h" 33 #include "CoreIncludes.h"34 33 35 34 namespace orxonox … … 40 39 bool XMLPortObjectContainer::identifierIsIncludedInLoaderMask(const Identifier* identifier) 41 40 { 42 return ((!this->bApplyLoaderMask_) || identifier->isA(Class (Namespace)) || Loader::currentMask_s.isIncluded(identifier));41 return ((!this->bApplyLoaderMask_) || identifier->isA(ClassIdentifier<Namespace>::getIdentifier()) || Loader::currentMask_s.isIncluded(identifier)); 43 42 } 44 43 } -
code/trunk/src/core/XMLPort.h
r2896 r3196 44 44 45 45 #include <cassert> 46 #include <string> 46 47 #include <tinyxml/ticpp.h> 48 47 49 #include "util/Debug.h" 48 50 #include "util/Exception.h" 49 51 #include "util/MultiType.h" 50 #include "XMLIncludes.h" 52 #include "util/OrxAssert.h" 53 #include "Factory.h" 54 #include "Identifier.h" 51 55 #include "Executor.h" 52 #include "CoreIncludes.h"53 56 #include "BaseObject.h" 54 57 … … 176 179 */ 177 180 #define XMLPortParamGeneric(containername, classname, objectclass, object, paramname, loadexecutor, saveexecutor, xmlelement, mode) \ 178 orxonox::XMLPortClassParamContainer<objectclass>* containername = (orxonox::XMLPortClassParamContainer<objectclass>*)(ClassIdentifier<classname>::getIdentifier()->getXMLPortParamContainer(paramname)); \181 orxonox::XMLPortClassParamContainer<objectclass>* containername = static_cast<orxonox::XMLPortClassParamContainer<objectclass>*>(ClassIdentifier<classname>::getIdentifier()->getXMLPortParamContainer(paramname)); \ 179 182 if (!containername) \ 180 183 { \ … … 545 548 for (ticpp::Iterator<ticpp::Element> child = xmlsubelement->FirstChildElement(false); child != child.end(); child++) 546 549 { 547 Identifier* identifier = ClassByString(child->Value());550 Identifier* identifier = Factory::getIdentifier(child->Value()); 548 551 if (identifier) 549 552 { 550 if (identifier->isA(Class (O)))553 if (identifier->isA(ClassIdentifier<O>::getIdentifier())) 551 554 { 552 555 if (identifier->isLoadable()) … … 606 609 else 607 610 { 608 COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << Class (O)->getName() << "'." << std::endl;611 COUT(2) << object->getLoaderIndentation() << "Warning: '" << child->Value() << "' is not a '" << ClassIdentifier<O>::getIdentifier()->getName() << "'." << std::endl; 609 612 } 610 613 } … … 626 629 { 627 630 COUT(1) << std::endl; 628 COUT(1) << "An error occurred in XMLPort.h while loading a '" << Class (O)->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ":" << std::endl;631 COUT(1) << "An error occurred in XMLPort.h while loading a '" << ClassIdentifier<O>::getIdentifier()->getName() << "' in '" << this->sectionname_ << "' of '" << this->identifier_->getName() << "' (objectname: " << object->getName() << ") in " << object->getFilename() << ":" << std::endl; 629 632 COUT(1) << ex.what() << std::endl; 630 633 } -
code/trunk/src/core/input/CMakeLists.txt
r2710 r3196 1 1 ADD_SOURCE_FILES(CORE_SRC_FILES 2 2 Button.cc 3 CalibratorCallback.cc4 3 ExtendedInputState.cc 5 4 HalfAxis.cc -
code/trunk/src/core/input/ExtendedInputState.cc
r2896 r3196 36 36 37 37 #include <cassert> 38 #include " util/Debug.h"38 #include "core/Executor.h" 39 39 40 40 namespace orxonox … … 457 457 this->bHandlersChanged_ = true; 458 458 } 459 460 void ExtendedInputState::onEnter() 461 { 462 if (executorOnEnter_) 463 (*executorOnEnter_)(); 464 } 465 466 void ExtendedInputState::onLeave() 467 { 468 if (executorOnLeave_) 469 (*executorOnLeave_)(); 470 } 459 471 } -
code/trunk/src/core/input/ExtendedInputState.h
r2896 r3196 38 38 39 39 #include <vector> 40 41 40 #include "InputInterfaces.h" 42 41 #include "InputState.h" … … 89 88 void update(); 90 89 90 void onEnter(); 91 void onLeave(); 92 91 93 std::vector<KeyHandler*> keyHandlers_; 92 94 std::vector<MouseHandler*> mouseHandlers_; -
code/trunk/src/core/input/HalfAxis.h
r2087 r3196 37 37 38 38 #include "core/CorePrereqs.h" 39 39 40 #include "Button.h" 40 41 #include "InputCommands.h" -
code/trunk/src/core/input/InputBuffer.cc
r2896 r3196 28 28 29 29 #include "InputBuffer.h" 30 31 #include <iostream>32 30 33 31 #include "util/Clipboard.h" … … 57 55 } 58 56 59 InputBuffer::InputBuffer(const std::string allowedChars)57 InputBuffer::InputBuffer(const std::string& allowedChars) 60 58 { 61 59 RegisterRootObject(InputBuffer); -
code/trunk/src/core/input/InputBuffer.h
r2896 r3196 32 32 #include "core/CorePrereqs.h" 33 33 34 #include <list> 34 35 #include <string> 35 #include <list>36 37 36 #include "core/OrxonoxClass.h" 38 37 #include "InputInterfaces.h" … … 80 79 InputBuffer(); 81 80 ~InputBuffer(); 82 InputBuffer(const std::string allowedChars);81 InputBuffer(const std::string& allowedChars); 83 82 84 83 void setConfigValues(); … … 145 144 void updated(const char& update, bool bSingleInput); 146 145 147 inline std::stringget() const146 inline const std::string& get() const 148 147 { return this->buffer_; } 149 148 inline unsigned int getSize() const -
code/trunk/src/core/input/InputCommands.cc
r2087 r3196 35 35 #include "InputCommands.h" 36 36 #include "util/Math.h" 37 #include "core/CommandExecutor.h"38 37 39 38 namespace orxonox -
code/trunk/src/core/input/InputInterfaces.h
r2896 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include "ois/OISKeyboard.h"41 #include "ois/OISMouse.h"42 #include "ois/OISJoyStick.h"40 #include <ois/OISKeyboard.h> 41 #include <ois/OISMouse.h> 42 #include <ois/OISJoyStick.h> 43 43 #include "util/Math.h" 44 44 -
code/trunk/src/core/input/InputManager.cc
r3084 r3196 38 38 #include <climits> 39 39 #include <cassert> 40 41 #include "ois/OISException.h" 42 #include "ois/OISInputManager.h" 43 #include "core/ConsoleCommand.h" 44 45 // HACK 46 #ifdef ORXONOX_PLATFORM_LINUX 47 # include "ois/linux/LinuxMouse.h" 48 #endif 49 40 #include <ois/OISException.h> 41 #include <ois/OISInputManager.h> 42 43 #include "util/Convert.h" 50 44 #include "util/Exception.h" 45 #include "util/Debug.h" 51 46 #include "core/Clock.h" 52 47 #include "core/CoreIncludes.h" 53 48 #include "core/ConfigValueIncludes.h" 54 #include "core/Co mmandExecutor.h"49 #include "core/ConsoleCommand.h" 55 50 #include "core/CommandLine.h" 56 #include "util/Debug.h"57 51 58 52 #include "InputBuffer.h" 59 #include "KeyBinder.h"60 53 #include "KeyDetector.h" 61 #include "CalibratorCallback.h"62 54 #include "InputState.h" 63 55 #include "SimpleInputState.h" 64 56 #include "ExtendedInputState.h" 65 57 #include "JoyStickDeviceNumberListener.h" 58 59 // HACK (include this as last, X11 seems to define some macros...) 60 #ifdef ORXONOX_PLATFORM_LINUX 61 # include <ois/linux/LinuxMouse.h> 62 #endif 66 63 67 64 namespace orxonox … … 367 364 for (unsigned int i = 0; i < configValueVectorSize; ++i) 368 365 { 369 list[i] = omni_cast<int>(ConfigFileManager::getInstance().getValue(370 ConfigFileType::JoyStickCalibration, sectionName, valueName, i, omni_cast<std::string>(defaultValue), false));366 list[i] = multi_cast<int>(ConfigFileManager::getInstance().getValue( 367 ConfigFileType::JoyStickCalibration, sectionName, valueName, i, multi_cast<std::string>(defaultValue), false)); 371 368 } 372 369 … … 403 400 // Generate some sort of execution unique id per joy stick 404 401 std::string id = "JoyStick_"; 405 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Button)) + "_";406 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Axis)) + "_";407 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Slider)) + "_";408 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_POV)) + "_";409 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Vector3)) + "_";402 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Button)) + "_"; 403 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Axis)) + "_"; 404 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Slider)) + "_"; 405 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_POV)) + "_"; 406 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Vector3)) + "_"; 410 407 id += joySticks_[iJoyStick]->vendor(); 411 408 for (unsigned int i = 0; i < iJoyStick; ++i) … … 414 411 { 415 412 // Two joysticks are probably equal --> add the index as well 416 id += "_" + omni_cast<std::string>(iJoyStick);413 id += "_" + multi_cast<std::string>(iJoyStick); 417 414 } 418 415 } … … 497 494 joyStickMinValues_[iJoyStick][i] = -32768; 498 495 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 499 this->joyStickIDs_[iJoyStick], "MinValue", i, omni_cast<std::string>(joyStickMinValues_[iJoyStick][i]), false);496 this->joyStickIDs_[iJoyStick], "MinValue", i, multi_cast<std::string>(joyStickMinValues_[iJoyStick][i]), false); 500 497 501 498 // Maximum values … … 503 500 joyStickMaxValues_[iJoyStick][i] = 32767; 504 501 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 505 this->joyStickIDs_[iJoyStick], "MaxValue", i, omni_cast<std::string>(joyStickMaxValues_[iJoyStick][i]), false);502 this->joyStickIDs_[iJoyStick], "MaxValue", i, multi_cast<std::string>(joyStickMaxValues_[iJoyStick][i]), false); 506 503 507 504 // Middle values 508 505 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 509 this->joyStickIDs_[iJoyStick], "MiddleValue", i, omni_cast<std::string>(joyStickMiddleValues_[iJoyStick][i]), false);506 this->joyStickIDs_[iJoyStick], "MiddleValue", i, multi_cast<std::string>(joyStickMiddleValues_[iJoyStick][i]), false); 510 507 } 511 508 } … … 1169 1166 else 1170 1167 { 1171 float fValue = value - joyStickCalibrations_[iJoyStick].middleValue[axis];1168 float fValue = static_cast<float>(value - joyStickCalibrations_[iJoyStick].middleValue[axis]); 1172 1169 if (fValue > 0.0f) 1173 1170 fValue *= joyStickCalibrations_[iJoyStick].positiveCoeff[axis]; -
code/trunk/src/core/input/InputManager.h
r3084 r3196 40 40 41 41 #include <map> 42 #include <set> 43 #include <string> 42 44 #include <vector> 43 #include <stack> 45 #include <ois/OISKeyboard.h> 46 #include <ois/OISMouse.h> 47 #include <ois/OISJoyStick.h> 48 44 49 #include "util/Math.h" 45 50 #include "util/OrxEnum.h" -
code/trunk/src/core/input/InputState.h
r2896 r3196 39 39 #include <string> 40 40 #include <vector> 41 #include "core/Executor.h"42 41 #include "InputInterfaces.h" 43 42 … … 63 62 void resetHandlersChanged() { bHandlersChanged_ = false; } 64 63 65 virtual void onEnter() { if (executorOnEnter_) (*executorOnEnter_)(); }66 virtual void onLeave() { if (executorOnLeave_) (*executorOnLeave_)(); }64 virtual void onEnter() = 0; 65 virtual void onLeave() = 0; 67 66 68 67 virtual void registerOnEnter(Executor* executor) { executorOnEnter_ = executor; } … … 92 91 InputState() 93 92 : bHandlersChanged_(false) 93 , executorOnEnter_(0) 94 , executorOnLeave_(0) 94 95 , priority_(0) 95 96 , bAlwaysGetsInput_(false) 96 97 , bTransparent_(false) 97 , executorOnEnter_(0)98 , executorOnLeave_(0)99 98 { } 100 99 virtual ~InputState() { } … … 108 107 109 108 bool bHandlersChanged_; 109 Executor* executorOnEnter_; 110 Executor* executorOnLeave_; 110 111 111 112 private: … … 123 124 bool bAlwaysGetsInput_; 124 125 bool bTransparent_; 125 126 Executor* executorOnEnter_;127 Executor* executorOnLeave_;128 126 }; 129 127 } -
code/trunk/src/core/input/KeyBinder.cc
r2896 r3196 33 33 34 34 #include "KeyBinder.h" 35 36 #include <fstream>37 #include <string>38 35 39 36 #include "util/Convert.h" … … 320 317 { 321 318 mouseAxes_[2*i + 0].absVal_ 322 = -mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;319 = -mouseRelative_[i] / deriveTime_ * 0.0005f * mouseSensitivityDerived_; 323 320 mouseAxes_[2*i + 1].absVal_ = 0.0f; 324 321 } … … 327 324 mouseAxes_[2*i + 0].absVal_ = 0.0f; 328 325 mouseAxes_[2*i + 1].absVal_ 329 = mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;326 = mouseRelative_[i] / deriveTime_ * 0.0005f * mouseSensitivityDerived_; 330 327 } 331 328 else -
code/trunk/src/core/input/KeyBinder.h
r2896 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include <cassert> 41 #include <string> 40 42 #include <vector> 41 #include <cassert>42 43 43 44 #include "InputInterfaces.h" -
code/trunk/src/core/input/KeyDetector.cc
r1887 r3196 34 34 35 35 #include "KeyDetector.h" 36 36 37 #include "util/Debug.h" 37 38 #include "core/CoreIncludes.h" 38 #include "core/CommandExecutor.h"39 #include "core/CommandEvaluation.h"40 #include "InputCommands.h"41 39 #include "Button.h" 42 40 -
code/trunk/src/core/input/KeyDetector.h
r1887 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include <string> 40 41 #include "KeyBinder.h" 41 42 -
code/trunk/src/core/input/SimpleInputState.cc
r1887 r3196 34 34 35 35 #include "SimpleInputState.h" 36 #include "core/Executor.h" 36 37 37 38 namespace orxonox … … 148 149 bHandlersChanged_ = true; 149 150 } 151 152 void SimpleInputState::onEnter() 153 { 154 if (executorOnEnter_) 155 (*executorOnEnter_)(); 156 } 157 158 void SimpleInputState::onLeave() 159 { 160 if (executorOnLeave_) 161 (*executorOnLeave_)(); 162 } 150 163 } -
code/trunk/src/core/input/SimpleInputState.h
r2896 r3196 79 79 void update(); 80 80 void numberOfJoySticksChanged(unsigned int n); 81 82 void onEnter(); 83 void onLeave(); 81 84 82 85 KeyHandler* keyHandler_;
Note: See TracChangeset
for help on using the changeset viewer.