javamanager/javacaptain/src/plugindata.h
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  PluginData
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef PLUGINDATA_H
       
    19 #define PLUGINDATA_H
       
    20 
       
    21 #include <string>
       
    22 #include <memory>
       
    23 
       
    24 #include "dynamiclibloader.h"
       
    25 
       
    26 #include "plugininterface.h"
       
    27 
       
    28 namespace java
       
    29 {
       
    30 namespace captain
       
    31 {
       
    32 
       
    33 class CoreInterface;
       
    34 
       
    35 class PluginData
       
    36 {
       
    37 public:
       
    38     PluginData(PluginInterface* aPluginInterface,
       
    39                const std::string& aName)
       
    40             :mPluginInterface(aPluginInterface),mLoadCount(1), mName(aName)
       
    41     {
       
    42     }
       
    43     virtual ~PluginData()
       
    44     {
       
    45         mPluginInterface->stopPlugin();
       
    46         delete mPluginInterface;
       
    47     }
       
    48 
       
    49     virtual unsigned int addLoadCount()
       
    50     {
       
    51         return ++mLoadCount;
       
    52     }
       
    53     virtual unsigned int decLoadCount()
       
    54     {
       
    55         return (mLoadCount == 0 ? mLoadCount : --mLoadCount);
       
    56     }
       
    57 
       
    58     virtual std::string getName() const
       
    59     {
       
    60         return mName;
       
    61     }
       
    62 protected:
       
    63     std::auto_ptr<java::util::DynamicLibLoader> mDllLoader;
       
    64 
       
    65 private:
       
    66     PluginInterface*                            mPluginInterface;
       
    67     unsigned int                                mLoadCount;
       
    68     const std::string                           mName;
       
    69 
       
    70     //Not implemented.
       
    71     PluginData &operator=(const PluginData&);
       
    72     PluginData(const PluginData&);
       
    73 };
       
    74 } // namespace captain
       
    75 } // namespace java
       
    76 
       
    77 #endif // PLUGINDATA_H
       
    78