summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set_Find.h
blob: 6f68524d8ac332fa18289b94f4409c521dd42221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// -*- C++ -*-

//=============================================================================
/**
 *  @file    PG_Property_Set_Find.h
 *
 *  $Id$
 *
 *  This is a companion function for the properties docoder
 *  to work around compilers that don't support templated methods.
 *
 *  @author Dale Wilson <wilson_d@ociweb.com>
 */
//=============================================================================
#ifndef TAO_PG_PROPERTY_SET_FIND_H
#define TAO_PG_PROPERTY_SET_FIND_H
#include /**/ "ace/pre.h"
#include <ace/ACE.h>

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/PortableGroup/portablegroup_export.h"

#include "ace/Hash_Map_Manager.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  /**
   * Find a value in a TAO::PG_Property_Set.
   * This is a work-around for the lack of
   * templated methods.
   */
  template <typename TYPE>
  int find (const PG_Property_Set & decoder, const ACE_CString & key, TYPE & value)
  {
    int result = 0;
    PortableGroup::Value const * any;
    if ( decoder.find (key, any))
    {
      result = ((*any) >>= value);
    }
    return result;
  }

} //namespace TAO

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"

#endif // TAO_PG_PROPERTY_SET_FIND_H