interface/object/POIObject.inl
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : POIObject.inl
       
     3  * Description : ECOM interface definition
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 inline CPOIObject* CPOIObject::NewL(const TDesC8& aMatch, const CPOIProvider& aProvider)
       
    16 {
       
    17     const TUid KCPOIRendererInterfaceUid = { KObjectInterfaceUidValue };
       
    18 
       
    19     TAny* param = const_cast<CPOIProvider*>(&aProvider);
       
    20 
       
    21     TEComResolverParams resolverParams;
       
    22     resolverParams.SetDataType(aMatch);
       
    23     resolverParams.SetWildcardMatch(ETrue);
       
    24 
       
    25     TAny* interface = REComSession::CreateImplementationL(KCPOIRendererInterfaceUid,
       
    26         _FOFF(CPOIObject, iDtor_ID_Key), param, resolverParams);
       
    27 
       
    28     return reinterpret_cast <CPOIObject*>(interface);
       
    29 }
       
    30 
       
    31 inline CPOIObject* CPOIObject::NewL(const TUid aImplementationUid, const CPOIProvider& aProvider)
       
    32 {
       
    33     TAny* param = const_cast<CPOIProvider*>(&aProvider);
       
    34 
       
    35     TAny* interface = REComSession::CreateImplementationL(aImplementationUid, 
       
    36         _FOFF(CPOIObject, iDtor_ID_Key), param);
       
    37 
       
    38     return reinterpret_cast <CPOIObject*>(interface);
       
    39 }
       
    40 
       
    41 inline CPOIObject::~CPOIObject()
       
    42 {
       
    43     REComSession::DestroyedImplementation(iDtor_ID_Key);
       
    44 }
       
    45 
       
    46 inline CPOIObject::CPOIObject(const CPOIProvider& aProvider)
       
    47     : iProvider(aProvider)
       
    48 {}
       
    49 
       
    50 inline const TCoordinate& CPOIObject::GetCoordinate() const
       
    51 {
       
    52     return iCoordinate;
       
    53 }
       
    54 
       
    55 inline void CPOIObject::SetCoordinate(const TCoordinate& aCoordinate)
       
    56 {
       
    57     iCoordinate = aCoordinate;
       
    58 }
       
    59 
       
    60 inline const Vector3d& CPOIObject::GetPosition() const
       
    61 {
       
    62     return iPosition;
       
    63 }
       
    64 
       
    65 inline void CPOIObject::SetPosition(const Vector3d& aPosition)
       
    66 {
       
    67     iPosition = aPosition;
       
    68 }
       
    69 
       
    70 inline TUint32 CPOIObject::GetIdentifier() const
       
    71 {
       
    72     return iIdentifier;
       
    73 }
       
    74 
       
    75 inline void CPOIObject::SetIdentifier(TUint32 aIdentifier)
       
    76 {
       
    77     iIdentifier = aIdentifier;
       
    78 }
       
    79 
       
    80 inline const TDesC& CPOIObject::GetName() const
       
    81 {
       
    82     return iName? *iName : KNullDesC();
       
    83 }
       
    84 
       
    85 inline void CPOIObject::SetNameL(const TDesC& aName)
       
    86 {
       
    87     delete iName;
       
    88     iName = 0;
       
    89 
       
    90     iName = aName.AllocL();
       
    91 }
       
    92 
       
    93 inline TBool CPOIObject::IdentityRelation(const CPOIObject& aLeft, const CPOIObject& aRight)
       
    94 {
       
    95     return aLeft.GetIdentifier() == aRight.GetIdentifier();
       
    96 }