summaryrefslogtreecommitdiff
path: root/CIAO/ciao/Cookies.cpp
blob: 4a319577be4a16dd28aa1a9ce652c1fc1a84aa4a (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// $Id$
#include "Cookies.h"

#if !defined (__ACE_INLINE__)
#include "Cookies.inl"
#endif /* !defined INLINE */

ACE_RCSID (ciao,
           Cookies,
           "$Id$")

namespace CIAO
{
  Map_Key_Cookie::Map_Key_Cookie (const ACE_Active_Map_Manager_Key &key)
  {
    this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ());
    key.encode (this->cookieValue ().get_buffer (0));
  }

  Map_Key_Cookie::~Map_Key_Cookie (void)
  {
  }

  bool
  Map_Key_Cookie::insert (ACE_Active_Map_Manager_Key &key)
  {
    this->cookieValue ().length (ACE_Active_Map_Manager_Key::size ());
    key.encode (this->cookieValue ().get_buffer (0));
    return true;
  }

  bool
  Map_Key_Cookie::extract (::Components::Cookie *ck,
                           ACE_Active_Map_Manager_Key &key)
  {
    Map_Key_Cookie *c =
      dynamic_cast <Map_Key_Cookie *> (ck);

    if (c == 0)
      return false;

    ::CORBA::OctetSeq *x = c->get_cookie ();

    if (x->length () != ACE_Active_Map_Manager_Key::size ())
      return false;

    key.decode (x->get_buffer ());

    return true;
  }

  ::CORBA::OctetSeq *
  Map_Key_Cookie::get_cookie (void)
  {
    return &this->cookieValue ();
  }

  //========================================================
  CORBA::ValueBase *
  Map_Key_Cookie_init::create_for_unmarshal (ACE_ENV_SINGLE_ARG_DECL)
  {
    CORBA::ValueBase *ret_val = 0;

    ACE_NEW_THROW_EX (ret_val,
                      CIAO::Map_Key_Cookie,
                      CORBA::NO_MEMORY ());

    // @@ (OO) An "ACE_CHECK_RETURN (0) is missing here.

    return ret_val;
  }


}