Changeset 10771
- Timestamp:
- Nov 7, 2015, 5:24:58 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/OrxonoxConfig.h.in
r10769 r10771 216 216 } 217 217 218 // Import general purpose smart pointers219 namespace boost220 {221 template<class T> class scoped_ptr;222 template<class T> class shared_ptr;223 template<class T> class weak_ptr;224 template<class T> class intrusive_ptr;225 template<class T> class shared_array;226 template<class T> class scoped_array;227 }228 namespace orxonox229 {230 using boost::scoped_ptr;231 using boost::shared_ptr;232 using boost::weak_ptr;233 using boost::intrusive_ptr;234 using boost::shared_array;235 using boost::scoped_array;236 }237 238 218 // Define Boost Filesystem version 239 219 #include <boost/version.hpp> -
code/branches/cpp11_v2/src/external/cpptcl/cpptcl.cc
r8351 r10771 17 17 using namespace Tcl::details; 18 18 using namespace std; 19 // boost::shared_ptr conflicts with the new std::shared_ptr20 //using namespace boost;21 22 19 23 20 result::result(Tcl_Interp *interp) : interp_(interp) {} … … 168 165 169 166 // map of polymorphic callbacks 170 typedef map<string, boost::shared_ptr<callback_base> > callback_interp_map;167 typedef map<string, std::shared_ptr<callback_base> > callback_interp_map; 171 168 typedef map<Tcl_Interp *, callback_interp_map> callback_map; 172 169 … … 181 178 182 179 // map of object handlers 183 typedef map<string, boost::shared_ptr<class_handler_base> > class_interp_map;180 typedef map<string, std::shared_ptr<class_handler_base> > class_interp_map; 184 181 typedef map<Tcl_Interp *, class_interp_map> class_handlers_map; 185 182 … … 492 489 493 490 void class_handler_base::register_method(string const &name, 494 boost::shared_ptr<object_cmd_base> ocb, policies const &p)491 std::shared_ptr<object_cmd_base> ocb, policies const &p) 495 492 { 496 493 methods_[name] = ocb; … … 991 988 992 989 void interpreter::add_function(string const &name, 993 boost::shared_ptr<callback_base> cb, policies const &p)990 std::shared_ptr<callback_base> cb, policies const &p) 994 991 { 995 992 Tcl_CreateObjCommand(interp_, name.c_str(), … … 1001 998 1002 999 void interpreter::add_class(string const &name, 1003 boost::shared_ptr<class_handler_base> chb)1000 std::shared_ptr<class_handler_base> chb) 1004 1001 { 1005 1002 class_handlers[interp_][name] = chb; … … 1007 1004 1008 1005 void interpreter::add_constructor(string const &name, 1009 boost::shared_ptr<class_handler_base> chb, boost::shared_ptr<callback_base> cb,1006 std::shared_ptr<class_handler_base> chb, std::shared_ptr<callback_base> cb, 1010 1007 policies const &p) 1011 1008 { -
code/branches/cpp11_v2/src/external/cpptcl/cpptcl.h
r5781 r10771 17 17 #include <map> 18 18 #include <vector> 19 #include <boost/shared_ptr.hpp>20 19 #include <boost/bind.hpp> 21 20 … … 141 140 142 141 void register_method(std::string const &name, 143 boost::shared_ptr<object_cmd_base> ocb, policies const &p);142 std::shared_ptr<object_cmd_base> ocb, policies const &p); 144 143 145 144 policies & get_policies(std::string const &name); … … 148 147 typedef std::map< 149 148 std::string, 150 boost::shared_ptr<object_cmd_base>149 std::shared_ptr<object_cmd_base> 151 150 > method_map_type; 152 151 … … 214 213 { 215 214 public: 216 class_definer( boost::shared_ptr<class_handler<C> > ch) : ch_(ch) {}215 class_definer(std::shared_ptr<class_handler<C> > ch) : ch_(ch) {} 217 216 218 217 template <typename R> … … 221 220 { 222 221 ch_->register_method(name, 223 boost::shared_ptr<details::object_cmd_base>(222 std::shared_ptr<details::object_cmd_base>( 224 223 new details::method0<C, R>(f)), p); 225 224 return *this; … … 231 230 { 232 231 ch_->register_method(name, 233 boost::shared_ptr<details::object_cmd_base>(232 std::shared_ptr<details::object_cmd_base>( 234 233 new details::method0<C, R>(f)), p); 235 234 return *this; … … 241 240 { 242 241 ch_->register_method(name, 243 boost::shared_ptr<details::object_cmd_base>(242 std::shared_ptr<details::object_cmd_base>( 244 243 new details::method1<C, R, T1>(f)), p); 245 244 return *this; … … 251 250 { 252 251 ch_->register_method(name, 253 boost::shared_ptr<details::object_cmd_base>(252 std::shared_ptr<details::object_cmd_base>( 254 253 new details::method1<C, R, T1>(f)), p); 255 254 return *this; … … 261 260 { 262 261 ch_->register_method(name, 263 boost::shared_ptr<details::object_cmd_base>(262 std::shared_ptr<details::object_cmd_base>( 264 263 new details::method2<C, R, T1, T2>(f)), p); 265 264 return *this; … … 271 270 { 272 271 ch_->register_method(name, 273 boost::shared_ptr<details::object_cmd_base>(272 std::shared_ptr<details::object_cmd_base>( 274 273 new details::method2<C, R, T1, T2>(f)), p); 275 274 return *this; … … 281 280 { 282 281 ch_->register_method(name, 283 boost::shared_ptr<details::object_cmd_base>(282 std::shared_ptr<details::object_cmd_base>( 284 283 new details::method3<C, R, T1, T2, T3>(f)), p); 285 284 return *this; … … 291 290 { 292 291 ch_->register_method(name, 293 boost::shared_ptr<details::object_cmd_base>(292 std::shared_ptr<details::object_cmd_base>( 294 293 new details::method3<C, R, T1, T2, T3>(f)), p); 295 294 return *this; … … 301 300 { 302 301 ch_->register_method(name, 303 boost::shared_ptr<details::object_cmd_base>(302 std::shared_ptr<details::object_cmd_base>( 304 303 new details::method4<C, R, T1, T2, T3, T4>(f)), p); 305 304 return *this; … … 312 311 { 313 312 ch_->register_method(name, 314 boost::shared_ptr<details::object_cmd_base>(313 std::shared_ptr<details::object_cmd_base>( 315 314 new details::method4<C, R, T1, T2, T3, T4>(f)), p); 316 315 return *this; … … 323 322 { 324 323 ch_->register_method(name, 325 boost::shared_ptr<details::object_cmd_base>(324 std::shared_ptr<details::object_cmd_base>( 326 325 new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p); 327 326 return *this; … … 334 333 { 335 334 ch_->register_method(name, 336 boost::shared_ptr<details::object_cmd_base>(335 std::shared_ptr<details::object_cmd_base>( 337 336 new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p); 338 337 return *this; … … 345 344 { 346 345 ch_->register_method(name, 347 boost::shared_ptr<details::object_cmd_base>(346 std::shared_ptr<details::object_cmd_base>( 348 347 new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)), 349 348 p); … … 358 357 { 359 358 ch_->register_method(name, 360 boost::shared_ptr<details::object_cmd_base>(359 std::shared_ptr<details::object_cmd_base>( 361 360 new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)), 362 361 p); … … 371 370 { 372 371 ch_->register_method(name, 373 boost::shared_ptr<details::object_cmd_base>(372 std::shared_ptr<details::object_cmd_base>( 374 373 new details::method7<C, R, 375 374 T1, T2, T3, T4, T5, T6, T7>(f)), p); … … 384 383 { 385 384 ch_->register_method(name, 386 boost::shared_ptr<details::object_cmd_base>(385 std::shared_ptr<details::object_cmd_base>( 387 386 new details::method7<C, R, 388 387 T1, T2, T3, T4, T5, T6, T7>(f)), p); … … 397 396 { 398 397 ch_->register_method(name, 399 boost::shared_ptr<details::object_cmd_base>(398 std::shared_ptr<details::object_cmd_base>( 400 399 new details::method8<C, R, 401 400 T1, T2, T3, T4, T5, T6, T7, T8>(f)), p); … … 410 409 { 411 410 ch_->register_method(name, 412 boost::shared_ptr<details::object_cmd_base>(411 std::shared_ptr<details::object_cmd_base>( 413 412 new details::method8<C, R, 414 413 T1, T2, T3, T4, T5, T6, T7, T8>(f)), p); … … 423 422 { 424 423 ch_->register_method(name, 425 boost::shared_ptr<details::object_cmd_base>(424 std::shared_ptr<details::object_cmd_base>( 426 425 new details::method9<C, R, 427 426 T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p); … … 436 435 { 437 436 ch_->register_method(name, 438 boost::shared_ptr<details::object_cmd_base>(437 std::shared_ptr<details::object_cmd_base>( 439 438 new details::method9<C, R, 440 439 T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p); … … 443 442 444 443 private: 445 boost::shared_ptr<class_handler<C> > ch_;444 std::shared_ptr<class_handler<C> > ch_; 446 445 }; 447 446 … … 482 481 { 483 482 add_function(name, 484 boost::shared_ptr<details::callback_base>(483 std::shared_ptr<details::callback_base>( 485 484 new details::callback0<R>(f)), p); 486 485 } … … 491 490 { 492 491 add_function(name, 493 boost::shared_ptr<details::callback_base>(492 std::shared_ptr<details::callback_base>( 494 493 new details::callback1<R, T1>(f)), p); 495 494 } … … 500 499 { 501 500 add_function(name, 502 boost::shared_ptr<details::callback_base>(501 std::shared_ptr<details::callback_base>( 503 502 new details::callback2<R, T1, T2>(f)), p); 504 503 } … … 509 508 { 510 509 add_function(name, 511 boost::shared_ptr<details::callback_base>(510 std::shared_ptr<details::callback_base>( 512 511 new details::callback3<R, T1, T2, T3>(f)), p); 513 512 } … … 518 517 { 519 518 add_function(name, 520 boost::shared_ptr<details::callback_base>(519 std::shared_ptr<details::callback_base>( 521 520 new details::callback4<R, T1, T2, T3, T4>(f)), p); 522 521 } … … 528 527 { 529 528 add_function(name, 530 boost::shared_ptr<details::callback_base>(529 std::shared_ptr<details::callback_base>( 531 530 new details::callback5<R, T1, T2, T3, T4, T5>(f)), p); 532 531 } … … 538 537 { 539 538 add_function(name, 540 boost::shared_ptr<details::callback_base>(539 std::shared_ptr<details::callback_base>( 541 540 new details::callback6<R, T1, T2, T3, T4, T5, T6>(f)), p); 542 541 } … … 548 547 { 549 548 add_function(name, 550 boost::shared_ptr<details::callback_base>(549 std::shared_ptr<details::callback_base>( 551 550 new details::callback7<R, 552 551 T1, T2, T3, T4, T5, T6, T7>(f)), p); … … 559 558 { 560 559 add_function(name, 561 boost::shared_ptr<details::callback_base>(560 std::shared_ptr<details::callback_base>( 562 561 new details::callback8<R, 563 562 T1, T2, T3, T4, T5, T6, T7, T8>(f)), p); … … 572 571 { 573 572 add_function(name, 574 boost::shared_ptr<details::callback_base>(573 std::shared_ptr<details::callback_base>( 575 574 new details::callback9<R, 576 575 T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p); … … 583 582 details::class_definer<C> class_(std::string const &name) 584 583 { 585 boost::shared_ptr<details::class_handler<C> > ch(584 std::shared_ptr<details::class_handler<C> > ch( 586 585 new details::class_handler<C>()); 587 586 … … 589 588 590 589 add_constructor(name, ch, 591 boost::shared_ptr<details::callback_base>(590 std::shared_ptr<details::callback_base>( 592 591 new details::callback0<C*>(&details::construct< 593 592 C, void, void, void, void, void, void, void, … … 608 607 callback_type; 609 608 610 boost::shared_ptr<details::class_handler<C> > ch(609 std::shared_ptr<details::class_handler<C> > ch( 611 610 new details::class_handler<C>()); 612 611 … … 614 613 615 614 add_constructor(name, ch, 616 boost::shared_ptr<details::callback_base>(615 std::shared_ptr<details::callback_base>( 617 616 new callback_type(&details::construct< 618 617 C, T1, T2, T3, T4, T5, T6, T7, T8, T9>::doit)), p); … … 625 624 std::string const &name, details::no_init_type const &) 626 625 { 627 boost::shared_ptr<details::class_handler<C> > ch(626 std::shared_ptr<details::class_handler<C> > ch( 628 627 new details::class_handler<C>()); 629 628 … … 660 659 661 660 void add_function(std::string const &name, 662 boost::shared_ptr<details::callback_base> cb,661 std::shared_ptr<details::callback_base> cb, 663 662 policies const &p = policies()); 664 663 665 664 void add_class(std::string const &name, 666 boost::shared_ptr<details::class_handler_base> chb);665 std::shared_ptr<details::class_handler_base> chb); 667 666 668 667 void add_constructor(std::string const &name, 669 boost::shared_ptr<details::class_handler_base> chb,670 boost::shared_ptr<details::callback_base> cb,668 std::shared_ptr<details::class_handler_base> chb, 669 std::shared_ptr<details::callback_base> cb, 671 670 policies const &p = policies()); 672 671 -
code/branches/cpp11_v2/src/libraries/core/CorePrecompiledHeaders.h
r8858 r10771 50 50 #include <sstream> // 53 51 51 #include <set> // 50 52 #include <memory> 52 53 53 54 #include "util/Output.h" // 48 … … 66 67 #include <OgreColourValue.h> // 36 67 68 #include <boost/preprocessor/cat.hpp> // 27 68 #include <boost/shared_ptr.hpp> // 2169 69 70 70 #ifdef ORXONOX_COMPILER_MSVC … … 76 76 #include "util/SubString.h" // 14 77 77 78 #include <boost/scoped_ptr.hpp> // 1379 78 #include <stack> // 12 80 79 -
code/branches/cpp11_v2/src/libraries/core/GUIManager.h
r10768 r10771 40 40 #include <map> 41 41 #include <string> 42 #include <memory> 42 43 43 44 #if CEGUI_VERSION >= 0x000800 … … 48 49 # include <CEGUIVersion.h> 49 50 #endif 50 51 #include <boost/shared_ptr.hpp>52 51 53 52 #include "util/DestructionHelper.h" … … 196 195 CEGUI::LuaScriptModule* scriptModule_; //!< CEGUI's script module to use Lua 197 196 CEGUI::System* guiSystem_; //!< CEGUI's main system 198 s hared_ptr<ResourceInfo>rootFileInfo_; //!< Resource information about the root script197 std::shared_ptr<ResourceInfo> rootFileInfo_; //!< Resource information about the root script 199 198 CEGUI::Logger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log 200 199 int outputLevelCeguiLog_; //!< CEGUI's log level -
code/branches/cpp11_v2/src/libraries/core/Game.cc
r10769 r10771 36 36 37 37 #include <exception> 38 #include <boost/weak_ptr.hpp>39 38 #include <loki/ScopeGuard.h> 40 39 … … 72 71 { 73 72 std::string name_; 74 weak_ptr<GameStateTreeNode> parent_;75 std::vector<s hared_ptr<GameStateTreeNode>> children_;73 std::weak_ptr<GameStateTreeNode> parent_; 74 std::vector<std::shared_ptr<GameStateTreeNode>> children_; 76 75 }; 77 76 … … 124 123 125 124 // The empty root state is ALWAYS loaded! 126 this->rootStateNode_ = s hared_ptr<GameStateTreeNode>(new GameStateTreeNode());125 this->rootStateNode_ = std::shared_ptr<GameStateTreeNode>(new GameStateTreeNode()); 127 126 this->rootStateNode_->name_ = "emptyRootGameState"; 128 127 this->loadedTopStateNode_ = this->rootStateNode_; … … 137 136 138 137 assert(loadedStates_.size() <= 1); // Just empty root GameState 139 // Destroy all GameStates (s hared_ptrs take care of actual destruction)138 // Destroy all GameStates (std::shared_ptrs take care of actual destruction) 140 139 constructedStates_.clear(); 141 140 … … 235 234 while (this->requestedStateNodes_.size() > 0) 236 235 { 237 s hared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();236 std::shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front(); 238 237 assert(this->loadedTopStateNode_); 239 238 if (!this->loadedTopStateNode_->parent_.expired() && requestedStateNode == this->loadedTopStateNode_->parent_.lock()) … … 281 280 orxout(user_error) << "This should really never happen!" << endl; 282 281 orxout(user_error) << "Unloading all GameStates depending on the one that crashed." << endl; 283 s hared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;282 std::shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_; 284 283 while (current->name_ != (*it)->getName() && current) 285 284 current = current->parent_.lock(); … … 372 371 } 373 372 374 s hared_ptr<GameStateTreeNode> lastRequestedNode;373 std::shared_ptr<GameStateTreeNode> lastRequestedNode; 375 374 if (this->requestedStateNodes_.empty()) 376 375 lastRequestedNode = this->loadedTopStateNode_; … … 384 383 385 384 // Check children first 386 std::vector<s hared_ptr<GameStateTreeNode>> requestedNodes;385 std::vector<std::shared_ptr<GameStateTreeNode>> requestedNodes; 387 386 for (unsigned int i = 0; i < lastRequestedNode->children_.size(); ++i) 388 387 { … … 397 396 { 398 397 // Check parent and all its grand parents 399 s hared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;398 std::shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode; 400 399 while (currentNode != nullptr) 401 400 { … … 424 423 void Game::popState() 425 424 { 426 s hared_ptr<GameStateTreeNode> lastRequestedNode;425 std::shared_ptr<GameStateTreeNode> lastRequestedNode; 427 426 if (this->requestedStateNodes_.empty()) 428 427 lastRequestedNode = this->loadedTopStateNode_; … … 435 434 } 436 435 437 s hared_ptr<GameState> Game::getState(const std::string& name)436 std::shared_ptr<GameState> Game::getState(const std::string& name) 438 437 { 439 438 GameStateMap::const_iterator it = constructedStates_.find(name); … … 447 446 else 448 447 orxout(internal_error) << "Could not find GameState '" << name << "'." << endl; 449 return s hared_ptr<GameState>();448 return std::shared_ptr<GameState>(); 450 449 } 451 450 } … … 479 478 /*** Internal ***/ 480 479 481 void Game::parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, s hared_ptr<GameStateTreeNode> currentNode)480 void Game::parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, std::shared_ptr<GameStateTreeNode> currentNode) 482 481 { 483 482 SubString tokens(it->first, ","); … … 491 490 if (tokens[i] == this->rootStateNode_->name_) 492 491 ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy..."); 493 s hared_ptr<GameStateTreeNode> node(new GameStateTreeNode());492 std::shared_ptr<GameStateTreeNode> node(new GameStateTreeNode()); 494 493 node->name_ = tokens[i]; 495 494 node->parent_ = currentNode; … … 527 526 { 528 527 // Game state loading failure is serious --> don't catch 529 s hared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second);528 std::shared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second); 530 529 if (!constructedStates_.insert(std::make_pair( 531 530 it->second.stateName, gameState)).second) … … 582 581 graphicsUnloader.Dismiss(); 583 582 584 s hared_ptr<GameState> state = this->getState(name);583 std::shared_ptr<GameState> state = this->getState(name); 585 584 state->activateInternal(); 586 585 if (!this->loadedStates_.empty()) … … 599 598 try 600 599 { 601 s hared_ptr<GameState> state = this->getState(name);600 std::shared_ptr<GameState> state = this->getState(name); 602 601 state->activity_.topState = false; 603 602 this->loadedStates_.pop_back(); … … 620 619 } 621 620 622 /*static*/ std::map<std::string, s hared_ptr<Game::GameStateFactory>>& Game::GameStateFactory::getFactories()623 { 624 static std::map<std::string, s hared_ptr<GameStateFactory>> factories;621 /*static*/ std::map<std::string, std::shared_ptr<Game::GameStateFactory>>& Game::GameStateFactory::getFactories() 622 { 623 static std::map<std::string, std::shared_ptr<GameStateFactory>> factories; 625 624 return factories; 626 625 } 627 626 628 /*static*/ s hared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)629 { 630 std::map<std::string, s hared_ptr<Game::GameStateFactory>>::const_iterator it = getFactories().find(info.className);627 /*static*/ std::shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info) 628 { 629 std::map<std::string, std::shared_ptr<Game::GameStateFactory>>::const_iterator it = getFactories().find(info.className); 631 630 assert(it != getFactories().end()); 632 631 return it->second->fabricateInternal(info); -
code/branches/cpp11_v2/src/libraries/core/Game.h
r10769 r10771 44 44 #include <string> 45 45 #include <vector> 46 #include < boost/shared_ptr.hpp>46 #include <memory> 47 47 #include <boost/preprocessor/cat.hpp> 48 48 … … 84 84 { // tolua_export 85 85 friend class Singleton<Game>; 86 typedef std::vector<s hared_ptr<GameState>> GameStateVector;87 typedef std::map<std::string, s hared_ptr<GameState>> GameStateMap;88 typedef s hared_ptr<GameStateTreeNode> GameStateTreeNodePtr;86 typedef std::vector<std::shared_ptr<GameState>> GameStateVector; 87 typedef std::map<std::string, std::shared_ptr<GameState>> GameStateMap; 88 typedef std::shared_ptr<GameStateTreeNode> GameStateTreeNodePtr; 89 89 90 90 public: … … 97 97 98 98 void setStateHierarchy(const std::string& str); 99 s hared_ptr<GameState> getState(const std::string& name);99 std::shared_ptr<GameState> getState(const std::string& name); 100 100 101 101 void run(); … … 123 123 public: 124 124 virtual ~GameStateFactory() { } 125 static s hared_ptr<GameState> fabricate(const GameStateInfo& info);125 static std::shared_ptr<GameState> fabricate(const GameStateInfo& info); 126 126 template <class T> 127 127 static void createFactory(const std::string& className) 128 128 { getFactories()[className].reset(new TemplateGameStateFactory<T>()); } 129 129 130 virtual s hared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;131 static std::map<std::string, s hared_ptr<GameStateFactory>>& getFactories();130 virtual std::shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0; 131 static std::map<std::string, std::shared_ptr<GameStateFactory>>& getFactories(); 132 132 }; 133 133 template <class T> … … 135 135 { 136 136 public: 137 s hared_ptr<GameState> fabricateInternal(const GameStateInfo& info)138 { return s hared_ptr<GameState>(new T(info)); }137 std::shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) 138 { return std::shared_ptr<GameState>(new T(info)); } 139 139 }; 140 140 … … 150 150 void unloadGraphics(bool loadGraphicsManagerWithoutRenderer = true); 151 151 152 void parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, s hared_ptr<GameStateTreeNode> currentNode);152 void parseStates(std::vector<std::pair<std::string, int>>::const_iterator& it, std::shared_ptr<GameStateTreeNode> currentNode); 153 153 bool checkState(const std::string& name) const; 154 154 void loadState(const std::string& name); -
code/branches/cpp11_v2/src/libraries/core/GraphicsManager.cc
r10768 r10771 34 34 #include <sstream> 35 35 #include <boost/filesystem.hpp> 36 #include <boost/shared_array.hpp>37 36 38 37 #include <OgreFrameListener.h> -
code/branches/cpp11_v2/src/libraries/core/GraphicsManager.h
r10765 r10771 47 47 #include <cassert> 48 48 #include <string> 49 #include <memory> 50 49 51 #include <OgreLog.h> 50 #include <boost/shared_ptr.hpp>51 52 52 53 #include "util/DestructionHelper.h" … … 130 131 131 132 // XML files for the resources and the debug overlay 132 s hared_ptr<XMLFile> resources_;//!< XML with resource locations133 s hared_ptr<XMLFile> extResources_;//!< XML with resource locations in the external path (only for dev runs)134 s hared_ptr<XMLFile> debugOverlay_;//!< XML with various debug overlays133 std::shared_ptr<XMLFile> resources_; //!< XML with resource locations 134 std::shared_ptr<XMLFile> extResources_; //!< XML with resource locations in the external path (only for dev runs) 135 std::shared_ptr<XMLFile> debugOverlay_; //!< XML with various debug overlays 135 136 136 137 // config values -
code/branches/cpp11_v2/src/libraries/core/Loader.cc
r10769 r10771 73 73 std::string xmlInput; 74 74 75 s hared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace(new std::vector<std::vector<std::pair<std::string, size_t>>>());75 std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace(new std::vector<std::vector<std::pair<std::string, size_t>>>()); 76 76 lineTrace->reserve(1000); //arbitrary number 77 77 … … 80 80 { 81 81 // Use the LuaState to replace the XML tags (calls our function) 82 scoped_ptr<LuaState> luaState(new LuaState());82 boost::scoped_ptr<LuaState> luaState(new LuaState()); 83 83 luaState->setTraceMap(lineTrace); 84 84 luaState->setIncludeParser(&Loader::replaceLuaTags); … … 88 88 else 89 89 { 90 s hared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename());90 std::shared_ptr<ResourceInfo> info = Resource::getInfo(file->getFilename()); 91 91 if (info == nullptr) 92 92 { -
code/branches/cpp11_v2/src/libraries/core/LuaState.cc
r10769 r10771 79 79 } 80 80 81 s hared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)81 std::shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename) 82 82 { 83 83 // Look in the current directory first 84 s hared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename);84 std::shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename); 85 85 // Continue search in root directories 86 86 if (sourceInfo == nullptr && !sourceFileInfo_->path.empty()) … … 91 91 bool LuaState::includeFile(const std::string& filename) 92 92 { 93 s hared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);93 std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename); 94 94 if (sourceInfo != nullptr) 95 95 return this->includeString(Resource::open(sourceInfo)->getAsString(), sourceInfo); … … 101 101 } 102 102 103 bool LuaState::includeString(const std::string& code, const s hared_ptr<ResourceInfo>& sourceFileInfo)103 bool LuaState::includeString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo) 104 104 { 105 105 // Parse string with provided include parser (otherwise don't preparse at all) … … 131 131 bool LuaState::doFile(const std::string& filename) 132 132 { 133 s hared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);133 std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename); 134 134 if (sourceInfo != nullptr) 135 135 return this->doString(Resource::open(sourceInfo)->getAsString(), sourceInfo); … … 141 141 } 142 142 143 bool LuaState::doString(const std::string& code, const s hared_ptr<ResourceInfo>& sourceFileInfo)143 bool LuaState::doString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo) 144 144 { 145 145 // Save the old source file info 146 s hared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;146 std::shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_; 147 147 // Only override if sourceFileInfo provides useful information 148 148 if (sourceFileInfo != nullptr) … … 285 285 bool LuaState::fileExists(const std::string& filename) 286 286 { 287 s hared_ptr<ResourceInfo> info = this->getFileInfo(filename);287 std::shared_ptr<ResourceInfo> info = this->getFileInfo(filename); 288 288 if (info == nullptr) 289 289 return false; … … 300 300 if (it != this->sourceCodeMap_.end()) 301 301 return it->second; 302 s hared_ptr<ResourceInfo> info = Resource::getInfo(filename);302 std::shared_ptr<ResourceInfo> info = Resource::getInfo(filename); 303 303 if (info == nullptr) 304 304 return ""; -
code/branches/cpp11_v2/src/libraries/core/LuaState.h
r10769 r10771 47 47 #include <string> 48 48 #include <vector> 49 #include < boost/shared_ptr.hpp>49 #include <memory> 50 50 51 51 #include "util/Output.h" … … 79 79 80 80 bool doFile(const std::string& filename); // tolua_export 81 bool doString(const std::string& code, const s hared_ptr<ResourceInfo>& sourceFileInfo =shared_ptr<ResourceInfo>());81 bool doString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo = std::shared_ptr<ResourceInfo>()); 82 82 83 83 bool includeFile(const std::string& filename); // tolua_export 84 bool includeString(const std::string& code, const s hared_ptr<ResourceInfo>& sourceFileInfo =shared_ptr<ResourceInfo>());84 bool includeString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo = std::shared_ptr<ResourceInfo>()); 85 85 86 86 void luaPrint(const std::string& str); // tolua_export … … 94 94 void clearOutput() { output_.clear(); } // tolua_export 95 95 96 void setTraceMap(s hared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> map)96 void setTraceMap(std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> map) 97 97 { map->push_back(std::vector<std::pair<std::string, size_t>>()); lineTrace_ = map; } 98 98 … … 100 100 lua_State* getInternalLuaState() { return luaState_; } 101 101 102 void setDefaultResourceInfo(const s hared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; }103 const s hared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; }102 void setDefaultResourceInfo(const std::shared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; } 103 const std::shared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; } 104 104 105 105 LuaFunctor* createLuaFunctor(const std::string& code) { return new LuaFunctor(code, this); } // tolua_export … … 115 115 116 116 private: 117 s hared_ptr<ResourceInfo> getFileInfo(const std::string& filename);118 s hared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace_;117 std::shared_ptr<ResourceInfo> getFileInfo(const std::string& filename); 118 std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> lineTrace_; 119 119 120 120 std::stringstream output_; 121 121 lua_State* luaState_; 122 122 bool bIsRunning_; 123 s hared_ptr<ResourceInfo> sourceFileInfo_;123 std::shared_ptr<ResourceInfo> sourceFileInfo_; 124 124 std::map<std::string, std::string> sourceCodeMap_; 125 125 std::string (*includeParseFunction_)(const std::string&); -
code/branches/cpp11_v2/src/libraries/core/Resource.cc
r10765 r10771 79 79 } 80 80 81 s hared_ptr<ResourceInfo> Resource::getInfo(const std::string& name)81 std::shared_ptr<ResourceInfo> Resource::getInfo(const std::string& name) 82 82 { 83 83 std::string group; … … 88 88 catch (const Ogre::Exception&) 89 89 { 90 return s hared_ptr<ResourceInfo>();90 return std::shared_ptr<ResourceInfo>(); 91 91 } 92 92 Ogre::FileInfoListPtr infos = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(group, name); … … 95 95 if (it->filename == name) 96 96 { 97 s hared_ptr<ResourceInfo> ptr(new ResourceInfo());97 std::shared_ptr<ResourceInfo> ptr(new ResourceInfo()); 98 98 ptr->filename = name; 99 99 ptr->path = it->path; … … 114 114 } 115 115 } 116 return s hared_ptr<ResourceInfo>();116 return std::shared_ptr<ResourceInfo>(); 117 117 } 118 118 -
code/branches/cpp11_v2/src/libraries/core/Resource.h
r8351 r10771 42 42 #include "CorePrereqs.h" 43 43 44 #include <boost/shared_ptr.hpp> 44 #include <memory> 45 45 46 #include <OgreDataStream.h> 46 47 #include <OgreStringVector.h> … … 93 94 94 95 //! Similar to open(string, string, bool), but with a fileInfo struct 95 static DataStreamPtr open(s hared_ptr<ResourceInfo> fileInfo)96 static DataStreamPtr open(std::shared_ptr<ResourceInfo> fileInfo) 96 97 { 97 98 return open(fileInfo->filename); … … 125 126 Fully qualified name of the file to test for 126 127 */ 127 static s hared_ptr<ResourceInfo> getInfo(const std::string& name);128 static std::shared_ptr<ResourceInfo> getInfo(const std::string& name); 128 129 129 130 /** -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
r10768 r10771 188 188 { 189 189 while (joyStickAxes_.size() < joySticks_.size()) 190 joyStickAxes_.push_back(s hared_ptr<JoyStickAxisVector>(new JoyStickAxisVector()));190 joyStickAxes_.push_back(std::shared_ptr<JoyStickAxisVector>(new JoyStickAxisVector())); 191 191 while (joyStickButtons_.size() < joySticks_.size()) 192 joyStickButtons_.push_back(s hared_ptr<JoyStickButtonVector>(new JoyStickButtonVector()));192 joyStickButtons_.push_back(std::shared_ptr<JoyStickButtonVector>(new JoyStickButtonVector())); 193 193 // For the case the new size is smaller 194 194 this->joyStickAxes_.resize(joySticks_.size()); -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h
r10769 r10771 36 36 #include <vector> 37 37 #include <map> 38 #include < boost/shared_ptr.hpp>38 #include <memory> 39 39 40 40 #include "InputHandler.h" … … 127 127 }; 128 128 //! Actual key bindings for joy stick buttons 129 std::vector<s hared_ptr<JoyStickButtonVector>> joyStickButtons_;129 std::vector<std::shared_ptr<JoyStickButtonVector>> joyStickButtons_; 130 130 //! Helper class to use something like std:vector<HalfAxis[48]> 131 131 struct JoyStickAxisVector … … 135 135 }; 136 136 //! Actual key bindings for joy stick axes (and sliders) 137 std::vector<s hared_ptr<JoyStickAxisVector>> joyStickAxes_;137 std::vector<std::shared_ptr<JoyStickAxisVector>> joyStickAxes_; 138 138 139 139 //! Pointer map with all Buttons, including half axes -
code/branches/cpp11_v2/src/orxonox/sound/AmbientSound.cc
r10765 r10771 92 92 { 93 93 const std::string& path = "ambient/" + mood + '/' + this->ambientSource_; 94 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);94 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path); 95 95 if (fileInfo != nullptr) 96 96 { -
code/branches/cpp11_v2/src/orxonox/sound/BaseSound.h
r9667 r10771 33 33 34 34 #include <string> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include <OgreDataStream.h> 37 37 #include "core/object/Listable.h" … … 107 107 ALuint audioSource_; 108 108 bool bPooling_; 109 s hared_ptr<SoundBuffer> soundBuffer_;109 std::shared_ptr<SoundBuffer> soundBuffer_; 110 110 std::string source_; 111 111 float volume_; -
code/branches/cpp11_v2/src/orxonox/sound/SoundBuffer.cc
r10769 r10771 39 39 namespace orxonox 40 40 { 41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator)41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator) 42 42 : filename_(filename) 43 43 , audioBuffer_(AL_NONE) … … 48 48 49 49 // Get resource info 50 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename);50 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 51 51 if (fileInfo == nullptr) 52 52 { … … 83 83 } 84 84 85 void SoundBuffer::loadStandard(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)85 void SoundBuffer::loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 86 86 { 87 87 // Read everything into a temporary buffer … … 127 127 } 128 128 129 void SoundBuffer::loadOgg(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)129 void SoundBuffer::loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 130 130 { 131 131 char inbuffer[256*1024]; -
code/branches/cpp11_v2/src/orxonox/sound/SoundBuffer.h
r10769 r10771 33 33 34 34 #include <list> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include "core/Resource.h" 37 37 … … 45 45 { 46 46 friend class SoundManager; 47 #if !defined(_MSC_VER) || _MSC_VER >= 150048 // Make sure nobody deletes an instance (using strong pointers)49 template <class T>50 friend void boost::checked_delete(T*);51 #endif52 47 53 48 public: 54 #if defined(_MSC_VER) && _MSC_VER < 150055 49 ~SoundBuffer(); 56 #endif57 50 inline ALuint getBuffer() 58 51 { return this->audioBuffer_; } … … 64 57 65 58 private: 66 SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer>>::iterator poolIterator); 67 #if !defined(_MSC_VER) || _MSC_VER >= 1500 68 ~SoundBuffer(); 69 #endif 70 void loadStandard(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 71 void loadOgg(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 59 SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator); 60 void loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 61 void loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 72 62 73 63 std::string filename_; 74 64 ALuint audioBuffer_; 75 std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator_;65 std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator_; 76 66 }; 77 67 } -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
r10769 r10771 505 505 } 506 506 507 s hared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename)508 { 509 s hared_ptr<SoundBuffer> buffer;507 std::shared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename) 508 { 509 std::shared_ptr<SoundBuffer> buffer; 510 510 // Check active or pooled buffers 511 511 SoundBufferMap::const_iterator it = this->soundBuffers_.find(filename); … … 538 538 } 539 539 540 void SoundManager::releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer)540 void SoundManager::releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer) 541 541 { 542 542 // Check if others are still using the buffer … … 551 551 while (this->effectsPoolSize_ + it->second->getSize() > this->maxEffectsPoolSize_s && !this->effectsPool_.empty()) 552 552 { 553 s hared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back();553 std::shared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back(); 554 554 this->effectsPoolSize_ -= bufferDel->getSize(); 555 555 bufferDel->poolIterator_ = this->effectsPool_.end(); -
code/branches/cpp11_v2/src/orxonox/sound/SoundManager.h
r10769 r10771 36 36 #include <map> 37 37 #include <string> 38 #include < boost/shared_ptr.hpp>38 #include <memory> 39 39 40 40 #include "util/Singleton.h" … … 96 96 // tolua_end 97 97 98 s hared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);99 void releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer);98 std::shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename); 99 void releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer); 100 100 101 101 ALuint getSoundSource(BaseSound* object); … … 139 139 static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024; 140 140 unsigned int effectsPoolSize_; 141 typedef std::list<s hared_ptr<SoundBuffer>> EffectsPoolList;141 typedef std::list<std::shared_ptr<SoundBuffer>> EffectsPoolList; 142 142 EffectsPoolList effectsPool_; 143 typedef std::map<std::string, s hared_ptr<SoundBuffer>> SoundBufferMap;143 typedef std::map<std::string, std::shared_ptr<SoundBuffer>> SoundBufferMap; 144 144 SoundBufferMap soundBuffers_; 145 145
Note: See TracChangeset
for help on using the changeset viewer.