Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2010, 9:52:13 PM (14 years ago)
Author:
landauf
Message:

createFunctor() now returns a SharedPtr instead of a pointer. Adapted code that uses createFunctor() accordingly.

Location:
code/branches/consolecommands3/src/libraries/network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/network/NetworkFunction.cc

    r6417 r7198  
    6868
    6969
    70   NetworkFunctionStatic::NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p):
     70  NetworkFunctionStatic::NetworkFunctionStatic(const FunctorStaticPtr& functor, const std::string& name, const NetworkFunctionPointer& p):
    7171    NetworkFunctionBase(name)
    7272  {
     
    7676    NetworkFunctionStatic::getFunctorMap()[p] = this;
    7777    NetworkFunctionStatic::getIdMap()[ this->getNetworkID() ] = this;
    78   }
    79 
    80   NetworkFunctionStatic::~NetworkFunctionStatic()
    81   {
    82     delete this->functor_;
    8378  }
    8479
  • code/branches/consolecommands3/src/libraries/network/NetworkFunction.h

    r6417 r7198  
    102102class _NetworkExport NetworkFunctionStatic: public NetworkFunctionBase {
    103103  public:
    104     NetworkFunctionStatic(FunctorStatic* functor, const std::string& name, const NetworkFunctionPointer& p);
    105     ~NetworkFunctionStatic();
     104    NetworkFunctionStatic(const FunctorStaticPtr& functor, const std::string& name, const NetworkFunctionPointer& p);
    106105
    107106    inline void call(){ (*this->functor_)(); }
     
    124123    static std::map<NetworkFunctionPointer, NetworkFunctionStatic*>& getFunctorMap();
    125124    static std::map<uint32_t, NetworkFunctionStatic*>& getIdMap();
    126     FunctorStatic* functor_;
     125    FunctorStaticPtr functor_;
    127126
    128127};
     
    155154template <class T> class NetworkMemberFunction: public NetworkMemberFunctionBase {
    156155  public:
    157     NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p);
    158     ~NetworkMemberFunction();
     156    NetworkMemberFunction(const FunctorMemberPtr<T>& functor, const std::string& name, const NetworkFunctionPointer& p);
    159157
    160158    inline void call(uint32_t objectID)
     
    190188
    191189  private:
    192     FunctorMember<T>* functor_;
    193 };
    194 
    195 template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(FunctorMember<T>* functor, const std::string& name, const NetworkFunctionPointer& p):
     190    FunctorMemberPtr<T> functor_;
     191};
     192
     193template <class T> NetworkMemberFunction<T>::NetworkMemberFunction(const FunctorMemberPtr<T>& functor, const std::string& name, const NetworkFunctionPointer& p):
    196194    NetworkMemberFunctionBase(name, p), functor_(functor)
    197195{
    198 }
    199 template <class T> NetworkMemberFunction<T>::~NetworkMemberFunction()
    200 {
    201   delete this->functor_;
    202196}
    203197
Note: See TracChangeset for help on using the changeset viewer.