Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / TAO / tests / OctetSeq / test_i.cpp
blobb1beb06c758c8bd4916668ec67c92ded3e6d2513
1 // -*- C++ -*-
2 #include "test_i.h"
3 #include "ace/ACE.h"
5 #if !defined(__ACE_INLINE__)
6 #include "test_i.inl"
7 #endif /* __ACE_INLINE__ */
9 Database_i::~Database_i ()
11 delete[] this->elements_;
14 void
15 Database_i::set (Test::Index i,
16 const Test::OctetSeq& seq,
17 CORBA::Double verification_token,
18 CORBA::Double_out returned_token)
20 if (i >= this->max_range_)
21 throw Test::OutOfRange (0, this->max_range_);
23 returned_token = verification_token;
25 #if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
26 CORBA::ULong len = seq.length ();
27 // CORBA::ULong max = seq.maximum ();
28 ACE_Message_Block *mb = seq.mb ();
29 if (mb == 0)
31 this->elements_[i] = seq;
33 else
35 this->elements_[i].replace (len, seq.mb ());
37 #else
38 this->elements_[i] = seq;
39 #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
42 Test::OctetSeq*
43 Database_i::get (Test::Index i)
45 if (i >= this->max_range_)
46 throw Test::OutOfRange (0, this->max_range_);
48 Test::OctetSeq* copy = 0;
49 ACE_NEW_THROW_EX (copy,
50 Test::OctetSeq (this->elements_[i]),
51 CORBA::NO_MEMORY ());
52 return copy;
55 CORBA::ULong
56 Database_i::get_crc (Test::Index i)
58 if (i >= this->max_range_)
59 throw Test::OutOfRange (0, this->max_range_);
61 return ACE::crc32 (this->elements_[i].get_buffer (),
62 this->elements_[i].length ());
65 void
66 Database_i::shutdown ()
68 this->orb_->shutdown ();