Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 22, 2015, 4:55:02 PM (9 years ago)
Author:
landauf
Message:

use std::shared_ptr instead of orxonox::SharedPtr for FunctorPtr and ExecutorPtr

Location:
code/branches/cpp11_v2
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/EventIncludes.h

    r10769 r10825  
    8686
    8787#define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \
    88     static orxonox::ExecutorMemberPtr<classname> xmlsetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname>>(); \
    89     static orxonox::ExecutorMemberPtr<classname> xmlgetfunctor##name = orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')').cast<orxonox::ExecutorMember<classname>>(); \
     88    static orxonox::ExecutorPtr xmlsetfunctorbase##name = orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')'); \
     89    static orxonox::ExecutorPtr xmlgetfunctorbase##name = orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')'); \
     90    static orxonox::ExecutorMemberPtr<classname> xmlsetfunctor##name = std::static_pointer_cast<orxonox::ExecutorMember<classname>>(xmlsetfunctorbase##name); \
     91    static orxonox::ExecutorMemberPtr<classname> xmlgetfunctor##name = std::static_pointer_cast<orxonox::ExecutorMember<classname>>(xmlgetfunctorbase##name); \
    9092    xmlsetfunctor##name->setDefaultValue(1, statename); \
    9193    xmlgetfunctor##name->setDefaultValue(1, statename); \
  • code/branches/cpp11_v2/src/libraries/core/command/CommandExecutor.cc

    r10765 r10825  
    275275        {
    276276            // it is valid - copy the executor of this command
    277             ExecutorPtr executor = new Executor(*evaluation.getConsoleCommand()->getExecutor().get());
     277            ExecutorPtr executor = std::make_shared<Executor>(*evaluation.getConsoleCommand()->getExecutor().get());
    278278
    279279            // evaluate the arguments and if this returns no error, store them as default values
  • code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc

    r10821 r10825  
    320320    {
    321321        if (this->executor_)
    322             this->pushFunction(new Executor(*this->executor_.get()));
     322            this->pushFunction(std::make_shared<Executor>(*this->executor_.get()));
    323323        else
    324324            orxout(internal_error, context::commands) << "Couldn't push copy of executor in console command \"" << this->baseName_ << "\", no executor set." << endl;
  • code/branches/cpp11_v2/src/libraries/core/command/Executor.h

    r10768 r10825  
    267267    inline ExecutorPtr createExecutor(const FunctorPtr& functor, const std::string& name = "")
    268268    {
    269         return new Executor(functor, name);
     269        return std::make_shared<Executor>(functor, name);
    270270    }
    271271
     
    274274    inline ExecutorMemberPtr<T> createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "")
    275275    {
    276         return new ExecutorMember<T>(functor, name);
     276        return std::make_shared<ExecutorMember<T>>(functor, name);
    277277    }
    278278
     
    280280    inline ExecutorStaticPtr createExecutor(const FunctorStaticPtr& functor, const std::string& name = "")
    281281    {
    282         return new ExecutorStatic(functor, name);
     282        return std::make_shared<ExecutorStatic>(functor, name);
    283283    }
    284284}
  • code/branches/cpp11_v2/src/libraries/core/command/ExecutorPtr.h

    r10781 r10825  
    4949
    5050#include "core/CorePrereqs.h"
    51 #include "util/SharedPtr.h"
     51#include <memory>
    5252
    5353namespace orxonox
    5454{
    55     using ExecutorPtr = SharedPtr<Executor>;
    56     using ExecutorStaticPtr = SharedChildPtr<ExecutorStatic, ExecutorPtr>;
     55    using ExecutorPtr = std::shared_ptr<Executor>;
     56    using ExecutorStaticPtr = std::shared_ptr<ExecutorStatic>;
    5757    template <class T>
    58     using ExecutorMemberPtr = SharedChildPtr<ExecutorMember<T>, ExecutorPtr>;
     58    using ExecutorMemberPtr = std::shared_ptr<ExecutorMember<T>>;
    5959}
    6060
  • code/branches/cpp11_v2/src/libraries/core/command/Functor.h

    r10817 r10825  
    505505            FunctorPtr clone()
    506506            {
    507                 return new FunctorTemplate(*this);
     507                return std::make_shared<FunctorTemplate>(*this);
    508508            }
    509509
     
    574574    };
    575575
    576     template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    577     template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object)     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    578     template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object)         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    579     template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2), OO* object)             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    580     template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1), OO* object)                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    581     template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(), OO* object)                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    582     template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    583     template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    584     template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    585     template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    586     template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const, OO* object)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    587     template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const, OO* object)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
    588 
    589     template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    590     template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    591     template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    592     template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2))             { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    593     template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1))                 { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    594     template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)())                   { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    595     template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    596     template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const)     { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    597     template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const)         { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    598     template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const)             { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    599     template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const)                 { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    600     template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const)                   { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
    601 
    602     template <class R, class P1, class P2, class P3, class P4, class P5> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    603     template <class R, class P1, class P2, class P3, class P4>           inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4))     { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    604     template <class R, class P1, class P2, class P3>                     inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3))         { return new FunctorTemplate<R, void, false, P1, P2, P3, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    605     template <class R, class P1, class P2>                               inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2))             { return new FunctorTemplate<R, void, false, P1, P2, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    606     template <class R, class P1>                                         inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1))                 { return new FunctorTemplate<R, void, false, P1, void, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    607     template <class R>                                                   inline FunctorStaticPtr createFunctor(R (*functionPointer)())                   { return new FunctorTemplate<R, void, false, void, void, void, void, void>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     576    template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     577    template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object)     { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, P4, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     578    template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object)         { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     579    template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2), OO* object)             { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     580    template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1), OO* object)                 { return std::make_shared<FunctorTemplate<R, O, false, P1, void, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     581    template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(), OO* object)                   { return std::make_shared<FunctorTemplate<R, O, false, void, void, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     582    template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     583    template <class R, class O, class OO, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object)     { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, P4, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     584    template <class R, class O, class OO, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object)         { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     585    template <class R, class O, class OO, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object)             { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     586    template <class R, class O, class OO, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const, OO* object)                 { return std::make_shared<FunctorTemplate<R, O, true, P1, void, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     587    template <class R, class O, class OO>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const, OO* object)                   { return std::make_shared<FunctorTemplate<R, O, true, void, void, void, void, void>>(functionPointer, object); }   ///< Creates a new FunctorMember with the given function-pointer and an assigned object
     588
     589    template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     590    template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4))     { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, P4, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     591    template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3))         { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, P3, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     592    template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2))             { return std::make_shared<FunctorTemplate<R, O, false, P1, P2, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     593    template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1))                 { return std::make_shared<FunctorTemplate<R, O, false, P1, void, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     594    template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)())                   { return std::make_shared<FunctorTemplate<R, O, false, void, void, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     595    template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     596    template <class R, class O, class P1, class P2, class P3, class P4>           inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const)     { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, P4, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     597    template <class R, class O, class P1, class P2, class P3>                     inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const)         { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, P3, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     598    template <class R, class O, class P1, class P2>                               inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const)             { return std::make_shared<FunctorTemplate<R, O, true, P1, P2, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     599    template <class R, class O, class P1>                                         inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const)                 { return std::make_shared<FunctorTemplate<R, O, true, P1, void, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     600    template <class R, class O>                                                   inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const)                   { return std::make_shared<FunctorTemplate<R, O, true, void, void, void, void, void>>(functionPointer); }   ///< Creates a new FunctorMember with the given function-pointer
     601
     602    template <class R, class P1, class P2, class P3, class P4, class P5> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return std::make_shared<FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     603    template <class R, class P1, class P2, class P3, class P4>           inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4))     { return std::make_shared<FunctorTemplate<R, void, false, P1, P2, P3, P4, void>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     604    template <class R, class P1, class P2, class P3>                     inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3))         { return std::make_shared<FunctorTemplate<R, void, false, P1, P2, P3, void, void>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     605    template <class R, class P1, class P2>                               inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2))             { return std::make_shared<FunctorTemplate<R, void, false, P1, P2, void, void, void>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     606    template <class R, class P1>                                         inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1))                 { return std::make_shared<FunctorTemplate<R, void, false, P1, void, void, void, void>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
     607    template <class R>                                                   inline FunctorStaticPtr createFunctor(R (*functionPointer)())                   { return std::make_shared<FunctorTemplate<R, void, false, void, void, void, void, void>>(functionPointer); }   ///< Creates a new Functor with the given function-pointer
    608608}
    609609
  • code/branches/cpp11_v2/src/libraries/core/command/FunctorPtr.h

    r10781 r10825  
    5151
    5252#include "core/CorePrereqs.h"
    53 #include "util/SharedPtr.h"
     53#include <memory>
    5454
    5555namespace orxonox
    5656{
    57     using FunctorPtr = SharedPtr<Functor>;
     57    using FunctorPtr = std::shared_ptr<Functor>;
    5858    template <class T>
    59     using FunctorMemberPtr = SharedChildPtr<FunctorMember<T>, FunctorPtr>;
    60     using FunctorStaticPtr = FunctorMemberPtr<void>;
     59    using FunctorMemberPtr = std::shared_ptr<FunctorMember<T>>;
     60    using FunctorStaticPtr = std::shared_ptr<FunctorMember<void>>;
    6161    template <class F, class T>
    62     using FunctorPointerPtr = SharedChildPtr<FunctorPointer<F, T>, FunctorMemberPtr<T>>;
     62    using FunctorPointerPtr = std::shared_ptr<FunctorPointer<F, T>>;
    6363}
    6464
  • code/branches/cpp11_v2/src/libraries/core/input/KeyBinderManager.h

    r10765 r10825  
    3636
    3737#include "util/Singleton.h"
     38#include "util/SharedPtr.h"
    3839#include "core/config/Configurable.h"
    3940
  • code/branches/cpp11_v2/src/libraries/core/object/Listable.h

    r9667 r10825  
    4040#include <vector>
    4141
     42#include "util/SmallObjectAllocator.h"
    4243#include "core/class/Identifiable.h"
    4344
  • code/branches/cpp11_v2/test/core/command/ExecutorPtrTest.cc

    r10822 r10825  
    1111                void testMember() {}
    1212                static void testStatic() {}
     13        };
     14
     15        class Subclass : public Testclass
     16        {
    1317        };
    1418
     
    7175        ASSERT_TRUE(static_cast<bool>(ptr2));
    7276    }
     77
     78    TEST_F(ExecutorPtrTest, canCastToExecutorMemberOfSubclass)
     79    {
     80        ExecutorPtr ptr1 = createExecutor(createFunctor(&Subclass::testMember));
     81        ExecutorMemberPtr<Subclass> ptr2 = std::static_pointer_cast<ExecutorMember<Subclass>>(ptr1);
     82        ASSERT_TRUE(static_cast<bool>(ptr2));
     83    }
    7384}
  • code/branches/cpp11_v2/test/core/command/FunctorPtrTest.cc

    r10822 r10825  
    1111                void testMember() {}
    1212                static void testStatic() {}
     13        };
     14
     15        class Subclass : public Testclass
     16        {
    1317        };
    1418
     
    7175        ASSERT_TRUE(static_cast<bool>(ptr2));
    7276    }
     77
     78    TEST_F(FunctorPtrTest, canCastToFunctorMemberOfSubclass)
     79    {
     80        FunctorPtr ptr1 = createFunctor(&Subclass::testMember);
     81        FunctorMemberPtr<Subclass> ptr2 = std::static_pointer_cast<FunctorMember<Subclass>>(ptr1);
     82        ASSERT_TRUE(static_cast<bool>(ptr2));
     83    }
    7384}
Note: See TracChangeset for help on using the changeset viewer.