~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/tests/OctetSeq/test_i.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// test_i.cpp,v 1.8 2003/08/04 01:58:43 bala Exp
2
 
 
3
 
#include "test_i.h"
4
 
#include "ace/ACE.h"
5
 
 
6
 
#if !defined(__ACE_INLINE__)
7
 
#include "test_i.i"
8
 
#endif /* __ACE_INLINE__ */
9
 
 
10
 
ACE_RCSID(OctetSeq, test_i, "test_i.cpp,v 1.8 2003/08/04 01:58:43 bala Exp")
11
 
 
12
 
Database_i::~Database_i (void)
13
 
{
14
 
  delete[] this->elements_;
15
 
}
16
 
 
17
 
void
18
 
Database_i::set (Test::Index i,
19
 
                 const Test::OctetSeq& seq,
20
 
                 CORBA::Double verification_token,
21
 
                 CORBA::Double_out returned_token
22
 
                 ACE_ENV_ARG_DECL)
23
 
    ACE_THROW_SPEC ((Test::OutOfRange))
24
 
{
25
 
  if (i >= this->max_range_)
26
 
    ACE_THROW (Test::OutOfRange (0, this->max_range_));
27
 
 
28
 
  returned_token = verification_token;
29
 
 
30
 
  CORBA::ULong len = seq.length ();
31
 
#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
32
 
  // CORBA::ULong max = seq.maximum ();
33
 
  ACE_Message_Block *mb = seq.mb ();
34
 
  if (mb == 0)
35
 
    {
36
 
      this->elements_[i] = seq;
37
 
    }
38
 
  else
39
 
    {
40
 
      this->elements_[i].replace (len, seq.mb ());
41
 
    }
42
 
#else
43
 
  this->elements_[i] = seq;
44
 
#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
45
 
}
46
 
 
47
 
Test::OctetSeq*
48
 
Database_i::get (Test::Index i
49
 
                 ACE_ENV_ARG_DECL)
50
 
    ACE_THROW_SPEC ((CORBA::SystemException,Test::OutOfRange))
51
 
{
52
 
  if (i >= this->max_range_)
53
 
    ACE_THROW_RETURN (Test::OutOfRange (0, this->max_range_), 0);
54
 
 
55
 
  Test::OctetSeq* copy;
56
 
  ACE_NEW_THROW_EX (copy,
57
 
                    Test::OctetSeq (this->elements_[i]),
58
 
                    CORBA::NO_MEMORY ());
59
 
  ACE_CHECK_RETURN (0);
60
 
  return copy;
61
 
}
62
 
 
63
 
CORBA::ULong
64
 
Database_i::get_crc (Test::Index i
65
 
                     ACE_ENV_ARG_DECL)
66
 
    ACE_THROW_SPEC ((CORBA::SystemException,Test::OutOfRange))
67
 
{
68
 
  if (i >= this->max_range_)
69
 
    ACE_THROW_RETURN (Test::OutOfRange (0, this->max_range_), 0);
70
 
 
71
 
  return ACE::crc32 (ACE_reinterpret_cast (const char*,
72
 
                                           this->elements_[i].get_buffer ()),
73
 
                     this->elements_[i].length ());
74
 
}
75
 
 
76
 
void
77
 
Database_i::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
78
 
    ACE_THROW_SPEC ((CORBA::SystemException))
79
 
{
80
 
  this->orb_->shutdown ();
81
 
}