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