usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/inc/msmmnodebase.h
changeset 0 c9bc50fca66e
equal deleted inserted replaced
-1:000000000000 0:c9bc50fca66e
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #ifndef MSMMNODEBASE_H
       
    24 #define MSMMNODEBASE_H
       
    25 
       
    26 #include <e32base.h>
       
    27 #include "msmm_pub_def.h"
       
    28 
       
    29 #ifdef __OVER_DUMMYCOMPONENT__
       
    30 #include <usb/hostms/dummycomponent/rusbhostmsdevice.h>
       
    31 #else
       
    32 #include <rusbhostmsdevice.h> // For RUsbHostMsDevice
       
    33 #endif
       
    34 
       
    35 class TMsmmNodeBase
       
    36     {    
       
    37 public:
       
    38 	TMsmmNodeBase(TInt aIdentifier);
       
    39     virtual ~TMsmmNodeBase();
       
    40 
       
    41     void AddChild(TMsmmNodeBase* aChild);
       
    42     TMsmmNodeBase* SearchInChildren(TInt aIdentifier);
       
    43     
       
    44 private:
       
    45     void DestroyNode();
       
    46     
       
    47 private:
       
    48     TInt    iIdentifier;
       
    49     
       
    50 protected:
       
    51     /**
       
    52      A pointer to the next peer of this entry, or NULL.
       
    53      */
       
    54     TMsmmNodeBase* iNextPeer;
       
    55 
       
    56     /**
       
    57      A pointer to the first child of this entry, or NULL.
       
    58      */
       
    59     TMsmmNodeBase* iFirstChild;
       
    60     
       
    61     /**
       
    62      A pointer to the last child of this entry, or NULL.
       
    63      */
       
    64     TMsmmNodeBase* iLastChild;
       
    65 
       
    66     /**
       
    67      A pointer to the parent to this entry, or NULL.
       
    68      */
       
    69     TMsmmNodeBase* iParent;
       
    70     };
       
    71 
       
    72 class TUsbMsInterface;
       
    73 // The USB MS device node class
       
    74 NONSHARABLE_CLASS(TUsbMsDevice) : public TMsmmNodeBase
       
    75     {
       
    76 public:
       
    77     TUsbMsDevice(const TUSBMSDeviceDescription& aDevice);
       
    78 
       
    79     inline TUsbMsInterface* FirstChild() const;
       
    80     
       
    81 public:
       
    82     TUSBMSDeviceDescription iDevice;
       
    83     };
       
    84 
       
    85 class TUsbMsLogicalUnit;
       
    86 // The USB MS interface node class
       
    87 NONSHARABLE_CLASS(TUsbMsInterface) : public TMsmmNodeBase
       
    88     {
       
    89 public:
       
    90     TUsbMsInterface(TUint8 aInterfaceNumber, 
       
    91             TUint32 aInterfaceToken);
       
    92     ~TUsbMsInterface();
       
    93 
       
    94     inline TUsbMsInterface* NextPeer() const;
       
    95     inline TUsbMsLogicalUnit* FirstChild() const;
       
    96     
       
    97 public:
       
    98     TUint8 iInterfaceNumber;
       
    99     TUint32 iInterfaceToken;
       
   100     RUsbHostMsDevice iUsbMsDevice;
       
   101     };
       
   102 
       
   103 // The USB MS logical unit node class
       
   104 NONSHARABLE_CLASS(TUsbMsLogicalUnit) : public TMsmmNodeBase
       
   105     {
       
   106 public:
       
   107     TUsbMsLogicalUnit(TUint8 aLogicalUnitNumber, 
       
   108             TText aDrive);
       
   109 
       
   110     inline TUsbMsLogicalUnit* NextPeer() const;
       
   111     inline TUsbMsInterface* Parent() const;
       
   112     
       
   113 public:
       
   114     TUint8 iLogicalUnitNumber; // Logic Unit Number
       
   115     TText iDrive;
       
   116     };
       
   117 
       
   118 inline TUsbMsInterface* TUsbMsDevice::FirstChild() const
       
   119     {return static_cast<TUsbMsInterface*>(iFirstChild);}
       
   120 
       
   121 inline TUsbMsLogicalUnit* TUsbMsInterface::FirstChild() const
       
   122     {return static_cast<TUsbMsLogicalUnit*>(iFirstChild);}
       
   123 inline TUsbMsInterface* TUsbMsInterface::NextPeer() const
       
   124     {return static_cast<TUsbMsInterface*>(iNextPeer);}
       
   125 
       
   126 inline TUsbMsLogicalUnit* TUsbMsLogicalUnit::NextPeer() const
       
   127     {return static_cast<TUsbMsLogicalUnit*>(iNextPeer);}
       
   128 inline TUsbMsInterface* TUsbMsLogicalUnit::Parent() const
       
   129     {return static_cast<TUsbMsInterface*>(iParent);}
       
   130 
       
   131 #endif /*MSMMNODEBASE_H*/